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

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

Issue 29676761: Issue 6296 - Handle relative prefix in :-abp-has() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rework the query selector all Created Jan. 25, 2018, 9:58 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 }).catch(unexpectedError.bind(test)).then(() => test.done()); 353 }).catch(unexpectedError.bind(test)).then(() => test.done());
354 }; 354 };
355 355
356 function runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, selector , expectations) 356 function runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, selector , expectations)
357 { 357 {
358 testDocument.body.innerHTML = `<div id="parent"> 358 testDocument.body.innerHTML = `<div id="parent">
359 <div id="middle"> 359 <div id="middle">
360 <div id="middle1"><div id="inside" class="inside"></div></div> 360 <div id="middle1"><div id="inside" class="inside"></div></div>
361 </div> 361 </div>
362 <div id="sibling"> 362 <div id="sibling">
363 <div id="tohide">to hide</div> 363 <div id="tohide"><span>to hide</span></div>
364 </div> 364 </div>
365 <div id="sibling2"> 365 <div id="sibling2">
366 <div id="sibling21"><div id="sibling211" class="inside"></div></div> 366 <div id="sibling21"><div id="sibling211" class="inside"></div></div>
367 </div> 367 </div>
368 </div>`; 368 </div>`;
369 let elems = { 369 let elems = {
370 parent: testDocument.getElementById("parent"), 370 parent: testDocument.getElementById("parent"),
371 middle: testDocument.getElementById("middle"), 371 middle: testDocument.getElementById("middle"),
372 inside: testDocument.getElementById("inside"), 372 inside: testDocument.getElementById("inside"),
373 sibling: testDocument.getElementById("sibling"), 373 sibling: testDocument.getElementById("sibling"),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 middile: true, 413 middile: true,
414 inside: true, 414 inside: true,
415 sibling: true, 415 sibling: true,
416 sibling2: true, 416 sibling2: true,
417 toHide: false 417 toHide: false
418 }; 418 };
419 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling( 419 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(
420 test, "div:-abp-has(:-abp-has(> div.inside)) + div > div", expectations); 420 test, "div:-abp-has(:-abp-has(> div.inside)) + div > div", expectations);
421 }; 421 };
422 422
423 exports.testPseudoClassHasSelectorWithHasAndWithSuffixSibling3 = function(test)
424 {
425 let expectations = {
426 parent: true,
427 middile: true,
428 inside: true,
429 sibling: true,
430 sibling2: true,
431 toHide: false
432 };
433 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(
434 test, "div:-abp-has(> div:-abp-has(div.inside)) + div > div", expectations);
435 };
436
423 exports.testPseudoClassHasSelectorWithSuffixSiblingNoop = function(test) 437 exports.testPseudoClassHasSelectorWithSuffixSiblingNoop = function(test)
424 { 438 {
425 let expectations = { 439 let expectations = {
426 parent: true, 440 parent: true,
427 middile: true, 441 middile: true,
428 inside: true, 442 inside: true,
429 sibling: true, 443 sibling: true,
430 sibling2: true, 444 sibling2: true,
431 toHide: true 445 toHide: true
432 }; 446 };
433 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling( 447 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(
434 test, "div:-abp-has(> body div.inside) + div > div", expectations); 448 test, "div:-abp-has(> body div.inside) + div > div", expectations);
435 }; 449 };
436 450
451 exports.testPseudoClassHasSelectorWithSuffixSiblingContains = function(test)
452 {
453 let expectations = {
454 parent: true,
455 middile: true,
456 inside: true,
457 sibling: true,
458 sibling2: true,
459 toHide: true
460 };
461 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(
462 test, "div:-abp-has(> span:-abp-contains(Advertisment))", expectations);
463 };
464
437 exports.testPseudoClassContains = function(test) 465 exports.testPseudoClassContains = function(test)
438 { 466 {
439 testDocument.body.innerHTML = `<div id="parent"> 467 testDocument.body.innerHTML = `<div id="parent">
440 <div id="middle"> 468 <div id="middle">
441 <div id="middle1"><div id="inside" class="inside"></div></div> 469 <div id="middle1"><div id="inside" class="inside"></div></div>
442 </div> 470 </div>
443 <div id="sibling"> 471 <div id="sibling">
444 <div id="tohide">to hide</div> 472 <div id="tohide">to hide</div>
445 </div> 473 </div>
446 <div id="sibling2"> 474 <div id="sibling2">
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 expectVisible(test, child2); 608 expectVisible(test, child2);
581 return timeout(REFRESH_INTERVAL); 609 return timeout(REFRESH_INTERVAL);
582 }).then(() => 610 }).then(() =>
583 { 611 {
584 expectHidden(test, parent); 612 expectHidden(test, parent);
585 expectVisible(test, child); 613 expectVisible(test, child);
586 expectHidden(test, sibling); 614 expectHidden(test, sibling);
587 expectVisible(test, child2); 615 expectVisible(test, child2);
588 }).catch(unexpectedError.bind(test)).then(() => test.done()); 616 }).catch(unexpectedError.bind(test)).then(() => test.done());
589 }; 617 };
OLDNEW
« lib/content/elemHideEmulation.js ('K') | « lib/content/elemHideEmulation.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld