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