aboutsummaryrefslogtreecommitdiff
path: root/tests/html-paths.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-12-14 15:43:30 +0000
committerMichael Williamson <mike@zwobble.org>2013-12-14 15:43:30 +0000
commitcd79d48d9799b715188a63461f2023eb4187ad39 (patch)
tree0268d6606db2e803ad42d8bef63ee6f546e9fa28 /tests/html-paths.tests.js
parentb1b0fcd0547f1b432baab03038903414a1475a1b (diff)
Consider attributes when matching elements
Diffstat (limited to 'tests/html-paths.tests.js')
-rw-r--r--tests/html-paths.tests.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/html-paths.tests.js b/tests/html-paths.tests.js
index 7e3ed86..76a77ef 100644
--- a/tests/html-paths.tests.js
+++ b/tests/html-paths.tests.js
@@ -11,5 +11,12 @@ describe("html-paths", function() {
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"}}));
+ });
});