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

Unified Diff: test/filterClasses.js

Issue 29367031: Issue 4684 - Allow { and } in attribute and property selectors (Closed) Base URL: https://bitbucket.org/fhd/adblockpluscore
Patch Set: Created Dec. 8, 2016, 10:10 a.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
« lib/filterClasses.js ('K') | « lib/filterClasses.js ('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
@@ -374,8 +374,37 @@
{
let filter = Filter.fromText(filterText);
test.ok(filter instanceof InvalidFilter);
test.equal(filter.reason, "filter_invalid_domain");
}
test.done();
};
+
+exports.testCssRuleInjection = function(test)
+{
+ compareFilter(test, "###foo{color: red}",
+ ["type=filterlist",
+ "text=###foo{color: red}",
+ "regexp=\\#\\#\\#foo\\{color\\:\\ red\\}"]);
+ compareFilter(test, "foo.com##[-abp-properties='/margin: [3-4]{2}/']",
+ ["type=elemhideemulation",
+ "text=foo.com##[-abp-properties='/margin: [3-4]{2}/']",
+ "selectorDomain=foo.com",
+ "selector=[-abp-properties='/margin: [3-4]{2}/']",
+ "domains=FOO.COM"]);
+ compareFilter(test, "foo.com##[foo~='{bar}']",
+ ["type=elemhide",
+ "text=foo.com##[foo~='{bar}']",
+ "selectorDomain=foo.com",
+ "selector=[foo~='{bar}']",
+ "domains=FOO.COM"]);
+ compareFilter(test, "foo.com##''{color: red}''",
+ ["type=filterlist",
+ "text=foo.com##''{color: red}''",
+ "regexp=foo\\.com\\#\\#\\'\\'\\{color\\:\\ red\\}\\'\\'"]);
+ compareFilter(test, "foo.com##[foo='']{color: red}[foo='']",
+ ["type=filterlist",
+ "text=foo.com##[foo='']{color: red}[foo='']",
+ "regexp=foo\\.com\\#\\#\\[foo\\=\\'\\'\\]\\{color\\:\\ red\\}\\[foo\\=\\'\\'\\]"]);
+ test.done();
+};
« lib/filterClasses.js ('K') | « lib/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld