Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 addFilter("##hello"); | 177 addFilter("##hello"); |
178 addFilter("~example.com##world"); | 178 addFilter("~example.com##world"); |
179 addFilter("foo.com##specific"); | 179 addFilter("foo.com##specific"); |
180 testResult("foo.com", ["specific"], ElemHide.SPECIFIC_ONLY); | 180 testResult("foo.com", ["specific"], ElemHide.SPECIFIC_ONLY); |
181 testResult("foo.com", ["specific", "world"], ElemHide.NO_UNCONDITIONAL); | 181 testResult("foo.com", ["specific", "world"], ElemHide.NO_UNCONDITIONAL); |
182 testResult("foo.com", ["hello", "specific", "world"], ElemHide.ALL_MATCHING); | 182 testResult("foo.com", ["hello", "specific", "world"], ElemHide.ALL_MATCHING); |
183 testResult("foo.com", ["hello", "specific", "world"]); | 183 testResult("foo.com", ["hello", "specific", "world"]); |
184 removeFilter("foo.com##specific"); | 184 removeFilter("foo.com##specific"); |
185 removeFilter("~example.com##world"); | 185 removeFilter("~example.com##world"); |
186 removeFilter("##hello"); | 186 removeFilter("##hello"); |
187 testResult("foo.com", []); | |
188 | |
189 addFilter("##hello"); | |
190 testResult("foo.com", [], ElemHide.SPECIFIC_ONLY); | |
191 testResult("foo.com", [], ElemHide.NO_UNCONDITIONAL); | |
192 testResult("foo.com", ["hello"], ElemHide.ALL_MATCHING); | |
193 testResult("foo.com", ["hello"]); | |
194 testResult("bar.com", [], ElemHide.SPECIFIC_ONLY); | |
195 testResult("bar.com", [], ElemHide.NO_UNCONDITIONAL); | |
196 testResult("bar.com", ["hello"], ElemHide.ALL_MATCHING); | |
197 testResult("bar.com", ["hello"]); | |
198 addFilter("foo.com#@#hello"); | |
199 testResult("foo.com", [], ElemHide.SPECIFIC_ONLY); | |
200 testResult("foo.com", [], ElemHide.NO_UNCONDITIONAL); | |
201 testResult("foo.com", [], ElemHide.ALL_MATCHING); | |
202 testResult("foo.com", []); | |
203 testResult("bar.com", [], ElemHide.SPECIFIC_ONLY); | |
204 testResult("bar.com", ["hello"], ElemHide.NO_UNCONDITIONAL); | |
205 testResult("bar.com", ["hello"], ElemHide.ALL_MATCHING); | |
206 testResult("bar.com", ["hello"]); | |
207 removeFilter("foo.com#@#hello"); | |
208 testResult("foo.com", [], ElemHide.SPECIFIC_ONLY); | |
209 // Note: We don't take care to track conditional selectors which became | |
210 // unconditional when a filter was removed. This was too expensive. | |
211 //testResult("foo.com", [], ElemHide.NO_UNCONDITIONAL); | |
212 testResult("foo.com", ["hello"], ElemHide.ALL_MATCHING); | |
213 testResult("foo.com", ["hello"]); | |
214 testResult("bar.com", [], ElemHide.SPECIFIC_ONLY); | |
215 testResult("bar.com", ["hello"], ElemHide.NO_UNCONDITIONAL); | |
216 testResult("bar.com", ["hello"], ElemHide.ALL_MATCHING); | |
217 testResult("bar.com", ["hello"]); | |
218 removeFilter("##hello"); | |
219 testResult("foo.com", []); | |
220 testResult("bar.com", []); | |
187 | 221 |
188 addFilter("##hello"); | 222 addFilter("##hello"); |
189 addFilter("foo.com##hello"); | 223 addFilter("foo.com##hello"); |
190 testResult("foo.com", ["hello"]); | 224 testResult("foo.com", ["hello"]); |
191 removeFilter("foo.com##hello"); | 225 removeFilter("foo.com##hello"); |
192 testResult("foo.com", ["hello"]); | 226 testResult("foo.com", ["hello"]); |
193 removeFilter("##hello"); | 227 removeFilter("##hello"); |
Wladimir Palant
2016/09/26 14:56:54
How about:
testResult("foo.com", []);
This is
kzar
2016/09/27 12:40:22
Done.
| |
228 testResult("foo.com", []); | |
194 | 229 |
195 addFilter("##hello"); | 230 addFilter("##hello"); |
196 addFilter("foo.com##hello"); | 231 addFilter("foo.com##hello"); |
197 testResult("foo.com", ["hello"]); | 232 testResult("foo.com", ["hello"]); |
198 removeFilter("##hello"); | 233 removeFilter("##hello"); |
199 testResult("foo.com", ["hello"]); | 234 testResult("foo.com", ["hello"]); |
200 removeFilter("foo.com##hello"); | 235 removeFilter("foo.com##hello"); |
Wladimir Palant
2016/09/26 14:56:54
Same here, how about testing the final state?
kzar
2016/09/27 12:40:22
Done.
| |
236 testResult("foo.com", []); | |
201 | 237 |
Wladimir Palant
2016/09/26 14:56:54
How about testing the combination of ##hello and f
kzar
2016/09/27 12:40:22
Done.
| |
202 // Advanced filter keys test | 238 // Advanced filter keys test |
203 testResult("", []); | 239 testResult("", []); |
204 addFilter("##dupe"); | 240 addFilter("##dupe"); |
205 addFilter(",,##dupe"); | 241 addFilter(",,##dupe"); |
206 addFilter(",,,##dupe"); | 242 addFilter(",,,##dupe"); |
207 addFilter("foo.com##dupe"); | 243 addFilter("foo.com##dupe"); |
208 testResult("", ["dupe"]); | 244 testResult("", ["dupe"]); |
209 removeFilter(",,,##dupe"); | 245 removeFilter(",,,##dupe"); |
210 testResult("", ["dupe"]); | 246 testResult("", ["dupe"]); |
211 removeFilter("foo.com##dupe"); | 247 removeFilter("foo.com##dupe"); |
212 testResult("", ["dupe"]); | 248 testResult("", ["dupe"]); |
213 removeFilter(",,##dupe"); | 249 removeFilter(",,##dupe"); |
214 testResult("", ["dupe"]); | 250 testResult("", ["dupe"]); |
215 removeFilter("##dupe"); | 251 removeFilter("##dupe"); |
216 testResult("", []); | 252 testResult("", []); |
217 | 253 |
218 test.done(); | 254 test.done(); |
219 }; | 255 }; |
LEFT | RIGHT |