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

Side by Side Diff: test/browser/elemHideEmulation.js

Issue 30002601: Issue 7284 - Move CSS escaping to createStyleSheet (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Added test Created Feb. 15, 2019, 2:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 { 295 {
296 let toHide = createElementWithStyle("{background-color: #000}"); 296 let toHide = createElementWithStyle("{background-color: #000}");
297 let selectors = [":-abp-properties(/.*color: rgb\\(0, 0, 0\\)/)"]; 297 let selectors = [":-abp-properties(/.*color: rgb\\(0, 0, 0\\)/)"];
298 298
299 if (await applyElemHideEmulation(test, selectors)) 299 if (await applyElemHideEmulation(test, selectors))
300 expectHidden(test, toHide); 300 expectHidden(test, toHide);
301 301
302 test.done(); 302 test.done();
303 }; 303 };
304 304
305 exports.testPropertySelectorWithEscapedBrace = async function(test)
306 {
307 let toHide = createElementWithStyle("{background-color: #000}");
308 let selectors = [":-abp-properties(/background.\\7B 0,6\\7D : rgb\\(0, 0, 0\\) /)"];
309
310 if (await applyElemHideEmulation(test, selectors))
311 expectHidden(test, toHide);
312
313 test.done();
314 };
315
316 exports.testPropertySelectorWithImproperlyEscapedBrace = async function(test)
317 {
318 let toHide = createElementWithStyle("{background-color: #000}");
319 let selectors = [":-abp-properties(/background.\\7B0,6\\7D: rgb\\(0, 0, 0\\)/) "];
320
321 if (await applyElemHideEmulation(test, selectors))
322 expectVisible(test, toHide);
323
324 test.done();
325 };
326
327 exports.testDynamicallyChangedProperty = async function(test) 305 exports.testDynamicallyChangedProperty = async function(test)
328 { 306 {
329 let toHide = createElementWithStyle("{}"); 307 let toHide = createElementWithStyle("{}");
330 let selectors = [":-abp-properties(background-color: rgb(0, 0, 0))"]; 308 let selectors = [":-abp-properties(background-color: rgb(0, 0, 0))"];
331 309
332 if (await applyElemHideEmulation(test, selectors)) 310 if (await applyElemHideEmulation(test, selectors))
333 { 311 {
334 expectVisible(test, toHide); 312 expectVisible(test, toHide);
335 insertStyleRule("#" + toHide.id + " {background-color: #000}"); 313 insertStyleRule("#" + toHide.id + " {background-color: #000}");
336 314
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 { 1072 {
1095 if (element.id == "n2" || element.id == "n2_3") 1073 if (element.id == "n2" || element.id == "n2_3")
1096 expectProcessed(test, element, element.id); 1074 expectProcessed(test, element, element.id);
1097 else 1075 else
1098 expectNotProcessed(test, element, element.id); 1076 expectNotProcessed(test, element, element.id);
1099 } 1077 }
1100 } 1078 }
1101 1079
1102 test.done(); 1080 test.done();
1103 }; 1081 };
OLDNEW
« no previous file with comments | « lib/filterClasses.js ('k') | test/elemHide.js » ('j') | test/elemHide.js » ('J')

Powered by Google App Engine
This is Rietveld