Diffstat (limited to 'frontend/gamma/tests/tests/Components/CardDialogEditing/CardDialogEditing_test.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/tests/tests/Components/CardDialogEditing/CardDialogEditing_test.js | 238 |
1 files changed, 238 insertions, 0 deletions
diff --git a/frontend/gamma/tests/tests/Components/CardDialogEditing/CardDialogEditing_test.js b/frontend/gamma/tests/tests/Components/CardDialogEditing/CardDialogEditing_test.js new file mode 100644 index 0000000..21b6af6 --- a/dev/null +++ b/frontend/gamma/tests/tests/Components/CardDialogEditing/CardDialogEditing_test.js | |||
@@ -0,0 +1,238 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.Tests.CardDialogEditing'); | ||
30 | |||
31 | Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); | ||
32 | Clipperz.PM.Strings.Languages.initSetup(); | ||
33 | |||
34 | Clipperz.Tests.CardDialogEditing.Tester = function(args) { | ||
35 | args = args || {}; | ||
36 | |||
37 | Clipperz.Tests.CardDialogEditing.Tester.superclass.constructor.call(this, args); | ||
38 | //#this._user = new Clipperz.PM.DataModel.User({username:'test', getPassphraseFunction:function () { return 'test';}}); | ||
39 | this._user = new Clipperz.PM.DataModel.User({username:'joe', getPassphraseFunction:function () { return 'clipperz';}}); | ||
40 | |||
41 | return this; | ||
42 | }; | ||
43 | |||
44 | Clipperz.Base.extend(Clipperz.Tests.CardDialogEditing.Tester, Object, { | ||
45 | |||
46 | 'toString': function() { | ||
47 | return "Clipperz.Tests.CardDialogEditing.Tester"; | ||
48 | }, | ||
49 | |||
50 | //------------------------------------------------------------------------- | ||
51 | |||
52 | 'user': function () { | ||
53 | return this._user; | ||
54 | }, | ||
55 | |||
56 | //------------------------------------------------------------------------- | ||
57 | |||
58 | 'run': function () { | ||
59 | var deferredResult; | ||
60 | var proxy; | ||
61 | varcardDialogController; | ||
62 | varcardDialogComponent; | ||
63 | |||
64 | proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false}); | ||
65 | |||
66 | deferredResult = new Clipperz.Async.Deferred("CardDialogEditing_test.init", {trace:false}); | ||
67 | //# deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_offline_copy_data']); | ||
68 | deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data_newVersion']); | ||
69 | deferredResult.addMethod(this.user(), 'login'); | ||
70 | //# deferredResult.addMethod(this.user(), 'getRecord', '8280842f41162b673335b63860637e8472e8bbff0efa2bc78b0dbc5e09712e13'); | ||
71 | |||
72 | // deferredResult.addMethod(this.user(), 'getRecord', '062af892bcfba49ffcff05c56d99b7af2d508358e39c058c2e1fc83531436f80'); //Linkedin | ||
73 | // deferredResult.addMethod(this.user(), 'getRecord', '084e23120544603f0297368fd3891a3818e0fe13488e2f2c6079913c8d1bed8d'); //Example Attack | ||
74 | deferredResult.addMethod(this.user(), 'getRecord', '13a5e52976337ab210903cd04872588e1b21fb72bc183e91aa25c494b8138551'); //Amazon | ||
75 | // deferredResult.addMethod(this.user(), 'getRecord', '507f38b06d587d8889698ae1ebbba7ef8f0539b82550dd25779fd9ee88fc0c7a'); //MyBlogLog | ||
76 | // deferredResult.addMethod(this.user(), 'getRecord', '6026370f3db3860d2c46a08e389a7e906dc14f98c8444b21be9a7e9f405a2728'); //Del.icio.us | ||
77 | // deferredResult.addMethod(this.user(), 'getRecord', '6c25be8e145efb26a1abd59590522f73fb2e3dbc139af2217074d9e2ba92c16a'); //Microsoft Office Key | ||
78 | // deferredResult.addMethod(this.user(), 'getRecord', '6d45c2fec275b7482d41c76b20507100cfb6ab49922b876f9dd3040d361f4a18'); //The NewYork Times | ||
79 | // deferredResult.addMethod(this.user(), 'getRecord', '7bb69b6366a8012f181c01e368ba18d4f7a82bcabb4959189736ad124c4bbfbb'); //Web Password | ||
80 | // deferredResult.addMethod(this.user(), 'getRecord', '8b18e8593b5bc2f7ea39a5fab222047034ef2f380fee05be0fa6e1c0972fea39'); //Jaiku | ||
81 | // deferredResult.addMethod(this.user(), 'getRecord', '9dcd2a8a0fcb7e57d234dc4fea347f020a6a01793e40cf56a0d22379e590e291'); //Home Burglar Alarm | ||
82 | // deferredResult.addMethod(this.user(), 'getRecord', 'ca01bcb7691f70818feed46c9a2a91883ac543997a395535aedbb49de166690c'); //MySpace | ||
83 | // deferredResult.addMethod(this.user(), 'getRecord', 'd620764a656bfd4e1d3758500d5db72e460a0cf729d56ed1a7755b5725c50045'); //American Airlines | ||
84 | // deferredResult.addMethod(this.user(), 'getRecord', 'de13c0d036234c44214062bc0a89e5f127470c464333493a485729f43cdc26e4'); //Luftansa | ||
85 | // deferredResult.addMethod(this.user(), 'getRecord', 'eeda70e0392261967bda71c3764da78989c45bbd2bb7be6b941b90f81d9b81b5'); //Google Account | ||
86 | // deferredResult.addMethod(this.user(), 'getRecord', 'f215d89bf4583c12f5ed4f4330f488dad3fffa448f4dc784f15ef135dda2c732'); //Expedia | ||
87 | // deferredResult.addMethod(this.user(), 'getRecord', 'fe21497ef7435d31f9746c132e4b5ecf5aac5f13b5961ddb55d2bdc3409f28f6'); //Bloglines | ||
88 | |||
89 | // deferredResult.addMethod(this.user(), 'getRecord', '5cdac63b317f3942da38f3a3de3b7f0e5d6678200951c6216230295550f63fb4'); //WEB PASSWORD (0) | ||
90 | // deferredResult.addMethod(this.user(), 'getRecord', '36ec1a41118813ced3553534fa2607d781cba687768db305beed368a8e06e113'); //DIGG (1) | ||
91 | // deferredResult.addMethod(this.user(), 'getRecord', 'c0ce9130ca365bb02418d4305ea1d29e49c3f0e96d44b9d3cb6b4b6843d25065'); //SAP (2) | ||
92 | // deferredResult.addMethod(this.user(), 'getRecord', 'd5f700b9c3367c39551ea49e00a9ab20dae09dd79d46047b983fc7c4bfaa050d'); //YAHOO (4) | ||
93 | |||
94 | // deferredResult.addMethod(this.user(), 'createNewRecord'); | ||
95 | |||
96 | /* | ||
97 | deferredResult.addCallback(function (aRecord) { | ||
98 | return Clipperz.Async.callbacks("CardDialogEditing_test.init - setup new record", [ | ||
99 | MochiKit.Base.method(aRecord, 'setLabel', "Clipperz staging site"), | ||
100 | MochiKit.Base.method(aRecord, 'addField', {'label':"URL", 'value':"http://d6.clipperz.com", 'isHidden':false}), | ||
101 | MochiKit.Base.method(aRecord, 'addField', {'label':"USERNAME", 'value':"staging", 'isHidden':false}), | ||
102 | MochiKit.Base.method(aRecord, 'addField', {'label':"PASSWORD", 'value':"drupal", 'isHidden':true}), | ||
103 | |||
104 | MochiKit.Base.method(aRecord, 'createNewDirectLogin'), | ||
105 | function (aDirectLogin) { | ||
106 | return Clipperz.Async.callbacks("CardDialogEditing_test.init - setup new record [directLogin]", [ | ||
107 | MochiKit.Base.method(aDirectLogin, 'setLabel', 'Clipperz staging site'), | ||
108 | MochiKit.Base.method(aDirectLogin, 'setFavicon', 'http://www.apple.com/favicon.ico'), | ||
109 | MochiKit.Base.method(aDirectLogin, 'setBookmarkletConfiguration', '{ "page":{"title":"HTTP authentication"},\n "form":{"attributes": {\n "action":"",\n "type":"http_auth"\n }, "inputs": [\n {"type":"text","name":"url","value":""},\n {"type":"text","name":"username","value":""},\n {"type":"password","name":"password","value":""}\n ]}, "version":"0.2.3"}'), | ||
110 | |||
111 | MochiKit.Base.method(aDirectLogin, 'bindFormFieldWithLabelToRecordFieldWithLabel', 'url', 'URL'), | ||
112 | MochiKit.Base.method(aDirectLogin, 'bindFormFieldWithLabelToRecordFieldWithLabel', 'username', 'USERNAME'), | ||
113 | MochiKit.Base.method(aDirectLogin, 'bindFormFieldWithLabelToRecordFieldWithLabel', 'password', 'PASSWORD') | ||
114 | ], {trace:false}); | ||
115 | }, | ||
116 | MochiKit.Base.partial(MochiKit.Async.succeed, aRecord) | ||
117 | ], {trace:false}); | ||
118 | }); | ||
119 | |||
120 | // deferredResult.addMethod(this.user(), 'createNewRecord'); | ||
121 | deferredResult.addCallback(function (aRecord) { | ||
122 | return Clipperz.Async.callbacks("CardDialogEditing_test.init - setup another record", [ | ||
123 | MochiKit.Base.method(aRecord, 'setLabel', "Twitter site"), | ||
124 | MochiKit.Base.method(aRecord, 'addField', {'label':"twitter_url", 'value':"http://www.twitter.com", 'isHidden':false}), | ||
125 | MochiKit.Base.method(aRecord, 'addField', {'label':"twitter_username", 'value':"staging", 'isHidden':false}), | ||
126 | MochiKit.Base.method(aRecord, 'addField', {'label':"twitter_password", 'value':"drupal", 'isHidden':true}), | ||
127 | |||
128 | MochiKit.Base.method(aRecord, 'createNewDirectLogin'), | ||
129 | function (aDirectLogin) { | ||
130 | return Clipperz.Async.callbacks("CardDialogEditing_test.init - setup another record [directLogin]", [ | ||
131 | MochiKit.Base.method(aDirectLogin, 'setLabel', 'Twitter'), | ||
132 | MochiKit.Base.method(aDirectLogin, 'setFavicon', 'http://www.twitter.com/favicon.ico'), | ||
133 | MochiKit.Base.method(aDirectLogin, 'setBookmarkletConfiguration', '{"page": {"title": "Twitter"},\n"form": {"attributes": {"action": "https://twitter.com/sessions",\n"method": "post"},\n"inputs": [{"type": "hidden",\n"name": "authenticity_token",\n"value": "b78a9460629980ed4c705fe94e6c4f37bfc32fed"},\n{"type": "text",\n"name": "session[username_or_email]",\n"value": ""},\n{"type": "password",\n"name": "session[password]",\n"value": ""},\n{"type": "checkbox",\n"name": "remember_me",\n"value": "1"},\n{"type": "hidden",\n"name": "q",\n"value": ""}]},\n"version": "0.2.3"}'), | ||
134 | |||
135 | MochiKit.Base.method(aDirectLogin, 'bindFormFieldWithLabelToRecordFieldWithLabel', 'session[username_or_email]', 'twitter_username'), | ||
136 | MochiKit.Base.method(aDirectLogin, 'bindFormFieldWithLabelToRecordFieldWithLabel', 'session[password]', 'twitter_password'), | ||
137 | |||
138 | MochiKit.Base.method(aDirectLogin, 'formValues'), | ||
139 | MochiKit.Base.itemgetter('remember_me'), | ||
140 | MochiKit.Base.methodcaller('setValue', 1) | ||
141 | |||
142 | ], {trace:false}); | ||
143 | }, | ||
144 | MochiKit.Base.partial(MochiKit.Async.succeed, aRecord) | ||
145 | ], {trace:false}); | ||
146 | }); | ||
147 | |||
148 | // deferredResult.addMethod(this.user(), 'createNewRecord'); | ||
149 | deferredResult.addCallback(function (aRecord) { | ||
150 | return Clipperz.Async.callbacks("CardDialogEditing_test.init - setup third record", [ | ||
151 | MochiKit.Base.method(aRecord, 'setLabel', "R@cine"), | ||
152 | MochiKit.Base.method(aRecord, 'addField', {'label':"R@cine_username", 'value':"joe", 'isHidden':false}), | ||
153 | MochiKit.Base.method(aRecord, 'addField', {'label':"R@cine_password", 'value':"clipperz", 'isHidden':true}), | ||
154 | |||
155 | MochiKit.Base.method(aRecord, 'createNewDirectLogin'), | ||
156 | function (aDirectLogin) { | ||
157 | return Clipperz.Async.callbacks("CardDialogEditing_test.init - setup third record [directLogin]", [ | ||
158 | MochiKit.Base.method(aDirectLogin, 'setLabel', 'R@cine'), | ||
159 | MochiKit.Base.method(aDirectLogin, 'setFavicon', 'http://www.racine.ra.it/horde/imp/graphics/favicon.ico'), | ||
160 | MochiKit.Base.method(aDirectLogin, 'setBookmarkletConfiguration', '{"page": {"title": "IMP :: Welcome to Horde"},\n"form": {"attributes": {"action": "http://www.racine.ra.it/horde/imp/redirect.php",\n"method": "post"},\n"inputs": [{"type": "hidden",\n"name": "actionID",\n"value": "105"},\n{"type": "hidden",\n"name": "url",\n"value": ""},\n{"type": "hidden",\n"name": "mailbox",\n"value": "INBOX"},\n{"type": "text",\n"name": "imapuser",\n"value": ""},\n{"type": "password",\n"name": "pass",\n"value": ""},\n{"type": "hidden",\n"name": "server",\n"value": "localhost"},\n{"type": "hidden",\n"name": "port",\n"value": "143"},\n{"type": "hidden",\n"name": "namespace",\n"value": ""},\n{"type": "hidden",\n"name": "maildomain",\n"value": "racine.ra.it"},\n{"type": "hidden",\n"name": "protocol",\n"value": "imap/notls"},\n{"type": "hidden",\n"name": "realm",\n"value": "racine.ra.it"},\n{"type": "hidden",\n"name": "folders",\n"value": "mail/"},\n{"type": "select",\n"name": "new_lang",\n"options": [{"selected": false,\n"label": "Bulgarian",\n"value": "bg_BG"},\n{"selected": false,\n"label": "Chinese (Simplified)",\n"value": "zh_CN"},\n{"selected": false,\n"label": "Chinese (Traditional)",\n"value": "zh_TW"},\n{"selected": false,\n"label": "Czech",\n"value": "cs_CZ"},\n{"selected": false,\n"label": "Dansk",\n"value": "da_DK"},\n{"selected": false,\n"label": "Deutsch",\n"value": "de_DE"},\n{"selected": false,\n"label": "English (GB)",\n"value": "en_GB"},\n{"selected": true,\n"label": "English (US)",\n"value": "en_US"},\n{"selected": false,\n"label": "Español",\n"value": "es_ES"},\n{"selected": false,\n"label": "Eesti",\n"value": "et_EE"},\n{"selected": false,\n"label": "Français",\n"value": "fr_FR"},\n{"selected": false,\n"label": "Greek",\n"value": "el_GR"},\n{"selected": false,\n"label": "Italiano",\n"value": "it_IT"},\n{"selected": false,\n"label": "Japanese",\n"value": "ja_JP"},\n{"selected": false,\n"label": "Korean",\n"value": "ko_KR"},\n{"selected": false,\n"label": "Latviešu",\n"value": "lv_LV"},\n{"selected": false,\n"label": "Lietuviskas",\n"value": "lt_LT"},\n{"selected": false,\n"label": "Magyar",\n"value": "hu_HU"},\n{"selected": false,\n"label": "Nederlands",\n"value": "nl_NL"},\n{"selected": false,\n"label": "Norsk bokmål",\n"value": "nb_NO"},\n{"selected": false,\n"label": "Norsk nynorsk",\n"value": "nn_NO"},\n{"selected": false,\n"label": "Polski",\n"value": "pl_PL"},\n{"selected": false,\n"label": "Português",\n"value": "pt_PT"},\n{"selected": false,\n"label": "Português Brasileiro",\n"value": "pt_BR"},\n{"selected": false,\n"label": "Romana",\n"value": "ro_RO"},\n{"selected": false,\n"label": "Russian (Windows)",\n"value": "ru_RU"},\n{"selected": false,\n"label": "Russian (KOI8-R)",\n"value": "ru_RU.KOI8-R"},\n{"selected": false,\n"label": "Slovak",\n"value": "sk_SK"},\n{"selected": false,\n"label": "Slovenscina",\n"value": "sl_SI"},\n{"selected": false,\n"label": "Suomi",\n"value": "fi_FI"},\n{"selected": false,\n"label": "Svenska",\n"value": "sv_SE"},\n{"selected": false,\n"label": "Ukranian",\n"value": "uk_UA"}]},\n{"type": "submit",\n"name": "button",\n"value": "Log in"}]},\n"version": "0.2.3"}'), | ||
161 | |||
162 | MochiKit.Base.method(aDirectLogin, 'bindFormFieldWithLabelToRecordFieldWithLabel', 'imapuser', 'R@cine_username'), | ||
163 | MochiKit.Base.method(aDirectLogin, 'bindFormFieldWithLabelToRecordFieldWithLabel', 'pass', 'R@cine_password'), | ||
164 | |||
165 | MochiKit.Base.method(aDirectLogin, 'formValues'), | ||
166 | MochiKit.Base.itemgetter('new_lang'), | ||
167 | MochiKit.Base.methodcaller('setValue', 'en_US') | ||
168 | |||
169 | ], {trace:false}); | ||
170 | }, | ||
171 | MochiKit.Base.partial(MochiKit.Async.succeed, aRecord) | ||
172 | ], {trace:false}); | ||
173 | }); | ||
174 | */ | ||
175 | |||
176 | deferredResult.addCallback(function (aRecord) { | ||
177 | return Clipperz.Async.callbacks("CardDialogEditing_test.init - setup Kiva", [ | ||
178 | MochiKit.Base.method(aRecord, 'setLabel', "KIVA"), | ||
179 | MochiKit.Base.method(aRecord, 'addField', {'label':"kiva_email", 'value':"giulio.cesare@solaroli.it", 'isHidden':false}), | ||
180 | MochiKit.Base.method(aRecord, 'addField', {'label':"kiva_password", 'value':"G0ELE0ngyTZf", 'isHidden':true}), | ||
181 | |||
182 | MochiKit.Base.method(aRecord, 'createNewDirectLogin'), | ||
183 | function (aDirectLogin) { | ||
184 | return Clipperz.Async.callbacks("CardDialogEditing_test.init - setup Kiva [directLogin]", [ | ||
185 | MochiKit.Base.method(aDirectLogin, 'setLabel', 'Kiva'), | ||
186 | MochiKit.Base.method(aDirectLogin, 'setFavicon', 'http://www.kiva.org/favicon.ico'), | ||
187 | MochiKit.Base.method(aDirectLogin, 'setBookmarkletConfiguration', '{\n "page": {\n "title": "kiva.org"\n },\n "form": {\n "attributes": {\n "action": "https://www.kiva.org/app.php?page=login&action=doLogin",\n "method": "post"\n },\n "inputs": [\n {\n "type": "text",\n "name": "email",\n "value": ""\n },\n {\n "type": "password",\n "name": "password",\n "value": ""\n },\n {\n "type": "submit",\n "name": "submit",\n "value": "Login >>"\n },\n {\n "type": "hidden",\n "name": "currURL",\n "value": "https://www.kiva.org/app.php?page=login"\n }\n ]\n },\n "version": "0.2.3"\n}'), | ||
188 | |||
189 | MochiKit.Base.method(aDirectLogin, 'bindFormFieldWithLabelToRecordFieldWithLabel', 'email', 'kiva_email'), | ||
190 | MochiKit.Base.method(aDirectLogin, 'bindFormFieldWithLabelToRecordFieldWithLabel', 'password', 'kiva_password') | ||
191 | ], {trace:false}); | ||
192 | }, | ||
193 | MochiKit.Base.partial(MochiKit.Async.succeed, aRecord) | ||
194 | ], {trace:false}); | ||
195 | }); | ||
196 | |||
197 | deferredResult.addCallback(MochiKit.Base.bind(function (aRecord) { | ||
198 | cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:aRecord, delegate:this}); | ||
199 | cardDialogController.run(); | ||
200 | }, this)); | ||
201 | deferredResult.callback(); | ||
202 | |||
203 | return deferredResult; | ||
204 | }, | ||
205 | |||
206 | //========================================================================= | ||
207 | |||
208 | 'saveChanges': function () { | ||
209 | return this.user().saveChanges(); | ||
210 | }, | ||
211 | |||
212 | //------------------------------------------------------------------------- | ||
213 | |||
214 | 'hasPendingChanges': function () { | ||
215 | return this.user().hasPendingChanges(); | ||
216 | }, | ||
217 | |||
218 | //------------------------------------------------------------------------- | ||
219 | |||
220 | 'revertChanges': function () { | ||
221 | return this.user().revertChanges(); | ||
222 | }, | ||
223 | |||
224 | //========================================================================= | ||
225 | __syntaxFix__: "syntax fix" | ||
226 | }); | ||
227 | |||
228 | |||
229 | |||
230 | |||
231 | init = function () { | ||
232 | vartester; | ||
233 | |||
234 | tester = new Clipperz.Tests.CardDialogEditing.Tester(); | ||
235 | tester.run(); | ||
236 | }; | ||
237 | |||
238 | MochiKit.DOM.addLoadEvent(init); | ||