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

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

Issue 29836555: Issue 6680 - PropsSelector also depend on DOM modifications (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Nits Created July 23, 2018, 9:01 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
« no previous file with comments | « lib/content/elemHideEmulation.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 applyElemHideEmulation( 234 applyElemHideEmulation(
235 ["div > :-abp-properties(background-color: rgb(0, 0, 0)) > div"] 235 ["div > :-abp-properties(background-color: rgb(0, 0, 0)) > div"]
236 ).then(() => 236 ).then(() =>
237 { 237 {
238 expectVisible(test, parent); 238 expectVisible(test, parent);
239 expectVisible(test, middle); 239 expectVisible(test, middle);
240 expectHidden(test, toHide); 240 expectHidden(test, toHide);
241 }).catch(unexpectedError.bind(test)).then(() => test.done()); 241 }).catch(unexpectedError.bind(test)).then(() => test.done());
242 }; 242 };
243 243
244 // Add the style. Then add the element for that style.
245 // This should retrigger the filtering and hide it.
246 exports.testPropertyPseudoSelectorAddStyleAndElement = function(test)
247 {
248 let styleElement;
249 let toHide;
250 applyElemHideEmulation(
251 [":-abp-properties(background-color: rgb(0, 0, 0))"]
252 ).then(() =>
253 {
254 styleElement = testDocument.createElement("style");
255 testDocument.head.appendChild(styleElement);
256 styleElement.sheet.insertRule("#toHide {background-color: #000}");
257 return timeout(REFRESH_INTERVAL);
258 }).then(() =>
259 {
260 toHide = createElement();
261 toHide.id = "toHide";
262 expectVisible(test, toHide);
263 return timeout(REFRESH_INTERVAL);
264 }).then(() =>
265 {
266 expectHidden(test, toHide);
267 }).catch(unexpectedError.bind(test)).then(() => test.done());
268 };
269
244 exports.testPropertySelectorWithWildcard = function(test) 270 exports.testPropertySelectorWithWildcard = function(test)
245 { 271 {
246 let toHide = createElementWithStyle("{background-color: #000}"); 272 let toHide = createElementWithStyle("{background-color: #000}");
247 applyElemHideEmulation( 273 applyElemHideEmulation(
248 [":-abp-properties(*color: rgb(0, 0, 0))"] 274 [":-abp-properties(*color: rgb(0, 0, 0))"]
249 ).then(() => 275 ).then(() =>
250 { 276 {
251 expectHidden(test, toHide); 277 expectHidden(test, toHide);
252 }).catch(unexpectedError.bind(test)).then(() => test.done()); 278 }).catch(unexpectedError.bind(test)).then(() => test.done());
253 }; 279 };
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 for (let element of [...testDocument.getElementsByTagName("div"), 1041 for (let element of [...testDocument.getElementsByTagName("div"),
1016 ...testDocument.getElementsByTagName("p")]) 1042 ...testDocument.getElementsByTagName("p")])
1017 { 1043 {
1018 if (element.id == "n2" || element.id == "n2_3") 1044 if (element.id == "n2" || element.id == "n2_3")
1019 expectProcessed(test, element, element.id); 1045 expectProcessed(test, element, element.id);
1020 else 1046 else
1021 expectNotProcessed(test, element, element.id); 1047 expectNotProcessed(test, element, element.id);
1022 } 1048 }
1023 }).catch(unexpectedError.bind(test)).then(() => test.done()); 1049 }).catch(unexpectedError.bind(test)).then(() => test.done());
1024 }; 1050 };
OLDNEW
« no previous file with comments | « lib/content/elemHideEmulation.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld