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

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

Issue 29481700: Issue 5339 - Properly select element for pseudo-element (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Reworked based on the new implementation proposal. Created Aug. 8, 2017, 4:56 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 | « chrome/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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 expectVisible(test, toHide); 268 expectVisible(test, toHide);
269 window.setTimeout(() => 269 window.setTimeout(() =>
270 { 270 {
271 expectHidden(test, toHide); 271 expectHidden(test, toHide);
272 resolve(); 272 resolve();
273 }, 4000); 273 }, 4000);
274 }); 274 });
275 }).catch(unexpectedError.bind(test)).then(() => test.done()); 275 }).catch(unexpectedError.bind(test)).then(() => test.done());
276 }; 276 };
277 277
278 exports.testPseudoClassWithPropBeforeSelector = function(test)
279 {
280 let parent = createElementWithStyle("{}");
281 let child = createElementWithStyle("{background-color: #000}", parent);
282 insertStyleRule(`#${child.id}::before {content: "publicite"}`);
283
284 applyElemHideEmulation(
285 ["div:-abp-properties(content: \"publicite\")"]
286 ).then(() =>
287 {
288 expectHidden(test, child);
289 expectVisible(test, parent);
290 }).catch(unexpectedError.bind(test)).then(() => test.done());
291 };
292
278 exports.testPseudoClassHasSelector = function(test) 293 exports.testPseudoClassHasSelector = function(test)
279 { 294 {
280 let toHide = createElementWithStyle("{}"); 295 let toHide = createElementWithStyle("{}");
281 applyElemHideEmulation( 296 applyElemHideEmulation(
282 ["div:-abp-has(div)"] 297 ["div:-abp-has(div)"]
283 ).then(() => 298 ).then(() =>
284 { 299 {
285 expectVisible(test, toHide); 300 expectVisible(test, toHide);
286 }).catch(unexpectedError.bind(test)).then(() => test.done()); 301 }).catch(unexpectedError.bind(test)).then(() => test.done());
287 }; 302 };
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 let child = createElementWithStyle("{}", parent); 459 let child = createElementWithStyle("{}", parent);
445 insertStyleRule("body #" + parent.id + " > div { background-color: #000}"); 460 insertStyleRule("body #" + parent.id + " > div { background-color: #000}");
446 applyElemHideEmulation( 461 applyElemHideEmulation(
447 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"] 462 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"]
448 ).then(() => 463 ).then(() =>
449 { 464 {
450 expectVisible(test, child); 465 expectVisible(test, child);
451 expectHidden(test, parent); 466 expectHidden(test, parent);
452 }).catch(unexpectedError.bind(test)).then(() => test.done()); 467 }).catch(unexpectedError.bind(test)).then(() => test.done());
453 }; 468 };
OLDNEW
« no previous file with comments | « chrome/content/elemHideEmulation.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld