Diffstat (limited to 'frontend/gamma/tests/tests/Components/GridLayout/GridLayout_test.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/tests/tests/Components/GridLayout/GridLayout_test.js | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/frontend/gamma/tests/tests/Components/GridLayout/GridLayout_test.js b/frontend/gamma/tests/tests/Components/GridLayout/GridLayout_test.js new file mode 100644 index 0000000..1c06468 --- a/dev/null +++ b/frontend/gamma/tests/tests/Components/GridLayout/GridLayout_test.js | |||
@@ -0,0 +1,119 @@ | |||
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.GridLayout'); | ||
30 | |||
31 | Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); | ||
32 | Clipperz.PM.Strings.Languages.initSetup(); | ||
33 | |||
34 | Clipperz.Tests.GridLayout.Tester = function(args) { | ||
35 | args = args || {}; | ||
36 | |||
37 | Clipperz.Tests.GridLayout.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.GridLayout.Tester, Object, { | ||
45 | |||
46 | 'toString': function() { | ||
47 | return "Clipperz.Tests.GridLayout.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 | varcomponent; | ||
64 | varfilterController; | ||
65 | var cardsController; | ||
66 | |||
67 | filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); | ||
68 | cardsController = new Clipperz.PM.UI.Web.Controllers.CardsController({'filterController':filterController}); | ||
69 | |||
70 | component = new Clipperz.Tests.GridLayout.TestPageComponent({element:MochiKit.DOM.getElement('component')}); | ||
71 | |||
72 | proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false}); | ||
73 | |||
74 | deferredResult = new Clipperz.Async.Deferred("GridLayout_test.init", {trace:false}); | ||
75 | //# deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['test_test_offline_copy_data']); | ||
76 | deferredResult.addMethod(proxy.dataStore(), 'setupWithEncryptedData', testData['joe_clipperz_offline_copy_data']); | ||
77 | deferredResult.addMethod(this.user(), 'login'); | ||
78 | |||
79 | deferredResult.addMethod(cardsController,'run', {slot:component.slotNamed('cardList'), user:this.user()}); | ||
80 | // deferredResult.addMethod(xxxxController,'run', {slot:component.slotNamed('cardGrid'), user:this.user()}); | ||
81 | |||
82 | deferredResult.callback(); | ||
83 | |||
84 | return deferredResult; | ||
85 | }, | ||
86 | |||
87 | //========================================================================= | ||
88 | |||
89 | 'saveChanges': function () { | ||
90 | return this.user().saveChanges(); | ||
91 | }, | ||
92 | |||
93 | //------------------------------------------------------------------------- | ||
94 | |||
95 | 'hasPendingChanges': function () { | ||
96 | return this.user().hasPendingChanges(); | ||
97 | }, | ||
98 | |||
99 | //------------------------------------------------------------------------- | ||
100 | |||
101 | 'revertChanges': function () { | ||
102 | return this.user().revertChanges(); | ||
103 | }, | ||
104 | |||
105 | //========================================================================= | ||
106 | __syntaxFix__: "syntax fix" | ||
107 | }); | ||
108 | |||
109 | |||
110 | |||
111 | |||
112 | init = function () { | ||
113 | vartester; | ||
114 | |||
115 | tester = new Clipperz.Tests.GridLayout.Tester(); | ||
116 | tester.run(); | ||
117 | }; | ||
118 | |||
119 | MochiKit.DOM.addLoadEvent(init); | ||