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 |
| 32 |
| 33 test("Choosing filter subscriptions", assert => |
| 34 { |
| 35 let done = assert.async(); |
| 36 fetch("subscriptions.xml") |
| 37 .then(response => response.text()) |
| 38 .then(text => |
| 39 { |
| 40 let doc = new DOMParser().parseFromString(text, "application/xml"); |
| 41 let nodes = doc.getElementsByTagName("subscription"); |
| 42 |
| 43 let subs = chooseFilterSubscriptions(nodes); |
| 44 assert.ok(subs); |
| 45 assert.ok(subs.circumvention); |
| 46 assert.ok(subs.ads); |
| 47 |
| 48 assert.equal(subs.circumvention.getAttribute("prefixes"), "de,en,en-US")
; |
| 49 assert.equal(subs.circumvention.getAttribute("type"), "circumvention"); |
| 50 assert.equal(subs.ads.getAttribute("prefixes"), "en"); |
| 51 assert.equal(subs.ads.getAttribute("type"), "ads"); |
| 52 |
| 53 done(); |
| 54 }) |
| 55 .catch(() => |
| 56 { |
| 57 assert.ok(false); |
| 58 |
| 59 done(); |
| 60 }); |
| 61 }); |
| 62 } |
OLD | NEW |