Skip to content

Commit

Permalink
Merge pull request #253 from unexpectedjs/ssimonsen/relax-style-valid…
Browse files Browse the repository at this point in the history
…ation

Relax the inly style validation in expectations
  • Loading branch information
sunesimonsen authored Feb 20, 2019
2 parents 72f2c2e + a524844 commit 0baa80e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ function validateStyles(expect, str) {
.split(';')
.filter(
part =>
!/^\s*(\w|-)+\s*:\s*(#(?:[0-9a-fA-F]{3}){1,2}|(\w|-)+)\s*$|^$/.test(
part
)
!/^\s*(\w|-)+\s*:\s*(#(?:[0-9a-fA-F]{3}){1,2}|[^#]+)\s*$|^$/.test(part)
);

if (invalidStyles.length > 0) {
Expand Down
5 changes: 4 additions & 1 deletion test/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global expect, jsdom, sinon, describe, it, beforeEach, afterEach, document:true, DOMParser:true*/
/*global expect, jsdom, sinon, describe, it, beforeEach, afterEach, DOMParser:true*/
expect.addAssertion(
'<any> to inspect as <string>',
(expect, subject, value) => {
Expand Down Expand Up @@ -2577,6 +2577,7 @@ describe('unexpected-dom', () => {
DOMParser = undefined; // force the "implementation" path
originalDocument = root.document;

// eslint-disable-next-line no-global-assign
document = {
implementation: {
createHTMLDocument: (createHTMLDocumentSpy = sinon
Expand All @@ -2587,8 +2588,10 @@ describe('unexpected-dom', () => {
}
};
});

afterEach(() => {
DOMParser = OriginalDOMParser;
// eslint-disable-next-line no-global-assign
document = originalDocument;
});

Expand Down

0 comments on commit 0baa80e

Please sign in to comment.