Skip to content

Commit 9c5945f

Browse files
authored
Merge pull request #9 from bkrmendy/fix/inset-x-y
Fix parsing inset classes
2 parents f1b7c6e + 6c0a90a commit 9c5945f

File tree

2 files changed

+63
-8
lines changed

2 files changed

+63
-8
lines changed

src/plugins.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,10 @@ export const functionalPlugins = new Map<string, FunctionalPlugin[]>([
245245
["inset", [
246246
{scaleKey: "inset", ns: 'inset', class: ['inset'], type: 'length', supportNegative: true},
247247
]],
248-
["inset-x", [
249-
{scaleKey: "inset", ns: 'insetX', class: ['inset-x'], type: 'length', supportNegative: true},
250-
]],
251-
["inset-x", [
252-
{scaleKey: "inset", ns: 'insetY', class: ['inset'], type: 'length', supportNegative: true},
253-
]],
254248
["inset-x", [
255249
{scaleKey: "inset", ns: 'insetX', class: ['left', 'right'], type: 'length', supportNegative: true},
256250
]],
257-
["inset-x", [
251+
["inset-y", [
258252
{scaleKey: "inset", ns: 'insetY', class: ['top', 'bottom'], type: 'length', supportNegative: true},
259253
]],
260254
["top", [

test/parse.test.ts

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,65 @@ it('should parse flex-basis classes', () => {
279279
},
280280
"variants": [],
281281
})
282-
})
282+
})
283+
it('should parse inset classes', () => {
284+
expect(parse('inset-2')).toEqual({
285+
"arbitrary": false,
286+
"important": false,
287+
"kind": "functional",
288+
"modifier": null,
289+
"negative": false,
290+
"property": "inset",
291+
"root": "inset",
292+
"value": "0.5rem",
293+
"valueDef": {
294+
"class": [
295+
"inset",
296+
],
297+
"kind": "length",
298+
"raw": "2",
299+
"value": "0.5rem",
300+
},
301+
"variants": [],
302+
})
303+
expect(parse('inset-y-2')).toEqual({
304+
"arbitrary": false,
305+
"important": false,
306+
"kind": "functional",
307+
"modifier": null,
308+
"negative": false,
309+
"property": "insetY",
310+
"root": "inset-y",
311+
"value": "0.5rem",
312+
"valueDef": {
313+
"class": [
314+
"top",
315+
"bottom",
316+
],
317+
"kind": "length",
318+
"raw": "2",
319+
"value": "0.5rem",
320+
},
321+
"variants": [],
322+
})
323+
expect(parse('inset-x-2')).toEqual({
324+
"arbitrary": false,
325+
"important": false,
326+
"kind": "functional",
327+
"modifier": null,
328+
"negative": false,
329+
"property": "insetX",
330+
"root": "inset-x",
331+
"value": "0.5rem",
332+
"valueDef": {
333+
"class": [
334+
"left",
335+
"right",
336+
],
337+
"kind": "length",
338+
"raw": "2",
339+
"value": "0.5rem",
340+
},
341+
"variants": [],
342+
})
343+
})

0 commit comments

Comments
 (0)