Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrectly throwing error on valid content values in dev #2279

Merged
merged 2 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sweet-donkeys-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@emotion/serialize': patch
---

Fix incorrectly throwing error on valid content values
Andarist marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion packages/css/test/__snapshots__/warnings.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ exports[`does not warn when valid values are passed for the content property 1`]
.emotion-0 {
content: normal;
content: none;
content: counter;
content: open-quote;
content: close-quote;
content: no-open-quote;
Expand All @@ -22,6 +21,7 @@ exports[`does not warn when valid values are passed for the content property 1`]
content: counter(chapter_counter);
content: counters(section_counter, ".");
content: attr(value string);
content: open-quote counter(chapter_counter);
}

<div
Expand Down
4 changes: 2 additions & 2 deletions packages/css/test/warnings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ console.error = jest.fn()
const validValues = [
'normal',
'none',
'counter',
'open-quote',
'close-quote',
'no-open-quote',
Expand All @@ -28,7 +27,8 @@ const validValues = [
'conic-gradient(hotpink, #8be9fd)',
'counter(chapter_counter)',
'counters(section_counter, ".")',
'attr(value string)'
'attr(value string)',
'open-quote counter(chapter_counter)'
]

afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/__tests__/__snapshots__/warnings.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ exports[`does not warn when valid values are passed for the content property 1`]
.emotion-0 {
content: normal;
content: none;
content: counter;
content: open-quote;
content: close-quote;
content: no-open-quote;
Expand All @@ -22,6 +21,7 @@ exports[`does not warn when valid values are passed for the content property 1`]
content: counter(chapter_counter);
content: counters(section_counter, ".");
content: attr(value string);
content: open-quote counter(chapter_counter);
}

<div
Expand Down
4 changes: 2 additions & 2 deletions packages/react/__tests__/warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ console.error = jest.fn()
const validValues = [
'normal',
'none',
'counter',
'open-quote',
'close-quote',
'no-open-quote',
Expand All @@ -28,7 +27,8 @@ const validValues = [
'conic-gradient(hotpink, #8be9fd)',
'counter(chapter_counter)',
'counters(section_counter, ".")',
'attr(value string)'
'attr(value string)',
'open-quote counter(chapter_counter)'
]

beforeEach(() => {
Expand Down
15 changes: 2 additions & 13 deletions packages/serialize/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,8 @@ let processStyleValue = (
}

if (process.env.NODE_ENV !== 'production') {
let contentValuePattern = /(attr|calc|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(/
let contentValues = [
'normal',
'none',
'counter',
'open-quote',
'close-quote',
'no-open-quote',
'no-close-quote',
'initial',
'inherit',
'unset'
]
let contentValuePattern = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/
let contentValues = ['normal', 'none', 'initial', 'inherit', 'unset']

let oldProcessStyleValue = processStyleValue

Expand Down