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

Delta Between Two Patch Sets: chrome/content/tests/cssRules.js

Issue 29324604: Issue 2394 - Added unit tests for CSS property filters (Closed)
Left Patch Set: Created Dec. 3, 2015, 12:51 p.m.
Right Patch Set: Created Dec. 7, 2015, 5:21 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 | « chrome/content/common.js ('k') | chrome/content/tests/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 (function() 1 (function()
2 { 2 {
3 module("CSS property filter", { 3 module("CSS property filter", {
4 setup: function() 4 setup: function()
5 { 5 {
6 prepareFilterComponents.call(this); 6 prepareFilterComponents.call(this);
7 preparePrefs.call(this); 7 preparePrefs.call(this);
8 }, 8 },
9 teardown: function() 9 teardown: function()
10 { 10 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 function compareRules(text, domain, expected) 48 function compareRules(text, domain, expected)
49 { 49 {
50 let result = CSSRules.getRulesForDomain(domain) 50 let result = CSSRules.getRulesForDomain(domain)
51 .map((filter) => filter.text); 51 .map((filter) => filter.text);
52 expected = expected.map((filter) => filter.text); 52 expected = expected.map((filter) => filter.text);
53 deepEqual(result.sort(), expected.sort(), text); 53 deepEqual(result.sort(), expected.sort(), text);
54 } 54 }
55 55
56 test("CSS property filters container", function() 56 test("CSS property filters container", function()
57 { 57 {
58 let genericFilter = Filter.fromText("##filter1"); 58 let domainFilter = Filter.fromText("example.com##filter1");
Wladimir Palant 2015/12/04 13:09:48 This comment hasn't been addressed from the previo
Thomas Greiner 2015/12/07 17:29:26 Done.
59 let domainFilter = Filter.fromText("example.com##filter2"); 59 let subdomainFilter = Filter.fromText("www.example.com##filter2");
60 let subdomainFilter = Filter.fromText("www.example.com##filter3"); 60 let otherDomainFilter = Filter.fromText("other.example.com##filter3");
61 let otherDomainFilter = Filter.fromText("other.example.com##filter4");
62 61
63 CSSRules.add(genericFilter);
64 CSSRules.add(domainFilter); 62 CSSRules.add(domainFilter);
65 CSSRules.add(subdomainFilter); 63 CSSRules.add(subdomainFilter);
66 CSSRules.add(otherDomainFilter); 64 CSSRules.add(otherDomainFilter);
67 compareRules("Return all matching filters", "www.example.com", 65 compareRules("Return all matching filters", "www.example.com",
68 [genericFilter, domainFilter, subdomainFilter]); 66 [domainFilter, subdomainFilter]);
69 67
70 CSSRules.remove(genericFilter); 68 CSSRules.remove(domainFilter);
71 compareRules("Return all matching filters after removing one", 69 compareRules("Return all matching filters after removing one",
72 "www.example.com", [domainFilter, subdomainFilter]); 70 "www.example.com", [subdomainFilter]);
73 71
74 CSSRules.clear(); 72 CSSRules.clear();
75 compareRules("Return no filters after clearing", "www.example.com", []); 73 compareRules("Return no filters after clearing", "www.example.com", []);
76 }); 74 });
77 })(); 75 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld