Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/elemHideEmulation.js

Issue 29594607: Issue 5143 - Convert ElemHideEmulation to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Nov. 1, 2017, 2:42 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« compiled/bindings/main.cpp ('K') | « meson.build ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
« compiled/bindings/main.cpp ('K') | « meson.build ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld