Index: test/elemHideEmulation.js |
=================================================================== |
--- a/test/elemHideEmulation.js |
+++ b/test/elemHideEmulation.js |
@@ -114,19 +114,27 @@ |
{ |
let filter = Filter.fromText(text); |
if (filter instanceof ElemHideEmulationFilter) |
ElemHideEmulation.add(filter); |
else |
ElemHide.add(filter); |
filter.delete(); |
} |
- let matches = ElemHideEmulation.getRulesForDomain(domain) |
- .map(filter => filter.text); |
+ |
+ let rules = ElemHideEmulation.getRulesForDomain(domain); |
+ let matches = []; |
+ for (let i = 0; i < rules.filterCount; i++) |
+ { |
+ let filter = rules.filterAt(i); |
+ matches.push(filter.text); |
+ filter.delete(); |
+ } |
test.deepEqual(matches.sort(), expectedMatches.sort(), description); |
+ rules.delete(); |
ElemHideEmulation.clear(); |
ElemHide.clear(); |
} |
testSelectorMatches( |
"Ignore generic filters", |
[ |
@@ -175,20 +183,28 @@ |
test.done(); |
}; |
exports.testElemHideEmulationFiltersContainer = function(test) |
{ |
function compareRules(description, domain, expectedMatches) |
{ |
- let result = ElemHideEmulation.getRulesForDomain(domain) |
- .map(filter => filter.text); |
+ let rules = ElemHideEmulation.getRulesForDomain(domain); |
+ let result = []; |
+ for (let i = 0; i < rules.filterCount; i++) |
+ { |
+ let filter = rules.filterAt(i); |
+ result.push(filter.text); |
+ filter.delete(); |
+ } |
expectedMatches = expectedMatches.map(filter => filter.text); |
test.deepEqual(result.sort(), expectedMatches.sort(), description); |
+ |
+ rules.delete(); |
} |
let domainFilter = Filter.fromText("example.com##filter1"); |
let subdomainFilter = Filter.fromText("www.example.com##filter2"); |
let otherDomainFilter = Filter.fromText("other.example.com##filter3"); |
ElemHideEmulation.add(domainFilter); |
ElemHideEmulation.add(subdomainFilter); |