Index: test/elemHideEmulation.js |
=================================================================== |
--- a/test/elemHideEmulation.js |
+++ b/test/elemHideEmulation.js |
@@ -105,18 +105,21 @@ |
for (let text of filters) |
{ |
let filter = Filter.fromText(text); |
if (filter instanceof ElemHideEmulationFilter) |
ElemHideEmulation.add(filter); |
else |
ElemHide.add(filter); |
} |
- let matches = ElemHideEmulation.getRulesForDomain(domain) |
- .map(filter => filter.text); |
+ |
+ let rules = ElemHideEmulation.getRulesForDomain(domain); |
+ let matches = []; |
+ for (let i = 0; i < rules.filterCount; i++) |
+ matches.push(rules.filterAt(i).text); |
test.deepEqual(matches.sort(), expectedMatches.sort(), description); |
ElemHideEmulation.clear(); |
ElemHide.clear(); |
} |
testSelectorMatches( |
"Ignore generic filters", |
@@ -166,18 +169,20 @@ |
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); |
sergei
2017/11/16 09:58:07
What about returning a generator object from ElemH
hub
2017/11/20 19:16:01
delete on the result of `rules.filterAt(i)` is an
|
+ let result = []; |
+ for (let i = 0; i < rules.filterCount; i++) |
+ result.push(rules.filterAt(i).text); |
expectedMatches = expectedMatches.map(filter => filter.text); |
test.deepEqual(result.sort(), expectedMatches.sort(), description); |
} |
let domainFilter = Filter.fromText("example.com##filter1"); |
let subdomainFilter = Filter.fromText("www.example.com##filter2"); |
let otherDomainFilter = Filter.fromText("other.example.com##filter3"); |