Skip to content

Commit

Permalink
Merge dbd61e8 into e1419c6
Browse files Browse the repository at this point in the history
  • Loading branch information
sunesimonsen committed Nov 7, 2018
2 parents e1419c6 + dbd61e8 commit 00257bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -85,7 +85,7 @@ function isEnumeratedAttribute(attrName) {
function validateStyles(expect, str) {
const invalidStyles = str
.split(';')
.filter(part => !/^\s*\w+\s*:\s*\w+\s*$|^$/.test(part));
.filter(part => !/^\s*(\w|-)+\s*:\s*(\w|-)+\s*$|^$/.test(part));

if (invalidStyles.length > 0) {
expect.errorMode = 'nested';
Expand Down
10 changes: 7 additions & 3 deletions test/index.spec.js
Expand Up @@ -1822,14 +1822,18 @@ describe('unexpected-dom', () => {

it('should succeed when the subject has an extra inline style', () =>
expect(
parseHtml('<div style="color: tan; width: 120px;">hey</div>'),
parseHtml(
'<div style="color: tan; width: 120px; z-index: 700; background-repeat: no-repeat">hey</div>'
),
'to satisfy',
parseHtml('<div style="color: tan;">hey</div>')
parseHtml(
'<div style="color: tan; z-index: 700;background-repeat: no-repeat">hey</div>'
)
));

it('should not fail for invalid style attributes on the LHS', () =>
expect(
parseHtml('<div style="color; width: 120px;">hey</div>'),
parseHtml('<div style="color; width: 120px; z-index: 700">hey</div>'),
'to satisfy',
parseHtml('<div style="width: 120px;">hey</div>')
));
Expand Down

0 comments on commit 00257bc

Please sign in to comment.