| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-present eyeo GmbH | |
| 4 * | |
| 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 | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 18 "use strict"; | |
| 19 | |
| 20 { | |
| 21 let {chooseFilterSubscriptions} = require("../../lib/subscriptionInit"); | |
| 22 | |
| 23 QUnit.module("Subscription", { | |
| 24 setup() | |
| 25 { | |
| 26 let {Utils} = require("../../lib/utils"); | |
| 27 Object.defineProperty(Utils, "appLocale", | |
| 28 {value: "en", enumerable: true}); | |
| 29 }, | |
| 30 | |
| 31 teardown() | |
| 32 { | |
| 33 // TODO restore appLocale | |
|
Manish Jethani
2018/06/14 05:07:34
We don't normally leave "todo" comments in the cod
hub
2018/06/14 19:59:57
I had forgotten to remove it, done.
| |
| 34 } | |
| 35 }); | |
| 36 | |
| 37 | |
| 38 test("Choosing filter subscriptions", assert => | |
| 39 { | |
| 40 let done = assert.async(); | |
| 41 fetch("subscriptions.xml") | |
| 42 .then(response => response.text()) | |
| 43 .then(text => | |
| 44 { | |
| 45 let doc = new DOMParser().parseFromString(text, "application/xml"); | |
| 46 let nodes = doc.getElementsByTagName("subscription"); | |
| 47 | |
| 48 let subs = chooseFilterSubscriptions(nodes); | |
| 49 assert.ok(subs); | |
| 50 assert.ok(subs.circumvention); | |
| 51 assert.ok(subs.ads); | |
| 52 | |
| 53 assert.equal(subs.circumvention.getAttribute("prefixes"), "en"); | |
| 54 assert.equal(subs.circumvention.getAttribute("type"), "circumvention"); | |
| 55 assert.equal(subs.ads.getAttribute("prefixes"), "en"); | |
| 56 assert.equal(subs.ads.getAttribute("type"), "ads"); | |
| 57 | |
| 58 done(); | |
| 59 }) | |
| 60 .catch(() => | |
| 61 { | |
| 62 assert.ok(false); | |
| 63 | |
| 64 done(); | |
| 65 }); | |
| 66 }); | |
| 67 } | |
| OLD | NEW |