Skip to content

Commit 9768949

Browse files
authored
fix(shared): fix parsing of multi-line inline style (#6777)
1 parent 99b6697 commit 9768949

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

Diff for: packages/shared/__tests__/normalizeProp.spec.ts

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { normalizeClass } from '../src'
1+
import { normalizeClass, parseStringStyle } from '../src'
22

33
describe('normalizeClass', () => {
44
test('handles string correctly', () => {
@@ -16,4 +16,31 @@ describe('normalizeClass', () => {
1616
'foo baz'
1717
)
1818
})
19+
20+
// #6777
21+
test('parse multi-line inline style', () => {
22+
expect(
23+
parseStringStyle(`border: 1px solid transparent;
24+
background: linear-gradient(white, white) padding-box,
25+
repeating-linear-gradient(
26+
-45deg,
27+
#ccc 0,
28+
#ccc 0.5em,
29+
white 0,
30+
white 0.75em
31+
);`)
32+
).toMatchInlineSnapshot(`
33+
Object {
34+
"background": "linear-gradient(white, white) padding-box,
35+
repeating-linear-gradient(
36+
-45deg,
37+
#ccc 0,
38+
#ccc 0.5em,
39+
white 0,
40+
white 0.75em
41+
)",
42+
"border": "1px solid transparent",
43+
}
44+
`)
45+
})
1946
})

Diff for: packages/shared/src/normalizeProp.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function normalizeStyle(
2727
}
2828

2929
const listDelimiterRE = /;(?![^(]*\))/g
30-
const propertyDelimiterRE = /:(.+)/
30+
const propertyDelimiterRE = /:([^]+)/
3131

3232
export function parseStringStyle(cssText: string): NormalizedStyle {
3333
const ret: NormalizedStyle = {}

0 commit comments

Comments
 (0)