11import  {  expect ,  test  }  from  'vitest' 
22import  {  __unstable__loadDesignSystem  }  from  '.' 
3- import  {  buildDesignSystem  }  from  './design-system' 
43import  plugin  from  './plugin' 
5- import  {  Theme ,   ThemeOptions  }  from  './theme' 
4+ import  {  ThemeOptions  }  from  './theme' 
65
76const  css  =  String . raw 
87
98function  loadDesignSystem ( )  { 
10-   let  theme  =  new  Theme ( ) 
11-   theme . add ( '--spacing' ,  '0.25rem' ) 
12-   theme . add ( '--colors-red-500' ,  'red' ) 
13-   theme . add ( '--colors-blue-500' ,  'blue' ) 
14-   theme . add ( '--breakpoint-sm' ,  '640px' ) 
15-   theme . add ( '--aspect-video' ,  '16 / 9' ) 
16-   theme . add ( '--font-sans' ,  'sans-serif' ) 
17-   theme . add ( '--font-weight-superbold' ,  '900' ) 
18-   theme . add ( '--text-xs' ,  '0.75rem' ) 
19-   theme . add ( '--text-xs--line-height' ,  '1rem' ) 
20-   theme . add ( '--perspective-dramatic' ,  '100px' ) 
21-   theme . add ( '--perspective-normal' ,  '500px' ) 
22-   theme . add ( '--opacity-background' ,  '0.3' ) 
23-   theme . add ( '--drop-shadow-sm' ,  '0 1px 1px rgb(0 0 0 / 0.05)' ) 
24-   theme . add ( '--inset-shadow-sm' ,  'inset 0 1px 1px rgb(0 0 0 / 0.05)' ) 
25-   theme . add ( '--font-weight-bold' ,  '700' ) 
26-   theme . add ( '--container-md' ,  '768px' ) 
27-   theme . add ( '--container-lg' ,  '1024px' ) 
28-   return  buildDesignSystem ( theme ) 
9+   return  __unstable__loadDesignSystem ( ` 
10+     @theme { 
11+       --spacing: 0.25rem; 
12+       --colors-red-500: red; 
13+       --colors-blue-500: blue; 
14+       --breakpoint-sm: 640px; 
15+       --aspect-video: 16 / 9; 
16+       --font-sans: sans-serif; 
17+       --font-weight-superbold: 900; 
18+       --text-xs: 0.75rem; 
19+       --text-xs--line-height: 1rem; 
20+       --perspective-dramatic: 100px; 
21+       --perspective-normal: 500px; 
22+       --opacity-background: 0.3; 
23+       --drop-shadow-sm: 0 1px 1px rgb(0 0 0 / 0.05); 
24+       --inset-shadow-sm: inset 0 1px 1px rgb(0 0 0 / 0.05); 
25+       --font-weight-bold: 700; 
26+       --container-md: 768px; 
27+       --container-lg: 1024px; 
28+     } 
29+   ` ) 
2930} 
3031
31- test ( 'getClassList' ,  ( )  =>  { 
32-   let  design  =  loadDesignSystem ( ) 
32+ test ( 'getClassList' ,  async   ( )  =>  { 
33+   let  design  =  await   loadDesignSystem ( ) 
3334  let  classList  =  design . getClassList ( ) 
3435  let  classNames  =  classList . flatMap ( ( [ name ,  meta ] )  =>  [ 
3536    name , 
@@ -39,8 +40,8 @@ test('getClassList', () => {
3940  expect ( classNames ) . toMatchSnapshot ( ) 
4041} ) 
4142
42- test ( 'Spacing utilities do not suggest bare values when not using the multiplier-based spacing scale' ,  ( )  =>  { 
43-   let  design  =  loadDesignSystem ( ) 
43+ test ( 'Spacing utilities do not suggest bare values when not using the multiplier-based spacing scale' ,  async   ( )  =>  { 
44+   let  design  =  await   loadDesignSystem ( ) 
4445
4546  // Remove spacing scale 
4647  design . theme . clearNamespace ( '--spacing' ,  ThemeOptions . NONE ) 
@@ -58,22 +59,22 @@ test('Spacing utilities do not suggest bare values when not using the multiplier
5859  expect ( classNames ) . not . toContain ( 'p-4' ) 
5960} ) 
6061
61- test ( 'Theme values with underscores are converted back to decimal points' ,  ( )  =>  { 
62-   let  design  =  loadDesignSystem ( ) 
62+ test ( 'Theme values with underscores are converted back to decimal points' ,  async   ( )  =>  { 
63+   let  design  =  await   loadDesignSystem ( ) 
6364  let  classes  =  design . getClassList ( ) 
6465
6566  expect ( classes ) . toContainEqual ( [ 'inset-0.5' ,  {  modifiers : [ ]  } ] ) 
6667} ) 
6768
68- test ( 'getVariants' ,  ( )  =>  { 
69-   let  design  =  loadDesignSystem ( ) 
69+ test ( 'getVariants' ,  async   ( )  =>  { 
70+   let  design  =  await   loadDesignSystem ( ) 
7071  let  variants  =  design . getVariants ( ) 
7172
7273  expect ( variants ) . toMatchSnapshot ( ) 
7374} ) 
7475
75- test ( 'getVariants compound' ,  ( )  =>  { 
76-   let  design  =  loadDesignSystem ( ) 
76+ test ( 'getVariants compound' ,  async   ( )  =>  { 
77+   let  design  =  await   loadDesignSystem ( ) 
7778  let  variants  =  design . getVariants ( ) 
7879  let  group  =  variants . find ( ( v )  =>  v . name  ===  'group' ) ! 
7980
@@ -130,16 +131,16 @@ test('variant selectors are in the correct order', async () => {
130131  ` ) 
131132} ) 
132133
133- test ( 'The variant `has-force` does not crash' ,  ( )  =>  { 
134-   let  design  =  loadDesignSystem ( ) 
134+ test ( 'The variant `has-force` does not crash' ,  async   ( )  =>  { 
135+   let  design  =  await   loadDesignSystem ( ) 
135136  let  variants  =  design . getVariants ( ) 
136137  let  has  =  variants . find ( ( v )  =>  v . name  ===  'has' ) ! 
137138
138139  expect ( has . selectors ( {  value : 'force'  } ) ) . toMatchInlineSnapshot ( `[]` ) 
139140} ) 
140141
141- test ( 'Can produce CSS per candidate using `candidatesToCss`' ,  ( )  =>  { 
142-   let  design  =  loadDesignSystem ( ) 
142+ test ( 'Can produce CSS per candidate using `candidatesToCss`' ,  async   ( )  =>  { 
143+   let  design  =  await   loadDesignSystem ( ) 
143144  design . invalidCandidates  =  new  Set ( [ 'bg-[#fff]' ] ) 
144145
145146  expect ( design . candidatesToCss ( [ 'underline' ,  'i-dont-exist' ,  'bg-[#fff]' ,  'bg-[#000]' ,  'text-xs' ] ) ) 
0 commit comments