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

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

Issue 29494577: Issue 5438 - Observer DOM changes to reapply filters. (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: And now the test, with issues Created Aug. 23, 2017, 12:57 a.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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 let child = createElementWithStyle("{}", parent); 477 let child = createElementWithStyle("{}", parent);
478 insertStyleRule("body #" + parent.id + " > div { background-color: #000}"); 478 insertStyleRule("body #" + parent.id + " > div { background-color: #000}");
479 applyElemHideEmulation( 479 applyElemHideEmulation(
480 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"] 480 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"]
481 ).then(() => 481 ).then(() =>
482 { 482 {
483 expectVisible(test, child); 483 expectVisible(test, child);
484 expectHidden(test, parent); 484 expectHidden(test, parent);
485 }).catch(unexpectedError.bind(test)).then(() => test.done()); 485 }).catch(unexpectedError.bind(test)).then(() => test.done());
486 }; 486 };
487
488 exports.testDomUpdatesStyle = function(test)
489 {
490 let parent = createElementWithStyle("{}");
491 let child = createElementWithStyle("{}", parent);
492 applyElemHideEmulation(
493 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"]
494 ).then(() =>
495 {
496 expectVisible(test, child);
497 expectVisible(test, parent);
498
499 insertStyleRule("body #" + parent.id + " > div { background-color: #000}");
500
501 return new Promise((resolve, reject) =>
502 {
503 expectVisible(test, child);
504 expectVisible(test, parent);
505 window.setTimeout(() =>
506 {
507 //expectVisible(test, child);
hub 2017/08/23 01:11:31 This is where test are running into problems. This
508 expectHidden(test, parent);
509 resolve();
510 }, 4000);
511 });
512 }).catch(unexpectedError.bind(test)).then(() => test.done());
513 };
514
515 exports.testDomUpdatesContent = function(test)
516 {
517 let parent = createElementWithStyle("{}");
518 let child = createElementWithStyle("{}", parent);
519 applyElemHideEmulation(
520 ["div:-abp-contains(hide me)"]
521 ).then(() =>
522 {
523 expectVisible(test, parent);
524 expectVisible(test, child);
525
526 child.innerText = "hide me";
527 return new Promise((resolve, reject) =>
528 {
529 expectVisible(test, parent);
530 expectVisible(test, child);
531 window.setTimeout(() =>
532 {
533 expectVisible(test, parent);
hub 2017/08/23 01:11:31 This one not commented out fail.
534 expectHidden(test, child);
535 resolve();
536 }, 4000);
537 });
538 }).catch(unexpectedError.bind(test)).then(() => test.done());
539 };
540
541 exports.testDomUpdatesNewElement = function(test)
542 {
543 let parent = createElementWithStyle("{}");
544 let child = createElementWithStyle("{ background-color: #000}", parent);
545 applyElemHideEmulation(
546 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"]
547 ).then(() =>
548 {
549 expectHidden(test, parent);
550 expectVisible(test, child);
551
552 let sibling = createElementWithStyle("{}");
553 expectVisible(test, sibling);
554
555 return new Promise((resolve, reject) =>
556 {
557 expectHidden(test, parent);
558 expectVisible(test, child);
559 expectVisible(test, sibling);
560 window.setTimeout(() =>
561 {
562 expectHidden(test, parent);
563 //expectVisible(test, child);
564 //expectVisible(test, sibling);
565
566 let child2 = createElementWithStyle("{ background-color: #000}",
567 sibling);
568 expectVisible(test, child2);
569 window.setTimeout(() =>
570 {
571 expectHidden(test, parent);
572 //expectVisible(test, child);
573 expectHidden(test, sibling);
574 //expectVisible(test, child2);
575
576 resolve();
577 }, 4000);
578 }, 4000);
579 });
580 }).catch(unexpectedError.bind(test)).then(() => test.done());
581 };
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