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

Unified Diff: qunit/tests/cssEscaping.js

Issue 5989801094283264: Issue 1587 - Escape curly brackets for elemhide filters (Closed)
Patch Set: Created Nov. 20, 2014, 2:03 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include.postload.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: qunit/tests/cssEscaping.js
===================================================================
--- a/qunit/tests/cssEscaping.js
+++ b/qunit/tests/cssEscaping.js
@@ -18,6 +18,8 @@
}.bind(this));
document.body.appendChild(frame);
+
+ this.filterClasses = require("filterClasses");
Wladimir Palant 2014/11/20 14:33:05 As with the other review, no point having this in
Sebastian Noack 2014/11/20 15:47:27 Done, using an IFEE.
}
}
);
@@ -27,6 +29,9 @@
var escapeCSS = this.escapeCSS;
var quote = this.quote;
+ var Filter = this.filterClasses.Filter;
+ var ElemHideFilter = this.filterClasses.ElemHideFilter;
+
function testSelector(opts)
{
var mustMatch = opts.mustMatch !== false;
@@ -59,10 +64,19 @@
}
var foundElement = doc.querySelector(opts.selector);
- if (mustMatch)
- equal(foundElement, element, opts.selector);
+ var filter = Filter.fromText("##" + opts.selector);
+
+ if (!(filter instanceof ElemHideFilter))
+ {
+ ok(false, opts.selector + " (not allowed in elemhide filters)");
Wladimir Palant 2014/11/20 14:33:05 There are very few cases where code like this is j
Sebastian Noack 2014/11/20 15:47:27 So far testSelector() only generates one assert pe
Wladimir Palant 2014/11/20 17:01:20 Not sure I agree but not really that important...
+ }
else
- ok(true, opts.selector);
+ {
+ if (mustMatch)
+ equal(foundElement, element, opts.selector);
+ else
+ ok(true, opts.selector);
+ }
}
function testEscape(s)
« no previous file with comments | « include.postload.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld