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