Skip to content

Commit 79589b2

Browse files
committed
Fix negative values
1 parent 5dce7fe commit 79589b2

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/grammar.ne

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@
5050
%}
5151

5252
number
53-
-> ([0-9]:? "." [0-9]:+) {% d => Number(text(d)) %}
54-
| ([1-9] [0-9]:*) {% d => Number(text(d)) %}
55-
| "0" {% d => Number(text(d)) %}
53+
-> "-":? ([0-9]:? "." [0-9]:+ | [1-9] [0-9]:* | "0") {% d => Number(text(d)) %}
5654

5755
angle -> number ("deg" | "rad") {% text %}
5856

src/index.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ it('allows decimal values in transformed values', () => runTest([
2626
borderBottomLeftRadius: 1.5,
2727
}));
2828

29+
it('allows negative values in transformed values', () => runTest([
30+
['border-radius', '-1.5'],
31+
], {
32+
borderTopLeftRadius: -1.5,
33+
borderTopRightRadius: -1.5,
34+
borderBottomRightRadius: -1.5,
35+
borderBottomLeftRadius: -1.5,
36+
}));
37+
2938
it('transforms strings', () => runTest([
3039
['color', 'red'],
3140
], { color: 'red' }));

0 commit comments

Comments
 (0)