Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 Loading... | |
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 })(); |
LEFT | RIGHT |