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

Delta Between Two Patch Sets: test/elemHide.js

Issue 30002601: Issue 7284 - Move CSS escaping to createStyleSheet (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Nits addressed Created Feb. 18, 2019, 12:55 p.m.
Right Patch Set: more nits Created Feb. 18, 2019, 1:50 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 | « test/browser/elemHideEmulation.js ('k') | test/filterClasses.js » ('j') | 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 Math.ceil(50000 / selectorGroupSize), 303 Math.ceil(50000 / selectorGroupSize),
304 "Style sheet should be split up into rules with at most " + 304 "Style sheet should be split up into rules with at most " +
305 selectorGroupSize + " selectors each"); 305 selectorGroupSize + " selectors each");
306 306
307 test.equal( 307 test.equal(
308 createStyleSheet([ 308 createStyleSheet([
309 "html", "#foo", ".bar", "#foo .bar", "#foo > .bar", 309 "html", "#foo", ".bar", "#foo .bar", "#foo > .bar",
310 "#foo[data-bar='{foo: 1}']" 310 "#foo[data-bar='{foo: 1}']"
311 ]), 311 ]),
312 "html, #foo, .bar, #foo .bar, #foo > .bar, " + 312 "html, #foo, .bar, #foo .bar, #foo > .bar, " +
313 "#foo[data-bar='\\7B foo: 1\\7D '] {display: none !important;}\n", 313 "#foo[data-bar='\\7B foo: 1\\7D '] {display: none !important;}\n",
314 "Braces should be escaped" 314 "Braces should be escaped"
315 ); 315 );
316 316
317 test.done(); 317 test.done();
318 }; 318 };
319 319
320 exports.testRulesFromStyleSheet = function(test) 320 exports.testRulesFromStyleSheet = function(test)
321 { 321 {
322 // Note: The rulesFromStyleSheet function assumes that each rule will be 322 // Note: The rulesFromStyleSheet function assumes that each rule will be
323 // terminated with a newline character, including the last rule. If this is 323 // terminated with a newline character, including the last rule. If this is
324 // not the case, the function goes into an infinite loop. It should only be 324 // not the case, the function goes into an infinite loop. It should only be
325 // used with the return value of the createStyleSheet function. 325 // used with the return value of the createStyleSheet function.
326 326
327 test.deepEqual([...rulesFromStyleSheet("")], []); 327 test.deepEqual([...rulesFromStyleSheet("")], []);
328 test.deepEqual([...rulesFromStyleSheet("#foo {}\n")], ["#foo {}"]); 328 test.deepEqual([...rulesFromStyleSheet("#foo {}\n")], ["#foo {}"]);
329 test.deepEqual([...rulesFromStyleSheet("#foo {}\n#bar {}\n")], 329 test.deepEqual([...rulesFromStyleSheet("#foo {}\n#bar {}\n")],
330 ["#foo {}", "#bar {}"]); 330 ["#foo {}", "#bar {}"]);
331 331
332 test.done(); 332 test.done();
333 }; 333 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld