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

Delta Between Two Patch Sets: test/elemHideEmulation.js

Issue 29595633: Issue 5870 - Implement the new ElemHideEmulation filter type (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Reworked the strings const. String::find() from a String::value_type* Created Feb. 1, 2018, 8:36 p.m.
Right Patch Set: Deal with ill formed filters. Created Feb. 14, 2018, 5:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 { 172 {
173 function checkConvertedFilter(old, converted) 173 function checkConvertedFilter(old, converted)
174 { 174 {
175 withNAD( 175 withNAD(
176 0, filter => test.equal(filter.text, converted))(Filter.fromText(old)); 176 0, filter => test.equal(filter.text, converted))(Filter.fromText(old));
177 } 177 }
178 178
179 checkConvertedFilter("example.com##foo[-abp-properties='something']bar", "exam ple.com#?#foo:-abp-properties(something)bar"); 179 checkConvertedFilter("example.com##foo[-abp-properties='something']bar", "exam ple.com#?#foo:-abp-properties(something)bar");
180 checkConvertedFilter("example.com#@#foo[-abp-properties='something']bar", "exa mple.com#@#foo:-abp-properties(something)bar"); 180 checkConvertedFilter("example.com#@#foo[-abp-properties='something']bar", "exa mple.com#@#foo:-abp-properties(something)bar");
181 checkConvertedFilter("example.com##[-abp-properties=\"something\"]", "example. com#?#:-abp-properties(something)"); 181 checkConvertedFilter("example.com##[-abp-properties=\"something\"]", "example. com#?#:-abp-properties(something)");
182 checkConvertedFilter("example.com##[-abp-properties=(something)]", "example.co m#?#:-abp-properties((something))"); 182 checkConvertedFilter("example.com##[-abp-properties='(something)']", "example. com#?#:-abp-properties((something))");
183 183
184 test.done(); 184 test.done();
185 }; 185 };
186 186
187 exports.testDomainRestrictions = function(test) 187 exports.testDomainRestrictions = function(test)
188 { 188 {
189 function testSelectorMatches(description, filters, domain, expectedMatches) 189 function testSelectorMatches(description, filters, domain, expectedMatches)
190 { 190 {
191 withNAD([0, 1], (elemHide, elemHideEmulation) => 191 withNAD([0, 1], (elemHide, elemHideEmulation) =>
192 { 192 {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 "www.example.com", 306 "www.example.com",
307 [] 307 []
308 ); 308 );
309 })(Filter.fromText("example.com##filter1"), 309 })(Filter.fromText("example.com##filter1"),
310 Filter.fromText("www.example.com##filter2"), 310 Filter.fromText("www.example.com##filter2"),
311 Filter.fromText("other.example.com##filter3")); 311 Filter.fromText("other.example.com##filter3"));
312 })(ElemHide.create(), ElemHideEmulation.create()); 312 })(ElemHide.create(), ElemHideEmulation.create());
313 313
314 test.done(); 314 test.done();
315 }; 315 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld