| LEFT | RIGHT |
| 1 (function() | 1 (function() |
| 2 { | 2 { |
| 3 let server = null; | 3 let server = null; |
| 4 let frame = null; | 4 let frame = null; |
| 5 | 5 |
| 6 module("Element hiding", { | 6 module("Element hiding", { |
| 7 setup: function() | 7 setup: function() |
| 8 { | 8 { |
| 9 prepareFilterComponents.call(this); | 9 prepareFilterComponents.call(this); |
| 10 preparePrefs.call(this); | 10 preparePrefs.call(this); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 [["##div#test1", "@@localhost$generichide"], ["visible", "visible"]], | 111 [["##div#test1", "@@localhost$generichide"], ["visible", "visible"]], |
| 112 [["##div#test1", "@@localhost$genericblock"], ["hidden", "visible"]], | 112 [["##div#test1", "@@localhost$genericblock"], ["hidden", "visible"]], |
| 113 [["localhost##div#test1", "@@localhost$generichide"], ["hidden", "visible"]]
, | 113 [["localhost##div#test1", "@@localhost$generichide"], ["hidden", "visible"]]
, |
| 114 [["~example.com##div#test1", "@@localhost$generichide"], ["visible", "visibl
e"]], | 114 [["~example.com##div#test1", "@@localhost$generichide"], ["visible", "visibl
e"]], |
| 115 [["~example.com##div#test1", "@@localhost$genericblock"], ["hidden", "visibl
e"]], | 115 [["~example.com##div#test1", "@@localhost$genericblock"], ["hidden", "visibl
e"]], |
| 116 [["~example.com,localhost##div#test1", "@@localhost$generichide"], ["hidden"
, "visible"]], | 116 [["~example.com,localhost##div#test1", "@@localhost$generichide"], ["hidden"
, "visible"]], |
| 117 ]; | 117 ]; |
| 118 | 118 |
| 119 function runTest([filters, expected], stage) | 119 function runTest([filters, expected], stage) |
| 120 { | 120 { |
| 121 for (let filter_text of filters) | 121 for (let filterText of filters) |
| 122 FilterStorage.addFilter(Filter.fromText(filter_text)); | 122 FilterStorage.addFilter(Filter.fromText(filterText)); |
| 123 | 123 |
| 124 if (stage == 2) | 124 if (stage == 2) |
| 125 FilterStorage.addFilter(Filter.fromText("@@||localhost^$document")); | 125 FilterStorage.addFilter(Filter.fromText("@@||localhost^$document")); |
| 126 else if (stage == 3) | 126 else if (stage == 3) |
| 127 FilterStorage.addFilter(Filter.fromText("@@||localhost^$~document")); | 127 FilterStorage.addFilter(Filter.fromText("@@||localhost^$~document")); |
| 128 else if (stage == 4) | 128 else if (stage == 4) |
| 129 FilterStorage.addFilter(Filter.fromText("@@||localhost^$elemhide")); | 129 FilterStorage.addFilter(Filter.fromText("@@||localhost^$elemhide")); |
| 130 | 130 |
| 131 // Second and forth runs are whitelisted, nothing should be hidden | 131 // Second and forth runs are whitelisted, nothing should be hidden |
| 132 if (stage == 2 || stage == 4) | 132 if (stage == 2 || stage == 4) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 4: "running with element hiding exception", | 170 4: "running with element hiding exception", |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 for (let test = 0; test < tests.length; test++) | 173 for (let test = 0; test < tests.length; test++) |
| 174 { | 174 { |
| 175 let [filters, expected] = tests[test]; | 175 let [filters, expected] = tests[test]; |
| 176 for (let stage = 1; stage in stageDescriptions; stage++) | 176 for (let stage = 1; stage in stageDescriptions; stage++) |
| 177 asyncTest(filters.join(", ") + " (" + stageDescriptions[stage] + ")", runT
est.bind(null, tests[test], stage)); | 177 asyncTest(filters.join(", ") + " (" + stageDescriptions[stage] + ")", runT
est.bind(null, tests[test], stage)); |
| 178 } | 178 } |
| 179 })(); | 179 })(); |
| LEFT | RIGHT |