Diffstat (limited to 'frontend/gamma/tests/tests/Components/CardDialogNew/cardDialogNew_test.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/tests/tests/Components/CardDialogNew/cardDialogNew_test.js | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/frontend/gamma/tests/tests/Components/CardDialogNew/cardDialogNew_test.js b/frontend/gamma/tests/tests/Components/CardDialogNew/cardDialogNew_test.js new file mode 100644 index 0000000..e2b21bc --- a/dev/null +++ b/frontend/gamma/tests/tests/Components/CardDialogNew/cardDialogNew_test.js | |||
@@ -0,0 +1,127 @@ | |||
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.CardDialogNew'); | ||
30 | |||
31 | Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); | ||
32 | Clipperz.PM.Strings.Languages.initSetup(); | ||
33 | |||
34 | Clipperz.Tests.CardDialogNew.Tester = function(args) { | ||
35 | args = args || {}; | ||
36 | |||
37 | Clipperz.Tests.CardDialogNew.Tester.superclass.constructor.call(this, args); | ||
38 | this._user = new Clipperz.PM.DataModel.User({username:'test', getPassphraseFunction:function () { return 'test';}}); | ||
39 | |||
40 | return this; | ||
41 | }; | ||
42 | |||
43 | Clipperz.Base.extend(Clipperz.Tests.CardDialogNew.Tester, Object, { | ||
44 | |||
45 | 'toString': function() { | ||
46 | return "Clipperz.Tests.CardDialogNew.Tester"; | ||
47 | }, | ||
48 | |||
49 | //------------------------------------------------------------------------- | ||
50 | |||
51 | 'user': function () { | ||
52 | return this._user; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | |||
57 | 'run': function () { | ||
58 | var deferredResult; | ||
59 | var proxy; | ||
60 | varcardDialogController; | ||
61 | varcardDialogComponent; | ||
62 | |||
63 | proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false}); | ||
64 | |||
65 | deferredResult = new Clipperz.Async.Deferred("cardDialogNew_test.init", {trace:false}); | ||
66 | deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_offline_copy_data']); | ||
67 | deferredResult.addMethod(this.user(), 'login'); | ||
68 | // deferredResult.addMethod(this.user(), 'getRecord', '8280842f41162b673335b63860637e8472e8bbff0efa2bc78b0dbc5e09712e13'); | ||
69 | deferredResult.addMethod(this.user(), 'createNewRecord'); | ||
70 | deferredResult.addCallback(MochiKit.Base.bind(function (aRecord) { | ||
71 | cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:aRecord, delegate:this}); | ||
72 | cardDialogController.run(); | ||
73 | }, this)); | ||
74 | deferredResult.callback(); | ||
75 | |||
76 | return deferredResult; | ||
77 | }, | ||
78 | |||
79 | //========================================================================= | ||
80 | |||
81 | 'saveChanges': function () { | ||
82 | return this.user().saveChanges(); | ||
83 | }, | ||
84 | |||
85 | //------------------------------------------------------------------------- | ||
86 | |||
87 | 'hasPendingChanges': function () { | ||
88 | return this.user().hasPendingChanges(); | ||
89 | }, | ||
90 | |||
91 | //------------------------------------------------------------------------- | ||
92 | |||
93 | 'revertChanges': function () { | ||
94 | return this.user().revertChanges(); | ||
95 | }, | ||
96 | |||
97 | //========================================================================= | ||
98 | __syntaxFix__: "syntax fix" | ||
99 | }); | ||
100 | |||
101 | |||
102 | |||
103 | |||
104 | |||
105 | |||
106 | |||
107 | |||
108 | |||
109 | |||
110 | |||
111 | |||
112 | |||
113 | |||
114 | |||
115 | |||
116 | |||
117 | |||
118 | |||
119 | |||
120 | init = function () { | ||
121 | vartester; | ||
122 | |||
123 | tester = new Clipperz.Tests.CardDialogNew.Tester(); | ||
124 | tester.run(); | ||
125 | }; | ||
126 | |||
127 | MochiKit.DOM.addLoadEvent(init); | ||