Changeset 1869
- Timestamp:
- 2011-02-24 10:27:55 (15 months ago)
- Location:
- trunk/modules/kauri-forms/kauri-forms-framework/src
- Files:
-
- 3 edited
-
main/kauri/static-{build}.key/kauri.forms/control.js (modified) (1 diff)
-
test/kauri.forms/test-case.js (modified) (5 diffs)
-
test/kauri.forms/test-composite.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/control.js
r1866 r1869 2135 2135 2136 2136 2137 2137 AbstractContainerControl.prototype.hide = function(){ 2138 this.eachChild(function(i, child){ child.hide();}); 2139 this['<super.call>']('hide'); 2140 } 2141 2142 AbstractContainerControl.prototype.show = function(){ 2143 this.eachChild(function(i, child){ child.show();}); 2144 this['<super.call>']('show'); 2145 } 2146 2138 2147 AbstractContainerControl.prototype.disable = function() { 2139 this.eachChild( AbstractContainerControl.childDisabler);2148 this.eachChild(function(i, child){ child.disable();}); 2140 2149 this['<super.call>']('disable'); 2141 2150 }; 2142 AbstractContainerControl.childDisabler = function(i, child){2143 child.disable();2144 };2145 2151 2146 2152 AbstractContainerControl.prototype.enable = function() { 2147 this.eachChild( AbstractContainerControl.childEnabler);2153 this.eachChild(function(i, child){ child.enable();}); 2148 2154 this['<super.call>']('enable'); 2149 };2150 AbstractContainerControl.childEnabler = function(i, child){2151 child.enable();2152 2155 }; 2153 2156 -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-case.js
r1865 r1869 9 9 var id = "tcase"; 10 10 var fconf = { "members": {}}; 11 fconf.members[id] = { 12 base : 'case', 11 fconf.members[id] = { base : 'case', 13 12 cases : { 14 13 "c1" : 'integer', 15 "c2" : 'boolean' 14 "c2" : 'boolean', 15 "c3" : { base: 'composite', 16 members: { "a": "string", "b": "string" } 17 } 16 18 } 17 19 }; … … 27 29 var $c1 = $('<input kauri-idref="case-c1" ><span kauri-idref="case-c1" kauri-role="messages">init</span>').appendTo($case); 28 30 var $c2 = $('<input kauri-idref="case-c2" type="checkbox" ><span kauri-idref="case-c2" kauri-role="messages">init</span>').appendTo($cas2); 31 var $c3a = $('<input kauri-idref="case-c3/a">').appendTo($case); 32 var $c3b = $('<div kauri-idref="case-c3"><input kauri-idref="b" /></div>').appendTo($cas2); 33 34 // Note: the composite case c3 was added to check for the side effects of #448 35 // While it should just work: using this in a case might be indication that you should switch to actually using eventhandlers 29 36 30 37 var $msg = $("<span kauri-role='messages'/>").appendTo($case); … … 33 40 34 41 // test 35 expect( 9);42 expect(17); 36 43 37 44 // verify creation of control … … 46 53 ok($c1.is(':visible'), "the first member should be visible"); 47 54 ok($c2.is(':hidden'), "the second member should be hidden"); 55 ok($c3a.is(':hidden'), "the third a-member should be hidden"); 56 ok($c3b.is(':hidden'), "the third b-member should be hidden"); 48 57 49 58 var $c1Msg = form.findControl(id + "/case-c1").getElement("messages"); … … 57 66 ok($c1.is(':hidden'), "the first member should be hidden"); 58 67 ok($c2.is(':visible'), "the second member should be visible"); 59 68 ok($c3a.is(':hidden'), "the third a-member should be hidden"); 69 ok($c3b.is(':hidden'), "the third b-member should be hidden"); 70 71 c.setValue( { "case" : "c3", value : {a: "one", b: "two"}}); 72 73 ok($c1.is(':hidden'), "the first member should be hidden"); 74 ok($c2.is(':hidden'), "the second member should be hidden"); 75 ok($c3a.is(':visible'), "the third a-member should be visible"); 76 ok($c3b.is(':visible'), "the third b-member should be visible"); 77 60 78 // cleanup 61 79 $main.html("").hide(); -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-composite.js
r1845 r1869 149 149 $main.html("").hide(); 150 150 }); 151 152 153 test("composite with split HTML should hide/show all parts", function() { 154 // create 155 var $main = $('#main').show(); 156 157 // init form 158 var id = "tcomp3"; 159 160 var fconf = { "members": {}}; 161 fconf.members[id] = { "base": "composite", 162 "members" : { "m1" : "string", "m2" : "string" , "m3" : "string"} 163 }; 164 165 var $form = $('<form />').appendTo($main); 166 var $compo1 = $('<div kauri-idref="' + id + '" ></div>)').appendTo($form); 167 var $compo2 = $('<div></div>)').appendTo($form); 168 var $compo3 = $('<div kauri-idref="' + id + '" ></div>)').appendTo($form); 169 var $m1 = $('<input kauri-idref="m1" ><span kauri-idref="m1" kauri-role="messages">init</span>').appendTo($compo1); 170 var $m2 = $('<input kauri-idref="'+id+'/m2" ><span kauri-idref="'+id+'/m2" kauri-role="messages">init</span>').appendTo($compo2); 171 var $m3 = $('<input kauri-idref="m3" ><span kauri-idref="m3" kauri-role="messages">init</span>').appendTo($compo3); 172 173 var form = new $.org.kauriproject.forms.Form($form, fconf); 174 175 // start test 176 expect(15); 177 178 179 // verify creation of control 180 var c = form.findControl(id); 181 ok(c != null, "control creation passed"); 182 equals(c.getForm(), form, "control form ok"); 183 equals(c.getId(), id, "control id checked"); 184 185 debugger; 186 c.hide(); 187 ok($compo1.is(':hidden'), "m1 container is associated to the composite and should be hidden"); 188 ok($compo2.is(':visible'), "m2 container is not associated to the composite and should always be visible"); 189 ok($compo3.is(':hidden'), "m3 container is associated to the composite and should be hidden"); 190 ok($m1.is(':hidden'), "m1 member should be hidden"); 191 ok($m2.is(':hidden'), "m2 member should be hidden"); 192 ok($m3.is(':hidden'), "m3 member should be hidden"); 193 194 c.show(); 195 ok($compo1.is(':visible'), "m1 container is associated to the composite and should always be visible"); 196 ok($compo2.is(':visible'), "m2 container is not associated to the composite and should be visible"); 197 ok($compo3.is(':visible'), "m1 container is associated to the composite and should always be visible"); 198 ok($m1.is(':visible'), "m1 member should be visible"); 199 ok($m2.is(':visible'), "m2 member should be visible"); 200 ok($m3.is(':visible'), "m3 member should be visible"); 201 202 // cleanup 203 $main.html("").hide(); 204 });
Note: See TracChangeset
for help on using the changeset viewer.