11import { describe , it , expect } from 'vitest' ;
2- import { styles , createTokens } from './' ;
2+ import { styles , defineTokens } from './' ;
33
4- describe ( 'createVariantStyle ' , ( ) => {
4+ describe ( 'styles ' , ( ) => {
55 it ( 'should return base styles when no variants are provided' , ( ) => {
66 const baseStyles = styles ( {
77 base : { display : 'flex' } ,
@@ -121,14 +121,14 @@ describe('createVariantStyle', () => {
121121 } ) ;
122122} ) ;
123123
124- describe ( 'createTokens ' , ( ) => {
124+ describe ( 'defineTokens ' , ( ) => {
125125 it ( 'should create styles function' , ( ) => {
126- const { styles } = createTokens ( {
126+ const { styles } = defineTokens ( {
127127 colors : {
128128 primary : '#000000' ,
129129 secondary : '#ffffff' ,
130130 } ,
131- spacing : {
131+ space : {
132132 sm : 8 ,
133133 md : 16 ,
134134 } ,
@@ -138,19 +138,19 @@ describe('createTokens', () => {
138138 } ) ;
139139
140140 it ( 'should resolve token references in styles' , ( ) => {
141- const { styles } = createTokens ( {
141+ const { styles } = defineTokens ( {
142142 colors : {
143143 primary : '#000000' ,
144144 } ,
145- spacing : {
145+ space : {
146146 sm : 8 ,
147147 } ,
148148 } ) ;
149149
150150 const result = styles ( {
151151 base : {
152152 backgroundColor : '$colors.primary' ,
153- padding : '$spacing .sm' ,
153+ padding : '$space .sm' ,
154154 } ,
155155 variants : { } ,
156156 } ) ;
@@ -162,13 +162,10 @@ describe('createTokens', () => {
162162 } ) ;
163163
164164 it ( 'should resolve token references in variants' , ( ) => {
165- const { styles } = createTokens ( {
165+ const { styles } = defineTokens ( {
166166 colors : {
167167 primary : '#000000' ,
168168 } ,
169- borderStyles : {
170- default : 'solid' ,
171- } ,
172169 } ) ;
173170
174171 const result = styles ( {
@@ -177,24 +174,22 @@ describe('createTokens', () => {
177174 type : {
178175 primary : {
179176 backgroundColor : '$colors.primary' ,
180- borderStyle : '$borderStyles.default' ,
181177 } ,
182178 } ,
183179 } ,
184180 } ) ;
185181
186182 expect ( result ( { type : 'primary' } ) ) . toEqual ( {
187183 backgroundColor : '#000000' ,
188- borderStyle : 'solid' ,
189184 } ) ;
190185 } ) ;
191186
192187 it ( 'should handle compound variants' , ( ) => {
193- const { styles } = createTokens ( {
188+ const { styles } = defineTokens ( {
194189 colors : {
195190 primary : '#000000' ,
196191 } ,
197- spacing : {
192+ space : {
198193 sm : 8 ,
199194 } ,
200195 } ) ;
@@ -209,7 +204,7 @@ describe('createTokens', () => {
209204 variants : { size : 'small' as const , type : 'primary' as const } ,
210205 style : {
211206 backgroundColor : '$colors.primary' ,
212- padding : '$spacing .sm' ,
207+ padding : '$space .sm' ,
213208 } ,
214209 } ] ,
215210 } ) ;
@@ -221,7 +216,7 @@ describe('createTokens', () => {
221216 } ) ;
222217
223218 it ( 'should ignore missing token references' , ( ) => {
224- const { styles } = createTokens ( {
219+ const { styles } = defineTokens ( {
225220 colors : {
226221 primary : '#000000' ,
227222 } ,
@@ -241,25 +236,21 @@ describe('createTokens', () => {
241236 } ) ;
242237
243238 it ( 'should support all allowed token categories' , ( ) => {
244- const { styles } = createTokens ( {
239+ const { styles } = defineTokens ( {
245240 colors : { primary : '#000000' } ,
246- spacing : { sm : 8 } ,
241+ space : { sm : 8 } ,
247242 fontSizes : { base : 16 } ,
248243 fonts : { body : 'Arial' } ,
249244 lineHeight : { normal : 1.5 } ,
250- borderWidth : { thin : 1 } ,
251- borderStyles : { default : 'solid' } ,
252245 } ) ;
253246
254247 const result = styles ( {
255248 base : {
256249 color : '$colors.primary' ,
257- padding : '$spacing .sm' ,
250+ padding : '$space .sm' ,
258251 fontSize : '$fontSizes.base' ,
259252 fontFamily : '$fonts.body' ,
260253 lineHeight : '$lineHeight.normal' ,
261- borderWidth : '$borderWidth.thin' ,
262- borderStyle : '$borderStyles.default' ,
263254 } ,
264255 variants : { } ,
265256 } ) ;
@@ -270,8 +261,6 @@ describe('createTokens', () => {
270261 fontSize : 16 ,
271262 fontFamily : 'Arial' ,
272263 lineHeight : 1.5 ,
273- borderWidth : 1 ,
274- borderStyle : 'solid' ,
275264 } ) ;
276265 } ) ;
277266} ) ;
0 commit comments