Skip to content

Commit 7829984

Browse files
committed
make sure that there is only one color for box-shadow
1 parent fad1039 commit 7829984

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/index.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,11 @@ it('transforms box-shadow with hsla color', () => runTest([
530530
shadowOpacity: 1,
531531
}));
532532

533+
it('transforms box-shadow and throws if multiple colors are used', () => {
534+
expect(() => transformCss([['box-shadow', '0 0 0 red yellow green blue']]))
535+
.toThrow('Failed to parse declaration "boxShadow: 0 0 0 red yellow green blue"');
536+
});
537+
533538
it('transforms box-shadow enforces offset to be present', () => {
534539
expect(() => transformCss([['box-shadow', 'red']]))
535540
.toThrow('Failed to parse declaration "boxShadow: red"');

src/transforms/boxShadow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = (tokenStream) => {
2828
tokenStream.expect(SPACE);
2929
blurRadius = tokenStream.expect(LENGTH);
3030
}
31-
} else if (tokenStream.matches(COLOR)) {
31+
} else if (color === undefined && tokenStream.matches(COLOR)) {
3232
color = tokenStream.lastValue;
3333
} else {
3434
tokenStream.throw();

0 commit comments

Comments
 (0)