Skip to content

Commit

Permalink
Fix incorrectly throwing error on the gradient content values (#2264)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasweng authored Feb 22, 2021
1 parent 06b3147 commit 418daad
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fair-buses-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@emotion/serialize': patch
---

Fix incorrectly throwing error on the gradient content values
5 changes: 5 additions & 0 deletions packages/css/test/__snapshots__/warnings.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ exports[`does not warn when valid values are passed for the content property 1`]
content: "some thing";
content: 'another thing';
content: url("http://www.example.com/test.png");
content: linear-gradient(hotpink, #8be9fd);
content: radial-gradient(hotpink, #8be9fd);
content: repeating-linear-gradient(hotpink, #8be9fd);
content: repeating-radial-gradient(hotpink, #8be9fd);
content: conic-gradient(hotpink, #8be9fd);
content: counter(chapter_counter);
content: counters(section_counter, ".");
content: attr(value string);
Expand Down
5 changes: 5 additions & 0 deletions packages/css/test/warnings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ const validValues = [
'"some thing"',
"'another thing'",
'url("http://www.example.com/test.png")',
'linear-gradient(hotpink, #8be9fd)',
'radial-gradient(hotpink, #8be9fd)',
'repeating-linear-gradient(hotpink, #8be9fd)',
'repeating-radial-gradient(hotpink, #8be9fd)',
'conic-gradient(hotpink, #8be9fd)',
'counter(chapter_counter)',
'counters(section_counter, ".")',
'attr(value string)'
Expand Down
5 changes: 5 additions & 0 deletions packages/react/__tests__/__snapshots__/warnings.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ exports[`does not warn when valid values are passed for the content property 1`]
content: "some thing";
content: 'another thing';
content: url("http://www.example.com/test.png");
content: linear-gradient(hotpink, #8be9fd);
content: radial-gradient(hotpink, #8be9fd);
content: repeating-linear-gradient(hotpink, #8be9fd);
content: repeating-radial-gradient(hotpink, #8be9fd);
content: conic-gradient(hotpink, #8be9fd);
content: counter(chapter_counter);
content: counters(section_counter, ".");
content: attr(value string);
Expand Down
5 changes: 5 additions & 0 deletions packages/react/__tests__/warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ const validValues = [
'"some thing"',
"'another thing'",
'url("http://www.example.com/test.png")',
'linear-gradient(hotpink, #8be9fd)',
'radial-gradient(hotpink, #8be9fd)',
'repeating-linear-gradient(hotpink, #8be9fd)',
'repeating-radial-gradient(hotpink, #8be9fd)',
'conic-gradient(hotpink, #8be9fd)',
'counter(chapter_counter)',
'counters(section_counter, ".")',
'attr(value string)'
Expand Down
2 changes: 1 addition & 1 deletion packages/serialize/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ let processStyleValue = (
}

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

0 comments on commit 418daad

Please sign in to comment.