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

Unified Diff: test/elemHide.js

Issue 29882558: Issue 6955 - Avoid making copies of common selector list (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Sept. 16, 2018, 4:07 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
« no previous file with comments | « lib/elemHide.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/elemHide.js
===================================================================
--- a/test/elemHide.js
+++ b/test/elemHide.js
@@ -268,8 +268,37 @@
ElemHide.remove(Filter.fromText("example.com##test"));
test.equal(filtersByDomain.size, 2);
ElemHide.remove(Filter.fromText("example.com,~www.example.com##test"));
test.equal(filtersByDomain.size, 0);
test.done();
};
+
+exports.testGenericSelectorDedup = function(test)
+{
+ ElemHide.add(Filter.fromText("##test1"));
+ ElemHide.add(Filter.fromText("##test2"));
+ ElemHide.add(Filter.fromText("##test3"));
+
+ test.equal(ElemHide.getSelectorsForDomain("foo.example.com"),
+ ElemHide.getSelectorsForDomain("bar.example.com"));
+
+ ElemHide.add(Filter.fromText("foo.example.com##test4"));
+
+ test.notEqual(ElemHide.getSelectorsForDomain("foo.example.com"),
+ ElemHide.getSelectorsForDomain("bar.example.com"));
+
+ ElemHide.remove(Filter.fromText("foo.example.com##test4"));
+
+ test.equal(ElemHide.getSelectorsForDomain("foo.example.com"),
+ ElemHide.getSelectorsForDomain("bar.example.com"));
+
+ ElemHide.remove(Filter.fromText("##test1"));
+ ElemHide.remove(Filter.fromText("##test2"));
+ ElemHide.remove(Filter.fromText("##test3"));
+
+ test.equal(ElemHide.getSelectorsForDomain("foo.example.com"),
+ ElemHide.getSelectorsForDomain("bar.example.com"));
+
+ test.done();
+};
« no previous file with comments | « lib/elemHide.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld