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

Unified Diff: test/filterClasses.js

Issue 29580558: Issue 5174 - Allow '{' and '}' in selectors (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Oct. 16, 2017, 5:10 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 | « compiled/filter/ElemHideBase.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/filterClasses.js
===================================================================
--- a/test/filterClasses.js
+++ b/test/filterClasses.js
@@ -62,17 +62,17 @@
["#@#asdf", ElemHideException, "elemhideexception"],
["foobar##asdf", ElemHideFilter, "elemhide"],
["foobar#@#asdf", ElemHideException, "elemhideexception"],
["foobar##a", ElemHideFilter, "elemhide"],
["foobar#@#a", ElemHideException, "elemhideexception"],
["foobar#asdf", BlockingFilter, "blocking"],
["foobar|foobas##asdf", BlockingFilter, "blocking"],
- ["foobar##asdf{asdf}", BlockingFilter, "blocking"],
+ ["foobar##asdf{asdf}", ElemHideFilter, "elemhide"],
["foobar##", BlockingFilter, "blocking"],
["foobar#@#", BlockingFilter, "blocking"],
["asdf$foobar", InvalidFilter, "invalid"],
["asdf$image,foobar", InvalidFilter, "invalid"],
["asdf$image=foobar", BlockingFilter, "blocking"],
["asdf$image=foobar=xyz,~collapse", BlockingFilter, "blocking"],
["##foo[-abp-properties='something']bar", InvalidFilter, "invalid"],
@@ -346,17 +346,16 @@
};
exports.testElemHideSelector = function(test)
{
function doTest(text, selector, selectorDomain)
{
let filter = Filter.fromText(text);
test.equal(filter.selector, selector, "Correct selector for " + text);
-
let actualDomains = filter.selectorDomain.split(",").sort().join(",");
let expectedDomains = selectorDomain.split(",").sort().join(",");
test.equal(actualDomains, expectedDomains, "Correct domains list for " + text);
filter.delete();
}
let tests = [
@@ -376,16 +375,26 @@
{
doTest(text, selector, selectorDomain);
doTest(text.replace("##", "#@#"), selector, selectorDomain);
}
test.done();
};
+exports.testElemHideRulesWithBraces = function(test)
+{
+ let filter = Filter.fromText("###foo{color: red}");
+ test.equal(filter.type, "elemhide");
+ test.equal(filter.selector, "#foo\\x7B color: red\\x7D ");
+ filter.delete();
+
+ test.done();
+};
+
exports.testNotifications = function(test)
{
function checkNotifications(action, expected, message)
{
let result = null;
let listener = (topic, filter) =>
{
if (result)
« no previous file with comments | « compiled/filter/ElemHideBase.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld