| OLD | NEW |
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 test.equal(selectors.selectorAt(1), ".foo"); | 80 test.equal(selectors.selectorAt(1), ".foo"); |
| 81 test.equal(selectors.filterKeyAt(1), "example.com##.foo"); | 81 test.equal(selectors.filterKeyAt(1), "example.com##.foo"); |
| 82 })(elemHide.getSelectorsForDomain("example.com", 0)); | 82 })(elemHide.getSelectorsForDomain("example.com", 0)); |
| 83 | 83 |
| 84 withNAD(0, filter3 => | 84 withNAD(0, filter3 => |
| 85 { | 85 { |
| 86 elemHide.add(filter3); | 86 elemHide.add(filter3); |
| 87 | 87 |
| 88 withNAD( | 88 withNAD( |
| 89 0, selectors => | 89 0, selectors => |
| 90 test.equal(selectors.selectorCount, 3))( | 90 { |
| 91 test.equal(selectors.selectorCount, 3); |
| 92 test.equal(selectors.selectorAt(0), "#ads"); |
| 93 test.equal(selectors.selectorAt(1), ".message"); |
| 94 test.equal(selectors.selectorAt(2), ".foo"); |
| 95 })( |
| 91 elemHide.getSelectorsForDomain("example.com", 0)); | 96 elemHide.getSelectorsForDomain("example.com", 0)); |
| 92 | 97 |
| 93 withNAD( | 98 withNAD( |
| 94 0, selectors => | 99 0, selectors => |
| 95 test.equal(selectors.selectorCount, 3))( | 100 { |
| 101 test.equal(selectors.selectorCount, 3); |
| 102 test.equal(selectors.selectorAt(0), "#ads"); |
| 103 test.equal(selectors.selectorAt(1), ".message"); |
| 104 test.equal(selectors.selectorAt(2), ".foo"); |
| 105 })( |
| 96 elemHide.getSelectorsForDomain("mail.example.com", 0)); | 106 elemHide.getSelectorsForDomain("mail.example.com", 0)); |
| 97 | 107 |
| 98 withNAD(0, filter4 => | 108 withNAD(0, filter4 => |
| 99 { | 109 { |
| 100 elemHide.add(filter4); | 110 elemHide.add(filter4); |
| 101 withNAD( | 111 withNAD( |
| 102 0, selectors => | 112 0, selectors => |
| 103 test.equal(selectors.selectorCount, 3))( | 113 { |
| 114 test.equal(selectors.selectorCount, 3); |
| 115 test.equal(selectors.selectorAt(0), "#ads"); |
| 116 test.equal(selectors.selectorAt(1), ".message"); |
| 117 test.equal(selectors.selectorAt(2), ".foo"); |
| 118 })( |
| 104 elemHide.getSelectorsForDomain("example.com", 0)); | 119 elemHide.getSelectorsForDomain("example.com", 0)); |
| 105 | 120 |
| 106 withNAD( | 121 withNAD( |
| 107 0, selectors => | 122 0, selectors => |
| 108 test.equal(selectors.selectorCount, 2))( | 123 { |
| 124 test.equal(selectors.selectorCount, 2); |
| 125 test.equal(selectors.selectorAt(0), "#ads"); |
| 126 test.equal(selectors.selectorAt(1), ".foo"); |
| 127 })( |
| 109 elemHide.getSelectorsForDomain("mail.example.com", 0)); | 128 elemHide.getSelectorsForDomain("mail.example.com", 0)); |
| 110 | 129 |
| 111 withNAD( | 130 withNAD( |
| 112 0, | 131 0, |
| 113 unconditionals => | 132 unconditionals => |
| 114 test.equal(unconditionals.selectorCount, 1))(elemHide.getUncondition
alSelectors()); | 133 { |
| 134 test.equal(unconditionals.selectorCount, 1); |
| 135 test.equal(unconditionals.selectorAt(0), "#ads"); |
| 136 })(elemHide.getUnconditionalSelectors()); |
| 115 | 137 |
| 116 elemHide.remove(filter4); | 138 elemHide.remove(filter4); |
| 117 })(Filter.fromText("mail.example.com#@#.message")); | 139 })(Filter.fromText("mail.example.com#@#.message")); |
| 118 | 140 |
| 119 withNAD( | 141 withNAD( |
| 120 0, selectors => | 142 0, selectors => |
| 121 test.equal(selectors.selectorCount, 3))( | 143 { |
| 122 elemHide.getSelectorsForDomain("example.com", 0)); | 144 test.equal(selectors.selectorCount, 3); |
| 145 test.equal(selectors.selectorAt(0), "#ads"); |
| 146 test.equal(selectors.selectorAt(1), ".message"); |
| 147 test.equal(selectors.selectorAt(2), ".foo"); |
| 148 })(elemHide.getSelectorsForDomain("example.com", 0)); |
| 123 | 149 |
| 124 withNAD( | 150 withNAD( |
| 125 0, selectors => | 151 0, selectors => |
| 126 test.equal(selectors.selectorCount, 3))( | 152 { |
| 127 elemHide.getSelectorsForDomain("mail.example.com", 0)); | 153 test.equal(selectors.selectorCount, 3); |
| 154 test.equal(selectors.selectorAt(0), "#ads"); |
| 155 test.equal(selectors.selectorAt(1), ".message"); |
| 156 test.equal(selectors.selectorAt(2), ".foo"); |
| 157 })(elemHide.getSelectorsForDomain("mail.example.com", 0)); |
| 128 | 158 |
| 129 elemHide.remove(filter3); | 159 elemHide.remove(filter3); |
| 130 })(Filter.fromText("example.com##.message")); | 160 })(Filter.fromText("example.com##.message")); |
| 131 | 161 |
| 132 withNAD( | 162 withNAD( |
| 133 0, selectors => | 163 0, selectors => |
| 134 test.equal(selectors.selectorCount, 2))( | 164 test.equal(selectors.selectorCount, 2))( |
| 135 elemHide.getSelectorsForDomain("example.com", 0)); | 165 elemHide.getSelectorsForDomain("example.com", 0)); |
| 136 })(ElemHide.create()); | 166 })(ElemHide.create()); |
| 137 | 167 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 "www.example.com", | 290 "www.example.com", |
| 261 [] | 291 [] |
| 262 ); | 292 ); |
| 263 })(Filter.fromText("example.com##filter1"), | 293 })(Filter.fromText("example.com##filter1"), |
| 264 Filter.fromText("www.example.com##filter2"), | 294 Filter.fromText("www.example.com##filter2"), |
| 265 Filter.fromText("other.example.com##filter3")); | 295 Filter.fromText("other.example.com##filter3")); |
| 266 })(ElemHide.create(), ElemHideEmulation.create()); | 296 })(ElemHide.create(), ElemHideEmulation.create()); |
| 267 | 297 |
| 268 test.done(); | 298 test.done(); |
| 269 }; | 299 }; |
| OLD | NEW |