OLD | NEW |
1 (function() | 1 (function() |
2 { | 2 { |
3 module("Subscription classes", {setup: prepareFilterComponents, teardown: rest
oreFilterComponents}); | 3 module("Subscription classes", {setup: prepareFilterComponents, teardown: rest
oreFilterComponents}); |
4 | 4 |
5 function compareSubscription(url, expected, postInit) | 5 function compareSubscription(url, expected, postInit) |
6 { | 6 { |
7 expected.push("[Subscription]") | 7 expected.push("[Subscription]") |
8 let subscription = Subscription.fromURL(url); | 8 let subscription = Subscription.fromURL(url); |
9 if (postInit) | 9 if (postInit) |
10 postInit(subscription) | 10 postInit(subscription) |
11 let result = []; | 11 let result = []; |
12 subscription.serialize(result); | 12 subscription.serialize(result); |
13 equal(result.sort().join("\n"), expected.sort().join("\n"), url); | 13 equal(result.sort().join("\n"), expected.sort().join("\n"), url); |
14 | 14 |
15 let map = {__proto__: null}; | 15 let map = {__proto__: null}; |
16 for each (let line in result.slice(1)) | 16 for (let line of result.slice(1)) |
17 { | 17 { |
18 if (/(.*?)=(.*)/.test(line)) | 18 if (/(.*?)=(.*)/.test(line)) |
19 map[RegExp.$1] = RegExp.$2; | 19 map[RegExp.$1] = RegExp.$2; |
20 } | 20 } |
21 let subscription2 = Subscription.fromObject(map); | 21 let subscription2 = Subscription.fromObject(map); |
22 equal(subscription.toString(), subscription2.toString(), url + " deserializa
tion"); | 22 equal(subscription.toString(), subscription2.toString(), url + " deserializa
tion"); |
23 } | 23 } |
24 | 24 |
25 test("Subscription class definitions", function() | 25 test("Subscription class definitions", function() |
26 { | 26 { |
(...skipping 28 matching lines...) Expand all Loading... |
55 subscription.version = 24 | 55 subscription.version = 24 |
56 subscription.requiredVersion = "0.6"; | 56 subscription.requiredVersion = "0.6"; |
57 }); | 57 }); |
58 compareSubscription("~wl~", ["url=~wl~", "disabled=true", "title=Test group"
], function(subscription) | 58 compareSubscription("~wl~", ["url=~wl~", "disabled=true", "title=Test group"
], function(subscription) |
59 { | 59 { |
60 subscription.title = "Test group"; | 60 subscription.title = "Test group"; |
61 subscription.disabled = true; | 61 subscription.disabled = true; |
62 }); | 62 }); |
63 }); | 63 }); |
64 })(); | 64 })(); |
OLD | NEW |