11import { StyleProvider } from '@ant-design/cssinjs' ;
2- import { extractStyle } from '../src/index' ;
32import { ConfigProvider } from 'antd' ;
3+ import { extractStyle } from '../src/index' ;
44
55const testGreenColor = '#008000' ;
66describe ( 'Static-Style-Extract' , ( ) => {
77 it ( 'should extract static styles' , ( ) => {
88 const cssText = extractStyle ( ) ;
99 expect ( cssText ) . not . toContain ( testGreenColor ) ;
10- expect ( cssText ) . toMatchSnapshot ( ) ;
10+ expect ( cssText ) . toContain ( '.ant-btn' ) ;
1111 } ) ;
12+
1213 it ( 'should extract static styles with customTheme' , ( ) => {
1314 const cssText = extractStyle ( ( node ) => (
1415 < ConfigProvider
@@ -22,27 +23,24 @@ describe('Static-Style-Extract', () => {
2223 </ ConfigProvider >
2324 ) ) ;
2425 expect ( cssText ) . toContain ( testGreenColor ) ;
25- expect ( cssText ) . toMatchSnapshot ( ) ;
2626 } ) ;
27+
2728 it ( 'with custom hashPriority' , ( ) => {
28- const cssText = extractStyle (
29- ( node ) => (
30- < StyleProvider hashPriority = 'high' >
31- < ConfigProvider
32- theme = { {
33- token : {
34- colorPrimary : testGreenColor ,
35- } ,
36- } }
37- >
38- { node }
39- </ ConfigProvider >
40- </ StyleProvider >
41- )
42- ) ;
29+ const cssText = extractStyle ( ( node ) => (
30+ < StyleProvider hashPriority = "high" >
31+ < ConfigProvider
32+ theme = { {
33+ token : {
34+ colorPrimary : testGreenColor ,
35+ } ,
36+ } }
37+ >
38+ { node }
39+ </ ConfigProvider >
40+ </ StyleProvider >
41+ ) ) ;
4342 expect ( cssText ) . toContain ( testGreenColor ) ;
4443 expect ( cssText ) . not . toContain ( ':where' ) ;
45- expect ( cssText ) . toMatchSnapshot ( ) ;
4644
4745 const cssText2 = extractStyle ( ( node ) => (
4846 < ConfigProvider
0 commit comments