blob: 76a77efce3c298c662816c13b2f409737151f110 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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"}}));
});
});
|