@@ -306,6 +306,19 @@ describe("windctrl", () => {
306306 const numberResult = button ( { w : 300 } ) ;
307307 expect ( numberResult . style ) . toEqual ( { width : "300px" } ) ;
308308 } ) ;
309+
310+ it ( "should resolve style conflicts with last one wins for dynamic styles" , ( ) => {
311+ const box = windctrl ( {
312+ dynamic : {
313+ w1 : ( ) => ( { style : { width : "100px" } } ) ,
314+ w2 : ( ) => ( { style : { width : "200px" } } ) ,
315+ } ,
316+ } ) ;
317+
318+ const result = box ( { w1 : true as any , w2 : true as any } ) ;
319+
320+ expect ( result . style ) . toEqual ( { width : "200px" } ) ;
321+ } ) ;
309322 } ) ;
310323
311324 describe ( "Scopes" , ( ) => {
@@ -342,6 +355,23 @@ describe("windctrl", () => {
342355 "group-data-[scope=header]/wind-scope:text-sm" ,
343356 ) ;
344357 } ) ;
358+
359+ it ( "should prefix every scope class when multiple classes are provided" , ( ) => {
360+ const button = windctrl ( {
361+ scopes : {
362+ header : "text-sm py-1" ,
363+ } ,
364+ } ) ;
365+
366+ const result = button ( { } ) ;
367+
368+ expect ( result . className ) . toContain (
369+ "group-data-[scope=header]/wind-scope:text-sm" ,
370+ ) ;
371+ expect ( result . className ) . toContain (
372+ "group-data-[scope=header]/wind-scope:py-1" ,
373+ ) ;
374+ } ) ;
345375 } ) ;
346376
347377 describe ( "Priority and Integration" , ( ) => {
@@ -446,6 +476,34 @@ describe("windctrl", () => {
446476 expect ( result . className ) . toContain ( "text-blue-500" ) ;
447477 expect ( result . className ) . not . toContain ( "text-red-500" ) ;
448478 } ) ;
479+
480+ it ( "should let Dynamic override Traits when Tailwind classes conflict (via twMerge)" , ( ) => {
481+ const button = windctrl ( {
482+ traits : {
483+ padded : "p-2" ,
484+ } ,
485+ dynamic : {
486+ p : ( val ) => ( typeof val === "number" ? `p-${ val } ` : val ) ,
487+ } ,
488+ } ) ;
489+
490+ const result = button ( { traits : [ "padded" ] , p : 4 } ) ;
491+
492+ expect ( result . className ) . toContain ( "p-4" ) ;
493+ expect ( result . className ) . not . toContain ( "p-2" ) ;
494+ } ) ;
495+
496+ it ( "should let Traits override Base when Tailwind classes conflict (via twMerge)" , ( ) => {
497+ const button = windctrl ( {
498+ base : "p-1" ,
499+ traits : { padded : "p-3" } ,
500+ } ) ;
501+
502+ const result = button ( { traits : [ "padded" ] } ) ;
503+
504+ expect ( result . className ) . toContain ( "p-3" ) ;
505+ expect ( result . className ) . not . toContain ( "p-1" ) ;
506+ } ) ;
449507 } ) ;
450508
451509 describe ( "Edge cases" , ( ) => {
0 commit comments