diff --git a/src/index.js b/src/index.js index 9d7ead54..33e314da 100644 --- a/src/index.js +++ b/src/index.js @@ -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'; diff --git a/test/index.spec.js b/test/index.spec.js index 41bf8e0b..a6d4ac45 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -1822,14 +1822,18 @@ describe('unexpected-dom', () => { it('should succeed when the subject has an extra inline style', () => expect( - parseHtml('
hey
'), + parseHtml( + '
hey
' + ), 'to satisfy', - parseHtml('
hey
') + parseHtml( + '
hey
' + ) )); it('should not fail for invalid style attributes on the LHS', () => expect( - parseHtml('
hey
'), + parseHtml('
hey
'), 'to satisfy', parseHtml('
hey
') ));