@@ -143,12 +143,43 @@ describe('file matcher', () => {
143143 ] )
144144
145145 expect ( file . isRawFn ( 'css' ) ) . toMatchInlineSnapshot ( 'true' )
146- expect ( file . isRawFn ( 'xcss' ) ) . toMatchInlineSnapshot ( 'false' )
146+ expect ( file . isRawFn ( 'xcss' ) ) . toMatchInlineSnapshot ( 'true' ) // xcss is an alias for css, should be true
147147
148148 expect ( file . isRawFn ( 'css.raw' ) ) . toMatchInlineSnapshot ( 'true' )
149+ expect ( file . isRawFn ( 'xcss.raw' ) ) . toMatchInlineSnapshot ( 'true' ) // xcss.raw should work too
149150 expect ( file . isRawFn ( 'stack.raw' ) ) . toMatchInlineSnapshot ( 'true' )
150151
151- expect ( file . isRawFn ( 'cva.raw' ) ) . toMatchInlineSnapshot ( 'false' )
152+ expect ( file . isRawFn ( 'cva.raw' ) ) . toMatchInlineSnapshot ( 'true' ) // cva is imported, should be true
153+ } )
154+
155+ test ( 'is raw fn with sva aliases' , ( ) => {
156+ const ctx = createContext ( )
157+
158+ const file = ctx . imports . file ( [
159+ { mod : 'styled-system/css' , name : 'css' , alias : 'styledCss' } ,
160+ { mod : 'styled-system/css' , name : 'cva' , alias : 'componentVariant' } ,
161+ { mod : 'styled-system/css' , name : 'sva' , alias : 'slotVariant' } ,
162+ ] )
163+
164+ // Test aliased css functions
165+ expect ( file . isRawFn ( 'styledCss' ) ) . toMatchInlineSnapshot ( 'true' )
166+ expect ( file . isRawFn ( 'styledCss.raw' ) ) . toMatchInlineSnapshot ( 'true' )
167+
168+ // Test aliased cva functions
169+ expect ( file . isRawFn ( 'componentVariant' ) ) . toMatchInlineSnapshot ( 'true' )
170+ expect ( file . isRawFn ( 'componentVariant.raw' ) ) . toMatchInlineSnapshot ( 'true' )
171+
172+ // Test aliased sva functions
173+ expect ( file . isRawFn ( 'slotVariant' ) ) . toMatchInlineSnapshot ( 'true' )
174+ expect ( file . isRawFn ( 'slotVariant.raw' ) ) . toMatchInlineSnapshot ( 'true' )
175+
176+ // Test non-aliased should still work
177+ expect ( file . isRawFn ( 'css' ) ) . toMatchInlineSnapshot ( 'true' )
178+ expect ( file . isRawFn ( 'css.raw' ) ) . toMatchInlineSnapshot ( 'true' )
179+
180+ // Test non-existent aliases
181+ expect ( file . isRawFn ( 'randomAlias' ) ) . toMatchInlineSnapshot ( 'false' )
182+ expect ( file . isRawFn ( 'randomAlias.raw' ) ) . toMatchInlineSnapshot ( 'false' )
152183 } )
153184
154185 test ( 'namespace' , ( ) => {
0 commit comments