aboutsummaryrefslogtreecommitdiff
path: root/test/styles/html-paths.tests.js
blob: ab24cec5a9d4fc8ab6ca8813efba813726d91ea9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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"}}));
});