Diffstat (limited to 'frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html b/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html index 7fe9a84..87cde0f 100644 --- a/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html +++ b/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html | |||
@@ -1,152 +1,149 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | --> | 24 | --> |
28 | 25 | ||
29 | <html> | 26 | <html> |
30 | <head> | 27 | <head> |
31 | <script type="text/javascript" src="../../../js/MochiKit/MochiKit.js"></script> | 28 | <script type="text/javascript" src="../../../js/MochiKit/MochiKit.js"></script> |
32 | <script type="text/javascript" src="../../../js/JSLog/jslog.js"></script> | 29 | <script type="text/javascript" src="../../../js/JSLog/jslog.js"></script> |
33 | <script type="text/javascript" src="../../SimpleTest/SimpleTest.js"></script> | 30 | <script type="text/javascript" src="../../SimpleTest/SimpleTest.js"></script> |
34 | <link rel="stylesheet" type="text/css" href="../../SimpleTest/test.css"> | 31 | <link rel="stylesheet" type="text/css" href="../../SimpleTest/test.css"> |
35 | 32 | ||
36 | <script type='text/javascript' src='../../../js/Clipperz/YUI/Utils.js'></script> | 33 | <script type='text/javascript' src='../../../js/Clipperz/YUI/Utils.js'></script> |
37 | <script type='text/javascript' src='../../../js/Clipperz/Base.js'></script> | 34 | <script type='text/javascript' src='../../../js/Clipperz/Base.js'></script> |
38 | <script type='text/javascript' src='../../../js/Clipperz/Async.js'></script> | 35 | <script type='text/javascript' src='../../../js/Clipperz/Async.js'></script> |
39 | <script type='text/javascript' src='../../../js/Clipperz/KeePassExportProcessor.js'></script> | 36 | <script type='text/javascript' src='../../../js/Clipperz/KeePassExportProcessor.js'></script> |
40 | 37 | ||
41 | <script type="text/javascript" src="../../SimpleTest/SimpleTest.Async.js"></script> | 38 | <script type="text/javascript" src="../../SimpleTest/SimpleTest.Async.js"></script> |
42 | </head> | 39 | </head> |
43 | <body> | 40 | <body> |
44 | <pre id="test"> | 41 | <pre id="test"> |
45 | <script type="text/javascript"> | 42 | <script type="text/javascript"> |
46 | try { | 43 | try { |
47 | var deferredResult; | 44 | var deferredResult; |
48 | varkeePassProcessor; | 45 | varkeePassProcessor; |
49 | 46 | ||
50 | keePassProcessor = new Clipperz.KeePassExportProcessor(); | 47 | keePassProcessor = new Clipperz.KeePassExportProcessor(); |
51 | 48 | ||
52 | deferredResult = new MochiKit.Async.Deferred(); | 49 | deferredResult = new MochiKit.Async.Deferred(); |
53 | 50 | ||
54 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\n" }); | 51 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\n" }); |
55 | deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); | 52 | deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); |
56 | deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\"}]", "first test"); }); | 53 | deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\"}]", "first test"); }); |
57 | deferredResult.addErrback(function(anError) { is("ERROR", anError) }); | 54 | deferredResult.addErrback(function(anError) { is("ERROR", anError) }); |
58 | 55 | ||
59 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\nNotes: Personal account\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\nNotes: social bookmarking site\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\nNotes: The US online store\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\nNotes: Linked to my savings account\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\nNotes: Blog ranking and searching\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\nNotes: Adavantages card n. 795495\n" }); | 56 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\nNotes: Personal account\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\nNotes: social bookmarking site\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\nNotes: The US online store\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\nNotes: Linked to my savings account\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\nNotes: Blog ranking and searching\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\nNotes: Adavantages card n. 795495\n" }); |
60 | deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); | 57 | deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); |
61 | deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\", \"Notes\":\"Personal account\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\", \"Notes\":\"social bookmarking site\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\", \"Notes\":\"The US online store\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\", \"Notes\":\"Linked to my savings account\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\", \"Notes\":\"Blog ranking and searching\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\", \"Notes\":\"Adavantages card n. 795495\"}]", "second test"); }); | 58 | deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\", \"Notes\":\"Personal account\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\", \"Notes\":\"social bookmarking site\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\", \"Notes\":\"The US online store\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\", \"Notes\":\"Linked to my savings account\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\", \"Notes\":\"Blog ranking and searching\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\", \"Notes\":\"Adavantages card n. 795495\"}]", "second test"); }); |
62 | deferredResult.addErrback(function(anError) { is("ERROR", anError) }); | 59 | deferredResult.addErrback(function(anError) { is("ERROR", anError) }); |
63 | 60 | ||
64 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\nNotes: Personal account\nwith some notes stored\non multiple lines\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\nNotes: social bookmarking site\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\nNotes: The US online store\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\nNotes: Linked to my savings account\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\nNotes: Blog ranking and searching\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\nNotes: Adavantages card n. 795495\n" }); | 61 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\nNotes: Personal account\nwith some notes stored\non multiple lines\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\nNotes: social bookmarking site\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\nNotes: The US online store\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\nNotes: Linked to my savings account\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\nNotes: Blog ranking and searching\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\nNotes: Adavantages card n. 795495\n" }); |
65 | deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); | 62 | deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); |
66 | deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\", \"Notes\":\"Personal account\\nwith some notes stored\\non multiple lines\\n\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\", \"Notes\":\"social bookmarking site\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\", \"Notes\":\"The US online store\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\", \"Notes\":\"Linked to my savings account\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\", \"Notes\":\"Blog ranking and searching\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\", \"Notes\":\"Adavantages card n. 795495\"}]", "third test"); }); | 63 | deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\", \"Notes\":\"Personal account\\nwith some notes stored\\non multiple lines\\n\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\", \"Notes\":\"social bookmarking site\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\", \"Notes\":\"The US online store\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\", \"Notes\":\"Linked to my savings account\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\", \"Notes\":\"Blog ranking and searching\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\", \"Notes\":\"Adavantages card n. 795495\"}]", "third test"); }); |
67 | deferredResult.addErrback(function(anError) { is("ERROR", anError) }); | 64 | deferredResult.addErrback(function(anError) { is("ERROR", anError) }); |
68 | 65 | ||
69 | 66 | ||
70 | 67 | ||
71 | deferredResult.addBoth(SimpleTest.finish); | 68 | deferredResult.addBoth(SimpleTest.finish); |
72 | deferredResult.callback(); | 69 | deferredResult.callback(); |
73 | 70 | ||
74 | /* | 71 | /* |
75 | var set; | 72 | var set; |
76 | varobject1; | 73 | varobject1; |
77 | varobject2; | 74 | varobject2; |
78 | var object3; | 75 | var object3; |
79 | 76 | ||
80 | set = new Clipperz.Set(); | 77 | set = new Clipperz.Set(); |
81 | 78 | ||
82 | object1 = new Object(); | 79 | object1 = new Object(); |
83 | object2 = new Object(); | 80 | object2 = new Object(); |
84 | object3 = new Object(); | 81 | object3 = new Object(); |
85 | 82 | ||
86 | object1.label = "object 1"; | 83 | object1.label = "object 1"; |
87 | object2.label = "object 2"; | 84 | object2.label = "object 2"; |
88 | object3.label = "object 3"; | 85 | object3.label = "object 3"; |
89 | 86 | ||
90 | is(set.size(), 0, "A new set should be empty"); | 87 | is(set.size(), 0, "A new set should be empty"); |
91 | 88 | ||
92 | set.add(object1); | 89 | set.add(object1); |
93 | is(set.size(), 1); | 90 | is(set.size(), 1); |
94 | is(set.contains(object1), true); | 91 | is(set.contains(object1), true); |
95 | is(set.contains(object2), false); | 92 | is(set.contains(object2), false); |
96 | 93 | ||
97 | set.add(object1); | 94 | set.add(object1); |
98 | is(set.size(), 1, "Adding the same object twice does not change the set content"); | 95 | is(set.size(), 1, "Adding the same object twice does not change the set content"); |
99 | is(set.contains(object1), true); | 96 | is(set.contains(object1), true); |
100 | is(set.contains(object2), false); | 97 | is(set.contains(object2), false); |
101 | 98 | ||
102 | set.add(object2); | 99 | set.add(object2); |
103 | is(set.size(), 2); | 100 | is(set.size(), 2); |
104 | is(set.contains(object1), true); | 101 | is(set.contains(object1), true); |
105 | is(set.contains(object2), true); | 102 | is(set.contains(object2), true); |
106 | is(set.contains(object3), false); | 103 | is(set.contains(object3), false); |
107 | 104 | ||
108 | set.remove(object1); | 105 | set.remove(object1); |
109 | is(set.size(), 1, "Size check after removing an object"); | 106 | is(set.size(), 1, "Size check after removing an object"); |
110 | is(set.contains(object1), false); | 107 | is(set.contains(object1), false); |
111 | is(set.contains(object2), true); | 108 | is(set.contains(object2), true); |
112 | is(set.contains(object3), false); | 109 | is(set.contains(object3), false); |
113 | 110 | ||
114 | set.remove(object1); | 111 | set.remove(object1); |
115 | is(set.size(), 1, "Removing twice the same object does not change the set content"); | 112 | is(set.size(), 1, "Removing twice the same object does not change the set content"); |
116 | is(set.contains(object1), false); | 113 | is(set.contains(object1), false); |
117 | is(set.contains(object2), true); | 114 | is(set.contains(object2), true); |
118 | is(set.contains(object3), false); | 115 | is(set.contains(object3), false); |
119 | 116 | ||
120 | set.empty(); | 117 | set.empty(); |
121 | is(set.size(), 0); | 118 | is(set.size(), 0); |
122 | 119 | ||
123 | { | 120 | { |
124 | varitems; | 121 | varitems; |
125 | varpopulatedSet; | 122 | varpopulatedSet; |
126 | 123 | ||
127 | items = ["item1", "item2", "item3"]; | 124 | items = ["item1", "item2", "item3"]; |
128 | 125 | ||
129 | populatedSet = new Clipperz.Set({'items': items}); | 126 | populatedSet = new Clipperz.Set({'items': items}); |
130 | is(populatedSet.size(), 3); | 127 | is(populatedSet.size(), 3); |
131 | is(populatedSet.contains("item1"), true); | 128 | is(populatedSet.contains("item1"), true); |
132 | is(populatedSet.contains("item4"), false); | 129 | is(populatedSet.contains("item4"), false); |
133 | 130 | ||
134 | items.splice(0, items.length); | 131 | items.splice(0, items.length); |
135 | is(populatedSet.size(), 3); | 132 | is(populatedSet.size(), 3); |
136 | } | 133 | } |
137 | 134 | ||
138 | { | 135 | { |
139 | varitems; | 136 | varitems; |
140 | vardeletedItems; | 137 | vardeletedItems; |
141 | 138 | ||
142 | items = ["item1", "item2", "item3"]; | 139 | items = ["item1", "item2", "item3"]; |
143 | 140 | ||
144 | set = new Clipperz.Set({'items': items}); | 141 | set = new Clipperz.Set({'items': items}); |
145 | deletedItems = ["item1"]; | 142 | deletedItems = ["item1"]; |
146 | set.remove(deletedItems); | 143 | set.remove(deletedItems); |
147 | is(set.size(), 2, "here I am"); | 144 | is(set.size(), 2, "here I am"); |
148 | is(set.contains("item1"), false); | 145 | is(set.contains("item1"), false); |
149 | is(set.contains("item2"), true); | 146 | is(set.contains("item2"), true); |
150 | 147 | ||
151 | set = new Clipperz.Set({'items': items}); | 148 | set = new Clipperz.Set({'items': items}); |
152 | deletedItems = ["item1", "item2"]; | 149 | deletedItems = ["item1", "item2"]; |