Skip to content

Commit 983f85e

Browse files
committed
Fix border-color only accepting named colors
1 parent b7763a1 commit 983f85e

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

src/__tests__/borderColor.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,30 @@ it('transforms border color with multiple values', () => {
88
borderLeftColor: 'blue',
99
})
1010
})
11+
12+
it('transforms border color with hex color', () => {
13+
expect(transformCss([['border-color', '#f00']])).toEqual({
14+
borderBottomColor: '#f00',
15+
borderLeftColor: '#f00',
16+
borderRightColor: '#f00',
17+
borderTopColor: '#f00',
18+
})
19+
})
20+
21+
it('transforms border color with rgb color', () => {
22+
expect(transformCss([['border-color', 'rgb(255, 0, 0)']])).toEqual({
23+
borderBottomColor: 'rgb(255, 0, 0)',
24+
borderLeftColor: 'rgb(255, 0, 0)',
25+
borderRightColor: 'rgb(255, 0, 0)',
26+
borderTopColor: 'rgb(255, 0, 0)',
27+
})
28+
})
29+
30+
it('transforms border color with rgba color', () => {
31+
expect(transformCss([['border-color', 'rgba(255, 0, 0, 0.1)']])).toEqual({
32+
borderBottomColor: 'rgba(255, 0, 0, 0.1)',
33+
borderLeftColor: 'rgba(255, 0, 0, 0.1)',
34+
borderRightColor: 'rgba(255, 0, 0, 0.1)',
35+
borderTopColor: 'rgba(255, 0, 0, 0.1)',
36+
})
37+
})

src/transforms/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import flex from './flex'
55
import flexFlow from './flexFlow'
66
import font from './font'
77
import fontFamily from './fontFamily'
8-
import textShadow from './textShadow'
98
import textDecoration from './textDecoration'
109
import textDecorationLine from './textDecorationLine'
10+
import textShadow from './textShadow'
1111
import transform from './transform'
1212
import { directionFactory, parseShadowOffset } from './util'
1313

@@ -25,7 +25,7 @@ const background = tokenStream => ({
2525
backgroundColor: tokenStream.expect(COLOR),
2626
})
2727
const borderColor = directionFactory({
28-
types: [WORD],
28+
types: [WORD, COLOR],
2929
prefix: 'border',
3030
suffix: 'Color',
3131
})

0 commit comments

Comments
 (0)