@@ -26,3 +26,36 @@ it('should generate every possible class, without variants', () => {
2626
2727 expect ( classes ) . not . toContain ( '-m-DEFAULT' )
2828} )
29+
30+ it ( 'should generate every possible class while handling negatives and prefixes' , ( ) => {
31+ let config = { prefix : 'tw-' }
32+ let context = createContext ( resolveConfig ( config ) )
33+ let classes = context . getClassList ( )
34+ expect ( classes ) . toBeInstanceOf ( Array )
35+
36+ // Verify we have a `container` for the 'components' section.
37+ expect ( classes ) . toContain ( 'tw-container' )
38+
39+ // Verify we handle the DEFAULT case correctly
40+ expect ( classes ) . toContain ( 'tw-border' )
41+
42+ // Verify we handle negative values correctly
43+ expect ( classes ) . toContain ( '-tw-inset-1/4' )
44+ expect ( classes ) . toContain ( '-tw-m-0' )
45+ expect ( classes ) . not . toContain ( '-tw-uppercase' )
46+ expect ( classes ) . not . toContain ( '-tw-opacity-50' )
47+
48+ // These utilities do work but there's no reason to generate
49+ // them alongside the `-{prefix}-{utility}` versions
50+ expect ( classes ) . not . toContain ( 'tw--inset-1/4' )
51+ expect ( classes ) . not . toContain ( 'tw--m-0' )
52+
53+ config = {
54+ prefix : 'tw-' ,
55+ theme : { extend : { margin : { DEFAULT : '5px' } } } ,
56+ }
57+ context = createContext ( resolveConfig ( config ) )
58+ classes = context . getClassList ( )
59+
60+ expect ( classes ) . not . toContain ( '-tw-m-DEFAULT' )
61+ } )
0 commit comments