Skip to content

Commit b16dfe9

Browse files
author
Cem Yılmaz
committed
apply modifier only for color types since other types might have units like 1/2 which also considers modifier
1 parent 4bf62d5 commit b16dfe9

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

test/classname.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const table = [
1818
[{property: "marginRight", value: "1rem"}, "mr-4"],
1919
[{property: "marginRight", value: "-1rem"}, "-mr-4"],
2020
[{property: "marginRight", value: "1rem", negative: true}, "-mr-4"],
21+
[{property: "width", value: "50%"}, "w-1/2"],
2122
]
2223

2324
//@ts-ignore

test/parse.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,27 @@ it("should parse a functional class with variants", () => {
127127
"arbitrary": false
128128
}
129129
)
130+
})
131+
it("w-1/2", () => {
132+
expect(parse("w-1/2")).toEqual(
133+
{
134+
"root": "w",
135+
"kind": "functional",
136+
"property": "width",
137+
"value": "50%",
138+
"valueDef": {
139+
"value": "50%",
140+
"class": [
141+
"width"
142+
],
143+
"raw": "1/2",
144+
"kind": "length"
145+
},
146+
"variants": [],
147+
"modifier": null,
148+
"important": false,
149+
"negative": false,
150+
"arbitrary": false
151+
}
152+
)
130153
})

0 commit comments

Comments
 (0)