diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-11-19 11:54:43 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-11-19 11:54:43 +0000 |
| commit | 68d8c8140fb6ef1118fa2815243817f8e4f55b59 (patch) | |
| tree | d4e4be8d3b124d98f2d204ed5f97585a8729ca94 /test/styles/html-paths.tests.js | |
| parent | 5f84e7887b262b96fd6fd47ce6bb1cd96c196f69 (diff) | |
Move html-paths and document-matchers to styles module
Diffstat (limited to 'test/styles/html-paths.tests.js')
| -rw-r--r-- | test/styles/html-paths.tests.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/styles/html-paths.tests.js b/test/styles/html-paths.tests.js new file mode 100644 index 0000000..ab24cec --- /dev/null +++ b/test/styles/html-paths.tests.js @@ -0,0 +1,20 @@ +var assert = require("assert"); + +var test = require("../test")(module); +var htmlPaths = require("../../lib/styles/html-paths"); + + +test("element can match multiple tag names", function() { + var pathPart = htmlPaths.element(["ul", "ol"]); + assert.ok(pathPart.matchesElement({tagName: "ul"})); + assert.ok(pathPart.matchesElement({tagName: "ol"})); + assert.ok(!pathPart.matchesElement({tagName: "p"})); +}); + +test("element matches if attributes are the same", function() { + var pathPart = htmlPaths.element(["p"], {"class": "tip"}); + assert.ok(!pathPart.matchesElement({tagName: "p"})); + assert.ok(!pathPart.matchesElement({tagName: "p", attributes: {"class": "tip help"}})); + assert.ok(pathPart.matchesElement({tagName: "p", attributes: {"class": "tip"}})); +}); + |
