diff --git a/src/index.js b/src/index.js index 1e1eefa..cb7a93a 100644 --- a/src/index.js +++ b/src/index.js @@ -86,10 +86,7 @@ function isEnumeratedAttribute(attrName) { function validateStyles(expect, str) { const invalidStyles = str .split(';') - .filter( - (part) => - !/^\s*(\w|-)+\s*:\s*(#(?:[0-9a-fA-F]{3}){1,2}|[^#]+)\s*$|^$/.test(part) - ); + .filter((part) => !/^\s*(\w|-)+\s*:\s*|^\s*$/.test(part)); if (invalidStyles.length > 0) { expect.errorMode = 'nested'; diff --git a/test/assertions/to-satisfy.spec.js b/test/assertions/to-satisfy.spec.js index 4d6ffc5..68bc300 100644 --- a/test/assertions/to-satisfy.spec.js +++ b/test/assertions/to-satisfy.spec.js @@ -804,27 +804,13 @@ describe('"to satisfy" assertion', () => { ); }); - it.skipIf(isIe, 'should fail when the RHS has invalid styles', () => + it('should not fail for a shorthand style attribute on the RHS', () => { expect( - () => - expect( - parseHtml('
hey
'), - 'to satisfy', - parseHtml('
hey
') - ), - 'to throw an error satisfying to equal snapshot', - expect.unindent` - expected
hey
- to satisfy
hey
- -
hey
- // to satisfy { name: 'div', attributes: { style: 'border-left-color: #FFFF;' }, children: [ hey ] } - // Expectation contains invalid styles: 'border-left-color: #FFFF' - >hey - ` - ) - ); + parseHtml('
hey
'), + 'to satisfy', + parseHtml('
hey
') + ); + }); it.skipIf(isIe, 'should fail when the RHS has invalid styles', () => expect(