| Index: test/elemHide.js |
| =================================================================== |
| --- a/test/elemHide.js |
| +++ b/test/elemHide.js |
| @@ -292,23 +292,33 @@ |
| "html", "#foo", ".bar", "#foo .bar", "#foo > .bar", |
| "#foo[data-bar='bar']" |
| ]), |
| "html, #foo, .bar, #foo .bar, #foo > .bar, #foo[data-bar='bar'] " + |
| "{display: none !important;}\n", |
| "Style sheet creation should work" |
| ); |
| - let selectors = new Array(50000).map((element, index) => ".s" + index); |
| + let selectors = new Array(50000).fill().map((element, index) => ".s" + index); |
| test.equal((createStyleSheet(selectors).match(/\n/g) || []).length, |
| Math.ceil(50000 / selectorGroupSize), |
| "Style sheet should be split up into rules with at most " + |
| selectorGroupSize + " selectors each"); |
| + test.equal( |
| + createStyleSheet([ |
| + "html", "#foo", ".bar", "#foo .bar", "#foo > .bar", |
| + "#foo[data-bar='{foo: 1}']" |
| + ]), |
| + "html, #foo, .bar, #foo .bar, #foo > .bar, " + |
| + "#foo[data-bar='\\7B foo: 1\\7D '] {display: none !important;}\n", |
| + "Braces should be escaped" |
| + ); |
| + |
| test.done(); |
| }; |
| exports.testRulesFromStyleSheet = function(test) |
| { |
| // Note: The rulesFromStyleSheet function assumes that each rule will be |
| // terminated with a newline character, including the last rule. If this is |
| // not the case, the function goes into an infinite loop. It should only be |