blob: 7a2fb77f105705b2ece7b7e495a3673f59faef94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
function getElementsByIds(ids) {
var result = [];
ids.forEach(function(id) {
result.push(document.getElementById(id));
});
return result;
}
function testSelectorIdsMatch(selector, ids, testName) {
test(function(){
var elements = document.querySelectorAll(selector);
assert_array_equals([...elements], getElementsByIds(ids));
}, testName);
}
function testSelectorElementsMatch(selector, elements, testName) {
test(function(){
assert_array_equals([...document.querySelectorAll(selector)], elements);
}, testName);
}
|