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

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

Issue 30024560: Issue 7450 - Implement hide-if-contains-visible-text snippet (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Fixed a few nits. Unfactored test code. Created April 18, 2019, 5:48 p.m.
Right Patch Set: Updated patch for real Created May 9, 2019, 12:04 p.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/snippets.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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 .vis_hid { 290 .vis_hid {
291 visibility: hidden; 291 visibility: hidden;
292 } 292 }
293 .vis_collapse { 293 .vis_collapse {
294 visibility: collapse; 294 visibility: collapse;
295 } 295 }
296 .same_colour { 296 .same_colour {
297 color: rgb(255,255,255); 297 color: rgb(255,255,255);
298 background-color: rgb(255,255,255); 298 background-color: rgb(255,255,255);
299 } 299 }
300 .transparent {
301 color: transparent;
302 }
300 #label { 303 #label {
301 overflow-wrap: break-word; 304 overflow-wrap: break-word;
302 } 305 }
303 </style> 306 </style>
304 <div id="parent"> 307 <div id="parent">
305 <div id="middle"> 308 <div id="middle">
306 <div id="middle1"><div id="inside" class="inside"></div></div> 309 <div id="middle1"><div id="inside" class="inside"></div></div>
307 </div> 310 </div>
308 <div id="sibling"> 311 <div id="sibling">
309 <div id="tohide">to hide \ud83d\ude42!</div> 312 <div id="tohide">to hide \ud83d\ude42!</div>
310 </div> 313 </div>
311 <div id="sibling2"> 314 <div id="sibling2">
312 <div id="sibling21"><div id="sibling211" class="inside">Ad*</div></div> 315 <div id="sibling21"><div id="sibling211" class="inside">Ad*</div></div>
313 </div> 316 </div>
314 <div id="label"><div id="content"><div class="a transparent">Sp</div><div class="a">Sp</div><div class="a zerosize">S</div><div class="a transparent">on</ div><div class="a">on</div><div class="a zerosize">S</div></div></div> 317 <div id="label">
315 <div id="label2"><div class="a vis_hid">Visibility: hidden</div><div class ="a">S</div><div class="a vis_collapse">Visibility: collapse</div><div class="a" >p</div><div class="a disp_none">Display: none</div><div class="a">o</div><div c lass="a same_colour">Same colour</div><div class="a">n</div></div> 318 <div id="content"><div class="a transparent">Sp</div><div class="a">Sp</ div><div class="a zerosize">S</div><div class="a transparent">on</div><div class ="a">on</div><div class="a zerosize">S</div></div>
316 <article id="article"><div style="display: none"><a href="foo"><div>Spon</ div></a>Visit us</div></article> 319 </div>
317 <article id="article2"><div><a href="foo"><div>Spon</div></a>By this</div> </article> 320 <div id="label2">
318 <article id="article3"><div><a href="foo"><div>by Writer</div></a> about t he Sponsorship.</div></article> 321 <div class="a vis_hid">Visibility: hidden</div><div class="a">S</div><di v class="a vis_collapse">Visibility: collapse</div><div class="a">p</div><div cl ass="a disp_none">Display: none</div><div class="a">o</div><div class="a same_co lour">Same colour</div><div class="a transparent">Transparent</div><div class="a ">n</div>
322 </div>
323 <article id="article">
324 <div style="display: none"><a href="foo"><div>Spon</div></a>Visit us</di v>
325 </article>
326 <article id="article2">
327 <div><a href="foo"><div>Spon</div></a>By this</div>
328 </article>
329 <article id="article3">
330 <div><a href="foo"><div>by Writer</div></a> about the Sponsorship.</div>
331 </article>
319 </div>`; 332 </div>`;
a.giammarchi 2019/04/26 13:33:58 nit: I wonder if for test maintainability sake we
hub 2019/04/27 17:32:05 A '\n' in the markup generate a blank space in the
320 333
321 await runSnippet( 334 await runSnippet(
322 test, "hide-if-contains-visible-text", "Spon", "#parent > div" 335 test, "hide-if-contains-visible-text", "Spon", "#parent > div"
323 ); 336 );
324 337
325 let element = document.getElementById("label"); 338 let element = document.getElementById("label");
326 expectHidden(test, element, "label"); 339 expectHidden(test, element, "label");
327 element = document.getElementById("label2"); 340 element = document.getElementById("label2");
328 expectHidden(test, element, "label2"); 341 expectHidden(test, element, "label2");
329 342
330 element = document.getElementById("article"); 343 element = document.getElementById("article");
331 expectVisible(test, element, "article"); 344 expectVisible(test, element, "article");
332 element = document.getElementById("article2"); 345 element = document.getElementById("article2");
333 expectVisible(test, element, "article2"); 346 expectVisible(test, element, "article2");
334 347
335 await runSnippet( 348 await runSnippet(
336 test, "hide-if-contains-visible-text", "Spon", "#parent > article", "#parent > article a" 349 test, "hide-if-contains-visible-text", "Spon", "#parent > article", "#parent > article a"
337 ); 350 );
338 351
339 element = document.getElementById("article"); 352 element = document.getElementById("article");
340 expectHidden(test, element, "article"); 353 expectVisible(test, element, "article");
341 element = document.getElementById("article2"); 354 element = document.getElementById("article2");
342 expectHidden(test, element, "article2"); 355 expectHidden(test, element, "article2");
343 element = document.getElementById("article3"); 356 element = document.getElementById("article3");
344 expectVisible(test, element, "article3"); 357 expectVisible(test, element, "article3");
345 358
346 test.done(); 359 test.done();
a.giammarchi 2019/04/26 13:33:59 Happy to discuss this offline/elsewhere though, I
hub 2019/04/27 17:32:06 This is because we still use nodeunit. There is is
347 }; 360 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld