diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-07-03 19:19:21 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-07-03 19:20:00 +0100 |
| commit | 0b56dfce42c3944cce47e284608e6806f4c839c3 (patch) | |
| tree | 5f96f9c2908f1c5b00a7192e71d4c192abd7cf47 /test/html-paths.tests.js | |
| parent | 627c4a755395e313234bdb1914d168392006c483 (diff) | |
Move tests to test for easier Mocha usage
Diffstat (limited to 'test/html-paths.tests.js')
| -rw-r--r-- | test/html-paths.tests.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/html-paths.tests.js b/test/html-paths.tests.js new file mode 100644 index 0000000..76a77ef --- /dev/null +++ b/test/html-paths.tests.js @@ -0,0 +1,22 @@ +var assert = require("assert"); + +var test = require("./testing").test; +var htmlPaths = require("../lib/html-paths"); + + +describe("html-paths", function() { + 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"}})); + }); +}); + |
