Skip to content

Commit 418daad

Browse files
authored
Fix incorrectly throwing error on the gradient content values (#2264)
1 parent 06b3147 commit 418daad

File tree

6 files changed

+26
-1
lines changed

6 files changed

+26
-1
lines changed

.changeset/fair-buses-drop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@emotion/serialize': patch
3+
---
4+
5+
Fix incorrectly throwing error on the gradient content values

packages/css/test/__snapshots__/warnings.test.js.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ exports[`does not warn when valid values are passed for the content property 1`]
1414
content: "some thing";
1515
content: 'another thing';
1616
content: url("http://www.example.com/test.png");
17+
content: linear-gradient(hotpink, #8be9fd);
18+
content: radial-gradient(hotpink, #8be9fd);
19+
content: repeating-linear-gradient(hotpink, #8be9fd);
20+
content: repeating-radial-gradient(hotpink, #8be9fd);
21+
content: conic-gradient(hotpink, #8be9fd);
1722
content: counter(chapter_counter);
1823
content: counters(section_counter, ".");
1924
content: attr(value string);

packages/css/test/warnings.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const validValues = [
2121
'"some thing"',
2222
"'another thing'",
2323
'url("http://www.example.com/test.png")',
24+
'linear-gradient(hotpink, #8be9fd)',
25+
'radial-gradient(hotpink, #8be9fd)',
26+
'repeating-linear-gradient(hotpink, #8be9fd)',
27+
'repeating-radial-gradient(hotpink, #8be9fd)',
28+
'conic-gradient(hotpink, #8be9fd)',
2429
'counter(chapter_counter)',
2530
'counters(section_counter, ".")',
2631
'attr(value string)'

packages/react/__tests__/__snapshots__/warnings.js.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ exports[`does not warn when valid values are passed for the content property 1`]
1414
content: "some thing";
1515
content: 'another thing';
1616
content: url("http://www.example.com/test.png");
17+
content: linear-gradient(hotpink, #8be9fd);
18+
content: radial-gradient(hotpink, #8be9fd);
19+
content: repeating-linear-gradient(hotpink, #8be9fd);
20+
content: repeating-radial-gradient(hotpink, #8be9fd);
21+
content: conic-gradient(hotpink, #8be9fd);
1722
content: counter(chapter_counter);
1823
content: counters(section_counter, ".");
1924
content: attr(value string);

packages/react/__tests__/warnings.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const validValues = [
2121
'"some thing"',
2222
"'another thing'",
2323
'url("http://www.example.com/test.png")',
24+
'linear-gradient(hotpink, #8be9fd)',
25+
'radial-gradient(hotpink, #8be9fd)',
26+
'repeating-linear-gradient(hotpink, #8be9fd)',
27+
'repeating-radial-gradient(hotpink, #8be9fd)',
28+
'conic-gradient(hotpink, #8be9fd)',
2429
'counter(chapter_counter)',
2530
'counters(section_counter, ".")',
2631
'attr(value string)'

packages/serialize/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ let processStyleValue = (
6161
}
6262

6363
if (process.env.NODE_ENV !== 'production') {
64-
let contentValuePattern = /(attr|calc|counters?|url)\(/
64+
let contentValuePattern = /(attr|calc|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(/
6565
let contentValues = [
6666
'normal',
6767
'none',

0 commit comments

Comments
 (0)