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

Delta Between Two Patch Sets: test/browser/elemHideEmulation.js

Issue 29494577: Issue 5438 - Observer DOM changes to reapply filters. (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Review changes Created Aug. 25, 2017, 1:47 p.m.
Right Patch Set: Addressed comments Created Aug. 26, 2017, 1:44 a.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
« no previous file with change/comment | « lib/content/elemHideEmulation.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 { 507 {
508 let parent = createElementWithStyle("{}"); 508 let parent = createElementWithStyle("{}");
509 let child = createElementWithStyle("{}", parent); 509 let child = createElementWithStyle("{}", parent);
510 applyElemHideEmulation( 510 applyElemHideEmulation(
511 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"] 511 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"]
512 ).then(() => 512 ).then(() =>
513 { 513 {
514 expectVisible(test, child); 514 expectVisible(test, child);
515 expectVisible(test, parent); 515 expectVisible(test, parent);
516 516
517 insertStyleRule("body #" + parent.id + " > div { background-color: #000}"); 517 insertStyleRule("body #" + parent.id + " > div { background-color: #000}");
Wladimir Palant 2017/08/25 20:57:41 `return timeout(0)` before retesting state?
hub 2017/08/26 01:45:07 Done.
518 518 return timeout(0);
519 }).then(() =>
520 {
519 expectVisible(test, child); 521 expectVisible(test, child);
520 expectVisible(test, parent); 522 expectVisible(test, parent);
521 return timeout(REFRESH_INTERVAL); 523 return timeout(REFRESH_INTERVAL);
522 }).then(() => 524 }).then(() =>
523 { 525 {
524 expectVisible(test, child); 526 expectVisible(test, child);
525 expectHidden(test, parent); 527 expectHidden(test, parent);
526 }).catch(unexpectedError.bind(test)).then(() => test.done()); 528 }).catch(unexpectedError.bind(test)).then(() => test.done());
527 }; 529 };
528 530
529 exports.testDomUpdatesContent = function(test) 531 exports.testDomUpdatesContent = function(test)
530 { 532 {
531 let parent = createElementWithStyle("{}"); 533 let parent = createElementWithStyle("{}");
532 let child = createElementWithStyle("{}", parent); 534 let child = createElementWithStyle("{}", parent);
533 applyElemHideEmulation( 535 applyElemHideEmulation(
534 ["div > div:-abp-contains(hide me)"] 536 ["div > div:-abp-contains(hide me)"]
535 ).then(() => 537 ).then(() =>
536 { 538 {
537 expectVisible(test, parent); 539 expectVisible(test, parent);
538 expectVisible(test, child); 540 expectVisible(test, child);
539 541
540 child.textContent = "hide me"; 542 child.textContent = "hide me";
Wladimir Palant 2017/08/25 20:57:41 `return timeout(0)` before retesting state?
hub 2017/08/26 01:45:07 Done.
541 543 return timeout(0);
544 }).then(() =>
545 {
542 expectVisible(test, parent); 546 expectVisible(test, parent);
543 expectVisible(test, child); 547 expectVisible(test, child);
544 return timeout(REFRESH_INTERVAL); 548 return timeout(REFRESH_INTERVAL);
545 }).then(() => 549 }).then(() =>
546 { 550 {
547 expectVisible(test, parent); 551 expectVisible(test, parent);
548 expectHidden(test, child); 552 expectHidden(test, child);
549 }).catch(unexpectedError.bind(test)).then(() => test.done()); 553 }).catch(unexpectedError.bind(test)).then(() => test.done());
550 }; 554 };
551 555
552 exports.testDomUpdatesNewElement = function(test) 556 exports.testDomUpdatesNewElement = function(test)
553 { 557 {
554 let parent = createElementWithStyle("{}"); 558 let parent = createElementWithStyle("{}");
555 let child = createElementWithStyle("{ background-color: #000}", parent); 559 let child = createElementWithStyle("{ background-color: #000}", parent);
556 let sibling; 560 let sibling;
557 let child2; 561 let child2;
558 applyElemHideEmulation( 562 applyElemHideEmulation(
559 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"] 563 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"]
560 ).then(() => 564 ).then(() =>
561 { 565 {
562 expectHidden(test, parent); 566 expectHidden(test, parent);
563 expectVisible(test, child); 567 expectVisible(test, child);
564 568
565 sibling = createElementWithStyle("{}"); 569 sibling = createElementWithStyle("{}");
Wladimir Palant 2017/08/25 20:57:41 `return timeout(0)` before retesting state?
hub 2017/08/26 01:45:06 Done.
570 return timeout(0);
571 }).then(() =>
572 {
566 expectHidden(test, parent); 573 expectHidden(test, parent);
567 expectVisible(test, child); 574 expectVisible(test, child);
568 expectVisible(test, sibling); 575 expectVisible(test, sibling);
569 576
570 return timeout(REFRESH_INTERVAL); 577 return timeout(REFRESH_INTERVAL);
571 }).then(() => 578 }).then(() =>
572 { 579 {
573 expectHidden(test, parent); 580 expectHidden(test, parent);
574 expectVisible(test, child); 581 expectVisible(test, child);
575 expectVisible(test, sibling); 582 expectVisible(test, sibling);
576 583
577 child2 = createElementWithStyle("{ background-color: #000}", 584 child2 = createElementWithStyle("{ background-color: #000}",
578 sibling); 585 sibling);
Wladimir Palant 2017/08/25 20:57:41 `return timeout(0)` before retesting state?
hub 2017/08/26 01:45:06 Done.
586 return timeout(0);
587 }).then(() =>
588 {
579 expectVisible(test, child2); 589 expectVisible(test, child2);
580 return timeout(REFRESH_INTERVAL); 590 return timeout(REFRESH_INTERVAL);
581 }).then(() => 591 }).then(() =>
582 { 592 {
583 expectHidden(test, parent); 593 expectHidden(test, parent);
584 expectVisible(test, child); 594 expectVisible(test, child);
585 expectHidden(test, sibling); 595 expectHidden(test, sibling);
586 expectVisible(test, child2); 596 expectVisible(test, child2);
587 }).catch(unexpectedError.bind(test)).then(() => test.done()); 597 }).catch(unexpectedError.bind(test)).then(() => test.done());
588 }; 598 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld