- Timestamp:
- 2011-04-19 11:48:54 (13 months ago)
- Location:
- trunk/modules
- Files:
-
- 3 added
- 2 deleted
- 12 edited
-
kauri-forms/kauri-forms-framework/src/test/crosscheck/tests.js (modified) (3 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-basic-controls.js (modified) (17 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-basic-fields.js (modified) (2 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-basic-formatters.js (modified) (2 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-basic-validators.js (modified) (6 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-case.js (modified) (4 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-collection.js (modified) (11 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-composite.js (modified) (7 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-date.js (modified) (7 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-form.js (modified) (28 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-numeric-range.js (modified) (4 diffs)
-
kauri-forms/kauri-forms-framework/src/test/kauri.forms/testPage.html (modified) (5 diffs)
-
kauri-jquery/src/test/qunit/qunit-readme.txt (added)
-
kauri-jquery/src/test/qunit/qunit.css (added)
-
kauri-jquery/src/test/qunit/qunit.js (added)
-
kauri-jquery/src/test/qunit/testrunner.js (deleted)
-
kauri-jquery/src/test/qunit/testsuite.css (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/kauri-forms/kauri-forms-framework/src/test/crosscheck/tests.js
r1191 r1896 11 11 crosscheck.addPath('../../kauri-jquery/src/test/qunit/'); 12 12 crosscheck.addPath('../../kauri-jquery/src/test/kauri.util/'); 13 crosscheck.addPath('../../kauri-jquery/src/main/kauri/static/jquery/jquery-1. 3.2/');14 crosscheck.addPath('../../kauri-jquery/src/main/kauri/static/jquery.ui/jquery.ui-1. 7.1/js/');13 crosscheck.addPath('../../kauri-jquery/src/main/kauri/static/jquery/jquery-1.5.2/'); 14 crosscheck.addPath('../../kauri-jquery/src/main/kauri/static/jquery.ui/jquery.ui-1.8.11/js/'); 15 15 crosscheck.addPath('../../kauri-jquery/src/main/kauri/static-{build}.key/kauri.util/'); 16 16 … … 20 20 crosscheck.addPath('../kauri-jquery/src/test/qunit/'); 21 21 crosscheck.addPath('../kauri-jquery/src/test/kauri.util/'); 22 crosscheck.addPath('../kauri-jquery/src/main/kauri/static/jquery/jquery-1. 3.2/');23 crosscheck.addPath('../kauri-jquery/src/main/kauri/static/jquery.ui/jquery.ui-1. 7.1/js/');22 crosscheck.addPath('../kauri-jquery/src/main/kauri/static/jquery/jquery-1.5.2/'); 23 crosscheck.addPath('../kauri-jquery/src/main/kauri/static/jquery.ui/jquery.ui-1.8.11/js/'); 24 24 crosscheck.addPath('../kauri-jquery/src/main/kauri/static-{build}.key/kauri.util/'); 25 25 … … 29 29 crosscheck.addPath('modules/kauri-jquery/src/test/qunit/'); 30 30 crosscheck.addPath('modules/kauri-jquery/src/test/kauri.util/'); 31 crosscheck.addPath('modules/kauri-jquery/src/main/kauri/static/jquery/jquery-1. 3.2/');32 crosscheck.addPath('modules/kauri-jquery/src/main/kauri/static/jquery.ui/jquery.ui-1. 7.1/js/');31 crosscheck.addPath('modules/kauri-jquery/src/main/kauri/static/jquery/jquery-1.5.2/'); 32 crosscheck.addPath('modules/kauri-jquery/src/main/kauri/static/jquery.ui/jquery.ui-1.8.11/js/'); 33 33 crosscheck.addPath('modules/kauri-jquery/src/main/kauri/static-{build}.key/kauri.util/'); 34 34 35 crosscheck.load('jquery-1. 3.2.js');36 crosscheck.load('jquery-ui-1. 7.1.min.js');37 crosscheck.load(' testrunner.js');35 crosscheck.load('jquery-1.5.2.js'); 36 crosscheck.load('jquery-ui-1.8.11.min.js'); 37 crosscheck.load('qunit.js'); 38 38 39 39 crosscheck.load('core.js'); -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-basic-controls.js
r1874 r1896 1 $(document).ready(function(){ 2 1 3 module('Basic Control Testing'); 2 3 var kf = $.org.kauriproject.forms;4 5 4 6 5 test("form element indexing", function() { … … 43 42 }); 44 43 45 46 44 function indexElements( space, form) { 47 45 … … 61 59 var index = $this.attr('kauri-index'); 62 60 var assertIndex = $this.attr('assert-index'); 63 equal s(index, assertIndex, "checked attribute addition");61 equal(index, assertIndex, "checked attribute addition"); 64 62 }); 65 63 revElms.each( function( i) { … … 69 67 var rev = $this.attr('kauri-role'); 70 68 var assertElm = form.getElementIndex(index, rev).get(0); 71 equal s(this, assertElm, "checked element index registration");69 equal(this, assertElm, "checked element index registration"); 72 70 }); 73 71 } … … 94 92 95 93 var form = new $.org.kauriproject.forms.Form($form, fconf); 94 96 95 97 96 expect(12); … … 100 99 var c = form.findControl(id); 101 100 ok(c != null, "control creation passed"); 102 equals(c.getForm(),form, "control form ok");103 equal s(c.getId(), id, "control id checked");104 101 ok(c.getForm() == form, "control form ok"); 102 equal(c.getId(), id, "control id checked"); 103 105 104 // verify creation of control elements 106 105 var $input = $('input[kauri-idref*="'+id+'"]', $form); 107 106 var $messages = $("span[kauri-idref*='"+id+"']", $form); 108 107 $messages.html("text that should get cleared upon validation"); 109 isSet(c.getElement(), $input, "input element found and indexed.");110 isSet(c.getElement('messages'), $messages, "messages element found and indexed.")108 sameJq(c.getElement(), $input, "input element found and indexed."); 109 sameJq(c.getElement('messages'), $messages, "messages element found and indexed.") 111 110 112 111 // verify setting some value 113 112 c.setWireValue(okValue); 114 113 115 equal s($messages.html(), "", "validation error clearing.");116 equal s(c.getValue(), okValue, "get-set value match.");114 equal($messages.html(), "", "validation error clearing."); 115 equal(c.getValue(), okValue, "get-set value match."); 117 116 118 117 … … 126 125 $input.val(nokValue).change(); 127 126 128 equal s(changes, 1, "receiving value-change event");129 equal s(c.hasChanges(), true, "change state")130 equal s($messages.html(), mockMsg, "validation error setting.");131 equal s(c.getValue(), nokValue, "get-set value match.");127 equal(changes, 1, "receiving value-change event"); 128 equal(c.hasChanges(), true, "change state") 129 equal($messages.html(), mockMsg, "validation error setting."); 130 equal(c.getValue(), nokValue, "get-set value match."); 132 131 133 132 // mock user interaction: blur without change 134 133 c.getElement("input").blur(); 135 134 136 equal s(changes, 1, "checking possible duplicate value-change event");135 equal(changes, 1, "checking possible duplicate value-change event"); 137 136 138 137 // cleanup … … 171 170 var c = form.findControl(id); 172 171 ok(c != null, "control creation passed"); 173 equals(c.getForm(),form, "control form ok");174 equal s(c.getId(), id, "control id checked");172 ok(c.getForm() == form, "control form ok"); 173 equal(c.getId(), id, "control id checked"); 175 174 176 175 // verify creation of control elements … … 178 177 var $messages = $("span[kauri-idref*='"+id+"']", $form); 179 178 $messages.html("text that should get cleared upon validation"); 180 isSet(c.getElement(), $input, "input element found and indexed.");181 isSet(c.getElement('messages'), $messages, "messages element found and indexed.")179 sameJq(c.getElement(), $input, "input element found and indexed."); 180 sameJq(c.getElement('messages'), $messages, "messages element found and indexed.") 182 181 183 182 // verify setting some value 184 183 c.setWireValue(okValue); 185 184 186 equal s($messages.html(), "", "validation error clearing.");187 equal s(c.getValue(), okValue, "get-set value match.");185 equal($messages.html(), "", "validation error clearing."); 186 equal(c.getValue(), okValue, "get-set value match."); 188 187 189 188 … … 197 196 $input.removeAttr('checked').click(); 198 197 199 equal s(changes, 1, "receiving value-change event");200 equal s(c.hasChanges(), true, "change state");201 equal s($messages.html(), mockMsg, "validation error setting.");202 equal s(c.getValue(), nokValue, "get-set value match.");198 equal(changes, 1, "receiving value-change event"); 199 equal(c.hasChanges(), true, "change state"); 200 equal($messages.html(), mockMsg, "validation error setting."); 201 equal(c.getValue(), nokValue, "get-set value match."); 203 202 204 203 // mock user interaction: set 'true' again and check values 205 204 $input.attr('checked', 'checked').click(); 206 205 207 equal s(changes, 2, "receiving 2nd value-change event");208 equal s(c.hasChanges(), true, "change state");209 equal s($messages.html(), "", "validation error cleared.");210 equal s(c.getValue(), okValue, "get-set value match.");206 equal(changes, 2, "receiving 2nd value-change event"); 207 equal(c.hasChanges(), true, "change state"); 208 equal($messages.html(), "", "validation error cleared."); 209 equal(c.getValue(), okValue, "get-set value match."); 211 210 212 211 // cleanup … … 252 251 var c = form.findControl(id); 253 252 ok(c != null, "control creation passed"); 254 equals(c.getForm(),form, "control form ok");255 equal s(c.getId(), id, "control id checked");253 ok(c.getForm() == form, "control form ok"); 254 equal(c.getId(), id, "control id checked"); 256 255 257 256 // verify setting some valid value in untrimmed version 258 257 c.setWireValue(options[1]); 259 equal s(c.getValue(), options[1], "checking that the untrimmed value was selected to second option");258 equal(c.getValue(), options[1], "checking that the untrimmed value was selected to second option"); 260 259 261 260 // verify setting untrimmed value via UI … … 265 264 $options.eq(2).attr("selected","selected"); 266 265 $input.change(); 267 equal s(c.getValue(), options[2], "checking that the untrimmed value was selected to third option");266 equal(c.getValue(), options[2], "checking that the untrimmed value was selected to third option"); 268 267 269 268 // verify setting untrimmed value 270 269 $input.val(options[3]); 271 270 $input.change(); 272 equal s(c.getValue(), options[3], "checking that the untrimmed value was selected to fourth option");271 equal(c.getValue(), options[3], "checking that the untrimmed value was selected to fourth option"); 273 272 274 273 … … 316 315 var c = form.findControl(id); 317 316 ok(c != null, "control creation passed"); 318 equals(c.getForm(),form, "control form ok");319 equal s(c.getId(), id, "control id checked");317 ok(c.getForm() == form, "control form ok"); 318 equal(c.getId(), id, "control id checked"); 320 319 321 320 // verify creation of control elements … … 323 322 var $messages = $("span[kauri-idref*='"+id+"']", $form); 324 323 $messages.html("text that should get cleared upon validation"); 325 isSet(c.getElement(), $input, "input element found and indexed.");326 isSet(c.getElement('messages'), $messages, "messages element found and indexed.")324 sameJq(c.getElement(), $input, "input element found and indexed."); 325 sameJq(c.getElement('messages'), $messages, "messages element found and indexed.") 327 326 328 327 var $options = $("option", $input); 329 equal s($options.length, options.length, "Checking if options are available on HTML level.");330 331 isSet(c.getValue(), [3], "checking initial value.");328 equal($options.length, options.length, "Checking if options are available on HTML level."); 329 330 deepEqual(c.getValue(), [3], "checking initial value."); 332 331 333 332 // verify setting some valid value 334 333 c.setWireValue([3,4]); 335 equal s($messages.html(), "", "validation error clearing.");336 isSet(c.getValue(), [3,4], "get-set value match.");334 equal($messages.html(), "", "validation error clearing."); 335 deepEqual(c.getValue(), [3,4], "get-set value match."); 337 336 ok($options.eq(3).attr("selected"), "checking html option set"); 338 337 ok(!$options.eq(6).attr("selected"), "checking html option not set"); 339 isSet(c.readUserValue(), ["3", "4"], "get-set value match on html level.");338 deepEqual(c.readUserValue(), ["3", "4"], "get-set value match on html level."); 340 339 341 340 … … 351 350 $input.change(); 352 351 353 equal s(changes, 1, "receiving value-change event");354 equal s(c.hasChanges(), true, "change state");355 isSet(c.getValue(), [1, 2], "get-set value match.");352 equal(changes, 1, "receiving value-change event"); 353 equal(c.hasChanges(), true, "change state"); 354 deepEqual(c.getValue(), [1, 2], "get-set value match."); 356 355 357 356 c.setValue([1, 7]); 358 isSet(c.getValue(), [1], "get-set value trimmed to options.");357 deepEqual(c.getValue(), [1], "get-set value trimmed to options."); 359 358 360 359 … … 363 362 364 363 }); 364 365 }); 366 367 365 368 366 369 function makeMockValidator( test) { … … 384 387 return [ validator, errorMessage ]; 385 388 } 389 -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-basic-fields.js
r802 r1896 1 $(document).ready(function(){ 2 1 3 module('Field Type Checking'); 2 4 … … 50 52 }); 51 53 54 }); 55 52 56 function getFieldType( name, ext) { 53 57 -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-basic-formatters.js
r1832 r1896 1 $(document).ready(function(){ 2 1 3 module('Formatter logic testing.'); 2 4 … … 100 102 101 103 // be:bank-account format 102 var f = getFormatter("pattern", { 103 pattern :"###-#######-##" 104 }); 105 106 assertConvert(f, "format", "737000003679", "737-0000036-79"); 107 assertConvert(f, "parse", " 737-0000036-79 ", "737000003679"); 108 assertFail(f, "format", "737"); 109 assertFail(f, "format", "a"); 110 assertFail(f, "format", "0737000003679"); 104 var f = getFormatter("pattern", { 105 pattern :"###-#######-##" 111 106 }); 112 107 108 assertConvert(f, "format", "737000003679", "737-0000036-79"); 109 assertConvert(f, "parse", " 737-0000036-79 ", "737000003679"); 110 assertFail(f, "format", "737"); 111 assertFail(f, "format", "a"); 112 assertFail(f, "format", "0737000003679"); 113 }); 114 115 }); 113 116 114 117 function assertConvert( f, unc, input, out) { -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-basic-validators.js
r1888 r1896 1 $(document).ready(function(){ 2 1 3 module('Validator logic testing.'); 2 4 … … 132 134 test("isEmail", function() { 133 135 134 expect(1 3);136 expect(14); 135 137 136 138 var v = getValidator("isEmail"); … … 145 147 valueCheck(v, "root@localhost.localdomain", true); 146 148 valueCheck(v, "INFO@EXAMPLE.ORG", true); 147 valueCheck(v, "sdf@…@sdf....sdfsdf----+++564|@@@@99;;;;;", false); 149 valueCheck(v, "sdf@sdf.dsf@sdf....sdfsdf----+++564|@@@@99;;;;;", false); 150 valueCheck(v, "Some string with a valid email@address.test is not the same as a valid address!", false); 148 151 valueCheck(v, ".@", false); 149 152 valueCheck(v, "@.", false); … … 152 155 test("isUrl", function() { 153 156 154 expect(1 1);157 expect(12); 155 158 156 159 var v = getValidator("isUrl"); … … 164 167 valueCheck(v, "https://example.com:8888/path", true); 165 168 valueCheck(v, "https://example.com:888888/path", false); // port too big 169 valueCheck(v, "Some string with a http://valid/uri is not the same as a valid URI!", false); 166 170 valueCheck(v, "https://127.0.0.1/", true); 167 171 valueCheck(v, "no uri", false); … … 210 214 211 215 $.ajaxSetup({async: true}); // reset 216 217 }); 212 218 213 219 }); -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-case.js
r1879 r1896 1 $(document).ready(function(){ 2 1 3 module('Case Type/Control Checking'); 2 4 … … 45 47 var c = form.findControl(id); 46 48 ok(c != null, "control creation passed"); 47 equals(c.getForm(),form, "control form ok");48 equal s(c.getId(), id, "control id checked");49 ok(c.getForm() == form, "control form ok"); 50 equal(c.getId(), id, "control id checked"); 49 51 50 52 … … 57 59 58 60 var $c1Msg = form.findControl(id + "/case-c1").getElement("messages"); 59 equal s($c1Msg.get(0), $c1.get(1), "lookup of messages element for input control.");61 equal($c1Msg.get(0), $c1.get(1), "lookup of messages element for input control."); 60 62 61 63 var $c2Msg = form.findControl(id + "/case-c2").getElement("messages");; … … 162 164 // cleanup 163 165 $main.html("").hide(); 164 166 165 167 }); 168 169 }); -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-collection.js
r1867 r1896 1 $(document).ready(function(){ 2 1 3 module('Collection Control Testing'); 2 4 … … 32 34 var c = form.findControl(id); 33 35 ok(c != null, "control creation passed"); 34 equals(c.getForm(),form, "control form ok");35 equal s(c.getId(), id, "control id checked");36 ok(c.getForm() == form, "control form ok"); 37 equal(c.getId(), id, "control id checked"); 36 38 37 39 var changes = 0; … … 42 44 c.setWireValue( [ okValue, nokValue ]); 43 45 // check creation of child-controls? 44 equal s(changes, 1, "initial setting of all values registered");45 equal s(c.hasChanges(), false, "initial set values");46 47 // equal s(validContainer.html(), "", "validation error cleared ok.");48 equal s(c.getValue()[0], okValue, "get-set value match - index 0");49 equal s(c.getValue()[1], nokValue, "get-set value match - index 1.");50 51 equal s(c.getChildByIndex(0).getElement("messages").html(), "", "validation error cleared ok.");52 equal s(c.getChildByIndex(1).getElement("messages").html(), mockMsg, "validation error set correctly");46 equal(changes, 1, "initial setting of all values registered"); 47 equal(c.hasChanges(), false, "initial set values"); 48 49 // equal(validContainer.html(), "", "validation error cleared ok."); 50 equal(c.getValue()[0], okValue, "get-set value match - index 0"); 51 equal(c.getValue()[1], nokValue, "get-set value match - index 1."); 52 53 equal(c.getChildByIndex(0).getElement("messages").html(), "", "validation error cleared ok."); 54 equal(c.getChildByIndex(1).getElement("messages").html(), mockMsg, "validation error set correctly"); 53 55 54 56 // Mocking user interaction... 55 57 c.findControl("0").getElement("input").val(nokValue).change(); 56 equal s(changes, 2, "change detection");58 equal(changes, 2, "change detection"); 57 59 c.findControl("1").getElement("input").val(okValue).change(); 58 equal s(changes, 3, "change detection");59 60 // equal s(validContainer.html(), nvalid.getMessage(), "validation error set correctly.");61 equal s(c.getValue()[0], nokValue, "get-set value match - index 0");62 equal s(c.getValue()[1], okValue, "get-set value match - index 1.");63 64 equal s(c.getChildByIndex(0).getElement("messages").html(), mockMsg, "validation error set correctly");65 equal s(c.getChildByIndex(1).getElement("messages").html(), "", "validation error cleared ok.");60 equal(changes, 3, "change detection"); 61 62 // equal(validContainer.html(), nvalid.getMessage(), "validation error set correctly."); 63 equal(c.getValue()[0], nokValue, "get-set value match - index 0"); 64 equal(c.getValue()[1], okValue, "get-set value match - index 1."); 65 66 equal(c.getChildByIndex(0).getElement("messages").html(), mockMsg, "validation error set correctly"); 67 equal(c.getChildByIndex(1).getElement("messages").html(), "", "validation error cleared ok."); 66 68 67 69 // cleanup … … 113 115 var c = form.findControl(id); 114 116 ok(c != null, "control creation passed"); 115 equals(c.getForm(),form, "control form ok");116 equal s(c.getId(), id, "control id checked");117 ok(c.getForm() == form, "control form ok"); 118 equal(c.getId(), id, "control id checked"); 117 119 118 120 var changes = 0; … … 128 130 "m2" :true 129 131 } ]); 130 equal s(changes, 1, "registration of all initial setValue events");132 equal(changes, 1, "registration of all initial setValue events"); 131 133 132 134 var gotValue = c.getValue(); 133 equal s(gotValue[0].m1, okValue, "get-set value match - member m1");134 equal s(gotValue[0].m2, false, "get-set value match - member m2.");135 equal(gotValue[0].m1, okValue, "get-set value match - member m1"); 136 equal(gotValue[0].m2, false, "get-set value match - member m2."); 135 137 var m01 = c.findControl("0/m1"); 136 equal s(m01.getElement("messages").html(), "", "validation error cleared ok.");137 equal s(gotValue[1].m1, nokValue, "get-set value match - member m1");138 equal s(gotValue[1].m2, true, "get-set value match - member m2.");138 equal(m01.getElement("messages").html(), "", "validation error cleared ok."); 139 equal(gotValue[1].m1, nokValue, "get-set value match - member m1"); 140 equal(gotValue[1].m2, true, "get-set value match - member m2."); 139 141 var m02 = m01.findControl("../../1/m1"); 140 equal s(m02.getElement("messages").html(), mockMsg, "validation error set correctly");142 equal(m02.getElement("messages").html(), mockMsg, "validation error set correctly"); 141 143 142 144 … … 182 184 var c = form.findControl(id); 183 185 ok(c != null, "control creation passed"); 184 equals(c.getForm(),form, "control form ok");185 equal s(c.getId(), id, "control id checked");186 ok(c.getForm() == form, "control form ok"); 187 equal(c.getId(), id, "control id checked"); 186 188 187 189 var changes = 0; … … 192 194 c.setWireValue( [ okValue, nokValue ]); 193 195 194 equal s(changes, 1, "initial setting of all values registered");195 equal s(c.hasChanges(), false, "initial set values");196 equal(changes, 1, "initial setting of all values registered"); 197 equal(c.hasChanges(), false, "initial set values"); 196 198 197 199 198 200 // Mocking user interaction... 199 201 c.findControl("0").getElement("input").val(okValue + "2").change(); 200 equal s(changes, 2, "change detection");202 equal(changes, 2, "change detection"); 201 203 c.findControl("1").getElement("input").val(okValue + "3").change(); 202 equal s(changes, 3, "change detection");203 204 205 equal s(c.getElement("messages").html(), $("<p>Length not in range 3 ⩽ Length ⩾ 6.</p>").html(), "validation error set correctly");204 equal(changes, 3, "change detection"); 205 206 207 equal(c.getElement("messages").html(), $("<p>Length not in range 3 ⩽ Length ⩾ 6.</p>").html(), "validation error set correctly"); 206 208 207 209 c.addChild().getElement("input").val(okValue + "4").change(); 208 equal s(changes, 4, "change detection");209 210 equal s(c.getElement("messages").html(), "", "validation error cleared");210 equal(changes, 4, "change detection"); 211 212 equal(c.getElement("messages").html(), "", "validation error cleared"); 211 213 212 214 // cleanup … … 246 248 247 249 ok(c != null, "control creation passed"); 248 equals(c.getForm(),form, "control form ok");249 equal s(c.getId(), id, "control id checked");250 251 equal s(c.viewState, $.org.kauriproject.forms.Control.STATE_HIDDEN, "initial hidden");252 equal s(c.getElement().css('display'),'none', "initial hidden");250 ok(c.getForm() == form, "control form ok"); 251 equal(c.getId(), id, "control id checked"); 252 253 equal(c.viewState, $.org.kauriproject.forms.Control.STATE_HIDDEN, "initial hidden"); 254 equal(c.getElement().css('display'),'none', "initial hidden"); 253 255 254 256 c.hide(); 255 257 256 equal s(c.viewState, $.org.kauriproject.forms.Control.STATE_HIDDEN, "double check hidden");257 equal s(c.getElement().css('display'),'none', "double check hidden");258 equal(c.viewState, $.org.kauriproject.forms.Control.STATE_HIDDEN, "double check hidden"); 259 equal(c.getElement().css('display'),'none', "double check hidden"); 258 260 259 261 c.show(); … … 265 267 var child = c.findControl(""+i); 266 268 267 equal s(child.viewState, $.org.kauriproject.forms.Control.STATE_HIDDEN, "double check hidden for child " + i);268 equal s(child.getElement().css('display'),'none', "double check hidden for child " + i);269 equal(child.viewState, $.org.kauriproject.forms.Control.STATE_HIDDEN, "double check hidden for child " + i); 270 equal(child.getElement().css('display'),'none', "double check hidden for child " + i); 269 271 } 270 272 … … 312 314 // baseline checks 313 315 ok(c != null, "control creation passed"); 314 equals(c.getForm(),form, "control form ok");315 equal s(c.getId(), id, "control id checked");316 ok(c.getForm() == form, "control form ok"); 317 equal(c.getId(), id, "control id checked"); 316 318 317 319 // test that there are 0 children initially 318 equal s(0, c.getChildren().length, "collection control should have 0 children");320 equal(0, c.getChildren().length, "collection control should have 0 children"); 319 321 320 322 // find the 'ads' button and click it … … 325 327 326 328 // test that there is a child. 327 equals(1, c.getChildren().length, "collection control should have one element"); 328 329 // cleanup 330 $main.html("").hide(); 331 }); 329 equal(1, c.getChildren().length, "collection control should have one element"); 330 331 // cleanup 332 $main.html("").hide(); 333 }); 334 335 }); 336 -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-composite.js
r1870 r1896 1 $(document).ready(function(){ 2 1 3 module('Composite Type/Control Checking'); 2 4 … … 51 53 var c = form.findControl(id); 52 54 ok(c != null, "control creation passed"); 53 equals(c.getForm(),form, "control form ok");54 equal s(c.getId(), id, "control id checked");55 ok(c.getForm() == form, "control form ok"); 56 equal(c.getId(), id, "control id checked"); 55 57 56 58 var changes = 0; … … 59 61 }); 60 62 61 equal s(c.findControl("m1").getElement("messages").get(0), $m1.get(1), "lookup of messages element for input control.");63 equal(c.findControl("m1").getElement("messages").get(0), $m1.get(1), "lookup of messages element for input control."); 62 64 63 65 ok(c.findControl("m2").getElement("messages"), "creation of messages element for checkbox control."); … … 68 70 }); 69 71 70 equal s(changes, 1, "both members changes");71 equal s(c.hasChanges(), false, "initial value set");72 73 // equal s(validContainer.html(), "", "validation error cleared ok.");74 equal s(c.getValue().m1, okValue, "get-set value match - member m1");75 equal s(c.getValue().m2, false, "get-set value match - member m2.");76 77 78 equal s(c.getChildren().m1.getElement("messages").html(), "", "validation error cleared ok.");72 equal(changes, 1, "both members changes"); 73 equal(c.hasChanges(), false, "initial value set"); 74 75 // equal(validContainer.html(), "", "validation error cleared ok."); 76 equal(c.getValue().m1, okValue, "get-set value match - member m1"); 77 equal(c.getValue().m2, false, "get-set value match - member m2."); 78 79 80 equal(c.getChildren().m1.getElement("messages").html(), "", "validation error cleared ok."); 79 81 80 82 // Mocking user interaction... 81 83 c.findControl("m1").getElement("input").val(nokValue).change(); 82 equal s(changes, 2, "change detection");84 equal(changes, 2, "change detection"); 83 85 c.findControl("m2").getElement("input").attr("checked", "checked").click(); 84 equal s(changes, 3, "change detection");85 86 // equal s(validContainer.html(), nvalid.getMessage(), "validation error set correctly.");87 equal s(c.getValue().m1, nokValue, "get-set value match - member m1");88 equal s(c.getValue().m2, true, "get-set value match - member m2.");89 90 equal s(c.getChildren().m1.getElement("messages").html(), mockMsg, "validation error set correctly");86 equal(changes, 3, "change detection"); 87 88 // equal(validContainer.html(), nvalid.getMessage(), "validation error set correctly."); 89 equal(c.getValue().m1, nokValue, "get-set value match - member m1"); 90 equal(c.getValue().m2, true, "get-set value match - member m2."); 91 92 equal(c.getChildren().m1.getElement("messages").html(), mockMsg, "validation error set correctly"); 91 93 92 94 // cleanup … … 134 136 var c = form.findControl(id); 135 137 ok(c != null, "control creation passed"); 136 equals(c.getForm(),form, "control form ok");137 equal s(c.getId(), id, "control id checked");138 ok(c.getForm() == form, "control form ok"); 139 equal(c.getId(), id, "control id checked"); 138 140 139 141 c.setWireValue( {"m1" : 5, "m2" : 2 }); 140 142 141 isSet(c.getElement("messages"), $msg, "used created messages.");143 sameJq(c.getElement("messages"), $msg, "used created messages."); 142 144 ok(c.getElement("messages").html().indexOf("is not") == -1, "validation error set correctly"); 143 145 c.findControl("m1").getElement("input").val(1).change(); … … 180 182 var c = form.findControl(id); 181 183 ok(c != null, "control creation passed"); 182 equals(c.getForm(),form, "control form ok");183 equal s(c.getId(), id, "control id checked");184 ok(c.getForm() == form, "control form ok"); 185 equal(c.getId(), id, "control id checked"); 184 186 185 187 c.hide(); … … 201 203 // cleanup 202 204 $main.html("").hide(); 203 }); 205 206 }); 207 208 }); -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-date.js
r1849 r1896 1 $(document).ready(function(){ 2 1 3 module('Date Testing type and control'); 2 4 … … 198 200 var c = form.findControl(id); 199 201 ok(c != null, "control creation passed"); 200 equals(c.getForm(),form, "control form ok");201 equal s(c.getId(), id, "control id checked");202 ok(c.getForm() == form, "control form ok"); 203 equal(c.getId(), id, "control id checked"); 202 204 203 205 … … 214 216 c.setWireValue(wireValue); 215 217 ok($.valueCompare(okValue,c.getValue()), "get-set value match."); 216 equal s(changes, 1, "missed a value-change event");218 equal(changes, 1, "missed a value-change event"); 217 219 218 220 // mock user interaction: change value to something that doesn't validate 219 221 c.getChild("start").getElement("input").val(nokUserValue.start).change(); 220 222 c.getChild("end").getElement("input").val(nokUserValue.end).change(); 221 equal s(changes, 3, "missed a value-changed event");222 223 equal s(c.hasChanges(), true, "change state");223 equal(changes, 3, "missed a value-changed event"); 224 225 equal(c.hasChanges(), true, "change state"); 224 226 ok(c.getChild("start").getElement("messages").html().indexOf("Could not parse the date") >= 0, "validation error setting."); 225 227 var val = c.getValue(); 226 equal s(val, undefined, "get-set value match.");228 equal(val, undefined, "get-set value match."); 227 229 228 230 // mock user interaction: change value trigger change 229 231 c.getChild("start").getElement("input").val(okUserValue.start).change(); 230 232 c.getChild("end").getElement("input").val(okUserValue.end).change(); 231 equal s(changes, 5, "receiving value-change event");232 equal s(c.hasChanges(), true, "change state")233 equal(changes, 5, "receiving value-change event"); 234 equal(c.hasChanges(), true, "change state") 233 235 234 236 // cleanup … … 236 238 }); 237 239 238 239 // TODO implement the datetime control 240 //TODO implement the datetime control 240 241 /* 241 242 test("datetime-control", function() { … … 246 247 }); 247 248 */ 249 250 }); 251 248 252 function runDateControlTests (fieldTypeName, controlValues) { 249 253 … … 275 279 var c = form.findControl(id); 276 280 ok(c != null, "control creation passed"); 277 equals(c.getForm(),form, "control form ok");278 equal s(c.getId(), id, "control id checked");281 ok(c.getForm() == form, "control form ok"); 282 equal(c.getId(), id, "control id checked"); 279 283 280 284 var changes = 0; … … 294 298 c.setWireValue(wireValue); 295 299 296 equal s($msg.html(), "", "validation error clearing.");300 equal($msg.html(), "", "validation error clearing."); 297 301 ok($.valueCompare($.datepicker.parseDate("dd/mm/yy",okValue),c.getValue()), "get-set value match."); 298 302 299 303 // mock user interaction: change value to something that doesn't validate 300 304 c.getElement("input").val(nokValue).change(); 301 equal s(changes, 2, "this should not be receiving value-change events");302 equal s(c.hasChanges(), true, "change state");305 equal(changes, 2, "this should not be receiving value-change events"); 306 equal(c.hasChanges(), true, "change state"); 303 307 ok(String($msg.html()).indexOf("Could not parse the date") >= 0, "validation error setting."); 304 equal s( c.getValue(), undefined, "get-set value match.");308 equal( c.getValue(), undefined, "get-set value match."); 305 309 306 310 // mock user interaction: change value trigger change 307 311 c.getElement("input").val(ok2Value).change(); 308 equal s(changes, 3, "receiving value-change event");309 equal s(c.hasChanges(), true, "change state")312 equal(changes, 3, "receiving value-change event"); 313 equal(c.hasChanges(), true, "change state") 310 314 311 315 // cleanup -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-form.js
r1873 r1896 1 $(document).ready(function(){ 2 1 3 module('Form Checking'); 2 4 … … 60 62 61 63 var form = this.getForm(); 62 equal s(form.isComplete(), true, "checking form.isComplete while initializing...");64 equal(form.isComplete(), true, "checking form.isComplete while initializing..."); 63 65 this.wiringCalls++; 64 66 } … … 69 71 var form = new $.org.kauriproject.forms.Form($form, fconf); 70 72 71 equal s(form.isComplete(), true, "checking form.isComplete after initializing...");73 equal(form.isComplete(), true, "checking form.isComplete after initializing..."); 72 74 var m1c = form.findControl("/m1"); 73 equal s(m1c.wiringCalls, 1, "checking wiring-call happened after initializing...");75 equal(m1c.wiringCalls, 1, "checking wiring-call happened after initializing..."); 74 76 75 77 // normally one should never be calling this directly, but test shows the initEventWiring will only be called once 76 78 form.initComplete(); 77 equal s(m1c.wiringCalls, 1, "checking wiring-call unregistered itself after execution...");79 equal(m1c.wiringCalls, 1, "checking wiring-call unregistered itself after execution..."); 78 80 79 81 … … 83 85 }); 84 86 85 // equal s(validContainer.html(), "", "validation error cleared ok.");86 equal s(form.getValue().m1, okValue, "get-set value match - member m1");87 equal s(form.getValue().m2, false, "get-set value match - member m2.");88 89 equal s(form.getChildren().m1.getElement("messages").html(), "", "validation error cleared ok.");87 // equal(validContainer.html(), "", "validation error cleared ok."); 88 equal(form.getValue().m1, okValue, "get-set value match - member m1"); 89 equal(form.getValue().m2, false, "get-set value match - member m2."); 90 91 equal(form.getChildren().m1.getElement("messages").html(), "", "validation error cleared ok."); 90 92 91 93 form.setValue( { … … 94 96 }); 95 97 96 // equal s(validContainer.html(), nvalid.getMessage(), "validation error set correctly.");97 equal s(form.getValue().m1, nokValue, "get-set value match - member m1");98 equal s(form.getValue().m2, true, "get-set value match - member m2.");99 100 equal s(form.getChildren().m1.getElement("messages").html(), mockMsg, "validation error set correctly");98 // equal(validContainer.html(), nvalid.getMessage(), "validation error set correctly."); 99 equal(form.getValue().m1, nokValue, "get-set value match - member m1"); 100 equal(form.getValue().m2, true, "get-set value match - member m2."); 101 102 equal(form.getChildren().m1.getElement("messages").html(), mockMsg, "validation error set correctly"); 101 103 102 104 // cleanup … … 152 154 153 155 154 equal s(form.isComplete(), true, "checking form.isComplete after initializing...");156 equal(form.isComplete(), true, "checking form.isComplete after initializing..."); 155 157 var m1c = form.findControl("/m1"); 156 equal s(m1c.getType(), "FieldType('my-string')", "checking wiring-call happened after initializing...");158 equal(m1c.getType(), "FieldType('my-string')", "checking wiring-call happened after initializing..."); 157 159 158 160 // normally one should never be calling this directly, but test shows thet initEventWiring will only be called once 159 161 form.initComplete(); 160 equal s(m1c.getType(), "FieldType('my-string')", "checking wiring-call unregistered itself after execution...");162 equal(m1c.getType(), "FieldType('my-string')", "checking wiring-call unregistered itself after execution..."); 161 163 162 164 … … 166 168 }); 167 169 168 //equal s(validContainer.html(), "", "validation error cleared ok.");169 equal s(form.getValue().m1, "test", "get-set value match - member m1");170 equal s(form.getValue().m2, false, "get-set value match - member m2.");171 172 equal s(form.getChildren().m1.getElement("messages").html(), "", "validation error cleared ok.");170 //equal(validContainer.html(), "", "validation error cleared ok."); 171 equal(form.getValue().m1, "test", "get-set value match - member m1"); 172 equal(form.getValue().m2, false, "get-set value match - member m2."); 173 174 equal(form.getChildren().m1.getElement("messages").html(), "", "validation error cleared ok."); 173 175 174 176 form.setValue({ … … 177 179 }); 178 180 179 //equal s(validContainer.html(), nvalid.getMessage(), "validation error set correctly.");180 equal s(form.getValue().m1, nokValue, "get-set value match - member m1");181 equal s(form.getValue().m2, true, "get-set value match - member m2.");182 183 equal s(form.getChildren().m1.getElement("messages").html(), mockMsg, "validation error set correctly");181 //equal(validContainer.html(), nvalid.getMessage(), "validation error set correctly."); 182 equal(form.getValue().m1, nokValue, "get-set value match - member m1"); 183 equal(form.getValue().m2, true, "get-set value match - member m2."); 184 185 equal(form.getChildren().m1.getElement("messages").html(), mockMsg, "validation error set correctly"); 184 186 185 187 // cleanup … … 238 240 }); 239 241 240 equal s(form.findControl('details/0/val1').getValue(), 51, "value checked");241 equal s(form.findControl('details/1/val2').getValue(), 62, "value checked");242 equal(form.findControl('details/0/val1').getValue(), 51, "value checked"); 243 equal(form.findControl('details/1/val2').getValue(), 62, "value checked"); 242 244 243 245 // cleanup … … 313 315 var $subOptions = $("option", $subSelect); 314 316 315 equal s($mainOptions.length, 2, "correct number of options on main");316 equal s(mainC.getValue(), 'weekdays', "checking initial value set ok");317 318 equal s($subOptions.length, 7, "correct number of options on sub select");319 equal s(subC.getValue(), 'mon', "checking initial value set ok");317 equal($mainOptions.length, 2, "correct number of options on main"); 318 equal(mainC.getValue(), 'weekdays', "checking initial value set ok"); 319 320 equal($subOptions.length, 7, "correct number of options on sub select"); 321 equal(subC.getValue(), 'mon', "checking initial value set ok"); 320 322 321 323 // 1. set value on main & check updated list & updateOptions event … … 325 327 $subOptions = $("option", $subSelect); 326 328 327 equal s(subUpdates, 0, "update of options triggered");328 equal s($subOptions.length, 7, "correct number of options on sub select");329 equal(subUpdates, 0, "update of options triggered"); 330 equal($subOptions.length, 7, "correct number of options on sub select"); 329 331 330 332 // 2. set value on sub & check errors 331 333 $subSelect.val('wed').change(); // fake user input 332 equal s(subC.getValue(), 'wed', "checking value set ok");333 equal s(subC.getElement('mark').hasClass('invalid'), false, "checking error cleared.");334 equal s(subC.getElement('mark').hasClass('valid'), true, "checking error cleared.");334 equal(subC.getValue(), 'wed', "checking value set ok"); 335 equal(subC.getElement('mark').hasClass('invalid'), false, "checking error cleared."); 336 equal(subC.getElement('mark').hasClass('valid'), true, "checking error cleared."); 335 337 336 338 // 3. set other value on main & check - update list - updatedOptions event - check errors … … 338 340 $subOptions = $("option", $subSelect); 339 341 340 equal s(subUpdates, 1, "update of options triggered");341 equal s($subOptions.length, 12, "correct number of options on sub select");342 equal s(subC.getValue(), 'jan', "checking initial value set ok");343 equal s(subC.getElement('mark').hasClass('invalid'), false, "checking error cleared.");344 equal s(subC.getElement('mark').hasClass('valid'), true, "checking error cleared.");342 equal(subUpdates, 1, "update of options triggered"); 343 equal($subOptions.length, 12, "correct number of options on sub select"); 344 equal(subC.getValue(), 'jan', "checking initial value set ok"); 345 equal(subC.getElement('mark').hasClass('invalid'), false, "checking error cleared."); 346 equal(subC.getElement('mark').hasClass('valid'), true, "checking error cleared."); 345 347 346 348 // 4. set other value on sub & check errors 347 349 $subSelect.val('may').change(); // fake user input 348 equal s(subC.getValue(), 'may', "checking value set ok");349 equal s(subC.getElement('mark').hasClass('invalid'), false, "checking error cleared.");350 equal s(subC.getElement('mark').hasClass('valid'), true, "checking error cleared.");350 equal(subC.getValue(), 'may', "checking value set ok"); 351 equal(subC.getElement('mark').hasClass('invalid'), false, "checking error cleared."); 352 equal(subC.getElement('mark').hasClass('valid'), true, "checking error cleared."); 351 353 352 354 // cleanup … … 433 435 var $mainSelect = mainControl.getElement(); 434 436 var $mainOptions = $("option", $mainSelect); 435 equal s($mainOptions.length, 2, "correct number of options on main");436 equal s(mainControl.getValue(), 'weekdays', "checked initial value of main select");437 equal($mainOptions.length, 2, "correct number of options on main"); 438 equal(mainControl.getValue(), 'weekdays', "checked initial value of main select"); 437 439 438 440 var $subSelects = new Array(num); … … 441 443 var $subSelect = $subSelects[i]; 442 444 var $subOptions = $("option", $subSelect); 443 equal s($subOptions.length, 7, "correct number of options on sub select " + i);444 equal s(subControls[i].getValue(), 'mon', "checked initial value of sub select " + i);445 equal s(subControls[i].valueState, kf.Control.STATE_INIT, "checked initial value-state of sub select " + i);445 equal($subOptions.length, 7, "correct number of options on sub select " + i); 446 equal(subControls[i].getValue(), 'mon', "checked initial value of sub select " + i); 447 equal(subControls[i].valueState, kf.Control.STATE_INIT, "checked initial value-state of sub select " + i); 446 448 } 447 449 … … 452 454 $mainSelect.val('weekdays').change(); // fake user input 453 455 454 equal s(subUpdates, 0, "update of options not triggered"); // no change compared to default value! options already loaded456 equal(subUpdates, 0, "update of options not triggered"); // no change compared to default value! options already loaded 455 457 456 458 var w_set = ['mon', 'wed', 'fri']; … … 460 462 var $subSelect = $subSelects[i]; 461 463 var $subOptions = $("option", $subSelect); 462 equal s($subOptions.length, 7, "correct number of options on sub select " + i);463 equals(subControl.options,subOptions, "all options in the collection are shared. " + i);464 equal($subOptions.length, 7, "correct number of options on sub select " + i); 465 ok(subControl.options == subOptions, "all options in the collection are shared. " + i); 464 466 465 467 // 2. set value on sub & check errors … … 469 471 var subControl = subControls[i]; 470 472 471 equal s(subControl.getValue(), w_get[i], "checking value set ok");472 equal s(subControl.getElement('mark').hasClass('invalid'), false, "checking error cleared.");473 equal s(subControl.getElement('mark').hasClass('valid'), true, "checking error cleared.");473 equal(subControl.getValue(), w_get[i], "checking value set ok"); 474 equal(subControl.getElement('mark').hasClass('invalid'), false, "checking error cleared."); 475 equal(subControl.getElement('mark').hasClass('valid'), true, "checking error cleared."); 474 476 } 475 477 … … 477 479 // 3. set other value on main & check - update list - updatedOptions event - check errors 478 480 $mainSelect.val('months').change(); // fake user input 479 equal s(subUpdates, 1, "update of options triggered only once");481 equal(subUpdates, 1, "update of options triggered only once"); 480 482 481 483 var m_set = ['feb', 'xxx', 'sep']; … … 484 486 var $subSelect = $subSelects[i]; 485 487 var $subOptions = $("option", $subSelect); 486 equal s($subOptions.length, 12, "correct number of options on sub select " + i);488 equal($subOptions.length, 12, "correct number of options on sub select " + i); 487 489 488 490 // 4. set other value on sub & check errors … … 492 494 var subControl = subControls[i]; 493 495 494 equal s(subControl.getValue(), m_get[i], "checking value set ok");495 equal s(subControl.getElement('mark').hasClass('invalid'), false, "checking error cleared.");496 equal s(subControl.getElement('mark').hasClass('valid'), true, "checking error cleared.");496 equal(subControl.getValue(), m_get[i], "checking value set ok"); 497 equal(subControl.getElement('mark').hasClass('invalid'), false, "checking error cleared."); 498 equal(subControl.getElement('mark').hasClass('valid'), true, "checking error cleared."); 497 499 } 498 500 … … 585 587 var $mainSelect = mainControls[i].getElement(); 586 588 var $mainOptions = $("option", $mainSelect); 587 equal s($mainOptions.length, 2, "correct number of options on main " + i);588 equal s(mainControls[i].getValue(), 'weekdays', "checked initial value of main select " + i);589 equal($mainOptions.length, 2, "correct number of options on main " + i); 590 equal(mainControls[i].getValue(), 'weekdays', "checked initial value of main select " + i); 589 591 590 592 var $subSelect = subControls[i].getElement(); 591 593 var $subOptions = $("option", $subSelect); 592 equal s($subOptions.length, 7, "correct number of options on sub select " + i);593 equal s(subControls[i].getValue(), 'mon', "checked initial value of sub select " + i);594 equal($subOptions.length, 7, "correct number of options on sub select " + i); 595 equal(subControls[i].getValue(), 'mon', "checked initial value of sub select " + i); 594 596 595 597 } … … 618 620 619 621 expectedChanges[i] = (main_set[i] === 'weekdays') ? 0 : 1; 620 equal s(subUpdates[i], expectedChanges[i], "update of options triggered " + i);622 equal(subUpdates[i], expectedChanges[i], "update of options triggered " + i); 621 623 622 624 var $subSelect = subControls[i].getElement(); 623 625 var $subOptions = $("option", $subSelect); 624 equal s($subOptions.length, opt_lengths[main_set[i]], "correct number of options on sub select " + i);625 equal s(subType, commonSubType, "all types in the collection are shared. " + i);626 equal($subOptions.length, opt_lengths[main_set[i]], "correct number of options on sub select " + i); 627 equal(subType, commonSubType, "all types in the collection are shared. " + i); 626 628 627 629 // 2. set value on sub & check errors … … 631 633 var subControl = subControls[i]; 632 634 // var forced = true; 633 equal s(subControl.getValue(), sub_set[i], "checking value set ok " + i);634 // equal s(subControl.isValid(forced), true, "forced validation yields ok " + i);635 equal s(subControl.getElement('mark').hasClass('invalid'), false, "checking error cleared. " + i);636 equal s(subControl.getElement('mark').hasClass('valid'), true, "checking error cleared." + i);635 equal(subControl.getValue(), sub_set[i], "checking value set ok " + i); 636 // equal(subControl.isValid(forced), true, "forced validation yields ok " + i); 637 equal(subControl.getElement('mark').hasClass('invalid'), false, "checking error cleared. " + i); 638 equal(subControl.getElement('mark').hasClass('valid'), true, "checking error cleared." + i); 637 639 } 638 640 … … 647 649 var expectedUpdates = expectedChanges[i]; 648 650 expectedUpdates += (main_set[i] === main_set2[i]) ? 0 : 1; 649 equal s(subUpdates[i], expectedUpdates , "update of options triggered correctly " + i);651 equal(subUpdates[i], expectedUpdates , "update of options triggered correctly " + i); 650 652 651 653 var $subSelect = subControls[i].getElement(); 652 654 var $subOptions = $("option", $subSelect); 653 equal s($subOptions.length, opt_lengths[main_set2[i]], "correct number of options on sub select " + i);655 equal($subOptions.length, opt_lengths[main_set2[i]], "correct number of options on sub select " + i); 654 656 655 657 // 2. set value on sub & check errors … … 658 660 for (var i = 0; i<num; i++){ 659 661 var subControl = subControls[i]; 660 equal s(subControl.getValue(), sub_set2[i], "checking value set ok " + i);661 equal s(subControl.getElement('mark').hasClass('invalid'), false, "checking error cleared." + i);662 equal s(subControl.getElement('mark').hasClass('valid'), true, "checking error cleared. " + i);662 equal(subControl.getValue(), sub_set2[i], "checking value set ok " + i); 663 equal(subControl.getElement('mark').hasClass('invalid'), false, "checking error cleared." + i); 664 equal(subControl.getElement('mark').hasClass('valid'), true, "checking error cleared. " + i); 663 665 } 664 666 … … 832 834 } 833 835 834 equal s($casus.hasClass('valid'), valid, "casus should be " + classValidDescr + ".("+when+")");835 equal s($casus.hasClass('invalid'), false, "including no invalid markers.("+when+")");836 equal s(casus.isValid(false), valid, "casus has never been validated, it should be " + classValidDescr + ".("+when+")");837 equal s(casus.isValid(true), true, "but it should be actually valid when checking it.("+when+")");838 equal s($casus.hasClass('valid'), true, "and after checking should be marked as such.("+when+")");839 equal s($casus.hasClass('invalid'), false, "not even invalid ones.("+when+")");840 841 equal s($compos.hasClass('valid'), valid, "compos should be " + classValidDescr + ".("+when+")");842 equal s($compos.hasClass('invalid'), false, "and not invalid.("+when+")");843 equal s(compos.isValid(false), valid, "compos has never been validated, it should be " + classValidDescr + ".("+when+")");844 equal s(compos.isValid(true), true, "but it should be actually valid when checking it.("+when+")");845 equal s($compos.hasClass('valid'), true, "and after checking should be marked as such because it has an own validator.("+when+")");846 equal s($compos.hasClass('invalid'), false, "and thus not have an invalid mark.("+when+")");847 848 equal s($form.hasClass('valid'), valid, "form should be " + classValidDescr + ".("+when+")");849 equal s($form.hasClass('invalid'), false, "including no invalid markers.("+when+")");850 equal s(form.isValid(false), valid, "form has never been validated, it should be " + classValidDescr + ".("+when+")");851 equal s(form.isValid(true), true, "but it turns out to be valid if we really check it.("+when+" and forced validation)");852 equal s($form.hasClass('valid'), true, "and should also carry the mark. ("+when+" and forced validation)");853 equal s($form.hasClass('invalid'), false, "including no invalid markers.("+when+" and forced validation)");836 equal($casus.hasClass('valid'), valid, "casus should be " + classValidDescr + ".("+when+")"); 837 equal($casus.hasClass('invalid'), false, "including no invalid markers.("+when+")"); 838 equal(casus.isValid(false), valid, "casus has never been validated, it should be " + classValidDescr + ".("+when+")"); 839 equal(casus.isValid(true), true, "but it should be actually valid when checking it.("+when+")"); 840 equal($casus.hasClass('valid'), true, "and after checking should be marked as such.("+when+")"); 841 equal($casus.hasClass('invalid'), false, "not even invalid ones.("+when+")"); 842 843 equal($compos.hasClass('valid'), valid, "compos should be " + classValidDescr + ".("+when+")"); 844 equal($compos.hasClass('invalid'), false, "and not invalid.("+when+")"); 845 equal(compos.isValid(false), valid, "compos has never been validated, it should be " + classValidDescr + ".("+when+")"); 846 equal(compos.isValid(true), true, "but it should be actually valid when checking it.("+when+")"); 847 equal($compos.hasClass('valid'), true, "and after checking should be marked as such because it has an own validator.("+when+")"); 848 equal($compos.hasClass('invalid'), false, "and thus not have an invalid mark.("+when+")"); 849 850 equal($form.hasClass('valid'), valid, "form should be " + classValidDescr + ".("+when+")"); 851 equal($form.hasClass('invalid'), false, "including no invalid markers.("+when+")"); 852 equal(form.isValid(false), valid, "form has never been validated, it should be " + classValidDescr + ".("+when+")"); 853 equal(form.isValid(true), true, "but it turns out to be valid if we really check it.("+when+" and forced validation)"); 854 equal($form.hasClass('valid'), true, "and should also carry the mark. ("+when+" and forced validation)"); 855 equal($form.hasClass('invalid'), false, "including no invalid markers.("+when+" and forced validation)"); 854 856 } 855 857 … … 857 859 expect(1 + 3*18); 858 860 859 isSet(form.getElement(), $form, "the form is the form of course");861 sameJq(form.getElement(), $form, "the form is the form of course"); 860 862 assertValidState("after creation"); // validstate of css is unmarked 861 863 … … 869 871 // cleanup 870 872 $main.html("").hide(); 871 }); 873 874 }); 875 876 }); -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-numeric-range.js
r1849 r1896 1 $(document).ready(function(){ 2 1 3 module('Numeric-range testing type and control'); 2 4 … … 48 50 var c = form.findControl(id); 49 51 ok(c != null, "control creation passed"); 50 equals(c.getForm(),form, "control form ok");51 equal s(c.getId(), id, "control id checked");52 ok(c.getForm() == form, "control form ok"); 53 equal(c.getId(), id, "control id checked"); 52 54 53 55 … … 99 101 var c = form.findControl(id); 100 102 ok(c != null, "control creation passed"); 101 equals(c.getForm(),form, "control form ok");102 equal s(c.getId(), id, "control id checked");103 ok(c.getForm() == form, "control form ok"); 104 equal(c.getId(), id, "control id checked"); 103 105 104 106 … … 118 120 $slider.slider('values', 1, 7); $slider.slider('values', 0, 4); 119 121 var wireval = c.getWireValue(); 120 equal s(wireval.start, 4, "The control start member should have the same value as the input");121 equal s(wireval.end, 7, "The control end member should have the same value as the input");122 equal(wireval.start, 4, "The control start member should have the same value as the input"); 123 equal(wireval.end, 7, "The control end member should have the same value as the input"); 122 124 123 125 $main.html("").hide(); 126 124 127 }); 128 129 }); -
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/testPage.html
r1864 r1896 5 5 <title>Kauri Forms Main Test Page</title> 6 6 7 <link rel="Stylesheet" media="screen" href="../../../../../kauri-jquery/src/test/qunit/testsuite.css" /> 8 <script type="text/javascript" src="../../../../../kauri-jquery/src/main/kauri/static/jquery/jquery-1.4.1/jquery-1.4.1.js"></script> 9 <script type="text/javascript" src="../../../../../kauri-jquery/src/test/qunit/testrunner.js"></script> 7 <link rel="Stylesheet" media="screen" href="../../../../../kauri-jquery/src/test/qunit/qunit.css" /> 8 <style type="text/css" > 9 .qunit-like { 10 padding: 0.5em 0.5em 0.5em 2.5em; 11 color: #2B81AF; 12 background-color: #D2E0E6; 13 border-bottom: 1px solid white; 14 font-size: small; 15 margin: 0; 16 } 17 </style> 18 <script type="text/javascript" src="../../../../../kauri-jquery/src/main/kauri/static/jquery/jquery-1.5.2/jquery-1.5.2.js"></script> 19 <script type="text/javascript" src="../../../../../kauri-jquery/src/test/qunit/qunit.js"></script> 10 20 11 21 <!-- Dependencies --> … … 15 25 <script type="text/javascript" src="../../../../../kauri-jquery/src/main/kauri/static-{build}.key/kauri.util/locale.js" ></script> 16 26 17 <script type="text/javascript" src="../../../../../kauri-jquery/src/main/kauri/static/jquery.ui/jquery.ui-1. 7.1/js/jquery-ui-1.7.1.min.js"></script>27 <script type="text/javascript" src="../../../../../kauri-jquery/src/main/kauri/static/jquery.ui/jquery.ui-1.8.11/js/jquery-ui-1.8.11.min.js"></script> 18 28 19 29 … … 46 56 //tests assume some standard locale setting 47 57 //we override those! 48 ; 58 var kf = $.org.kauriproject.forms; 59 60 function sameJq(first, second, msg) { 61 if (first == null || second == null || first.length != second.length) 62 fail(msg); 63 for (var i=0; i<first.length; i++) 64 if (first.get(i) != second.get(i)) 65 fail(msg + " -- not same @index=" + i); 66 ok(true, msg); 67 }; 68 49 69 (function($){ 50 var locale = $.org.kauriproject.forms.locale;70 var locale = kf.locale; 51 71 locale.setId('en-US'); 52 72 locale.separator['decimal'] = '.'; 53 73 locale.separator['1000'] = ','; 54 74 locale.timezone = 0; 55 })(jQuery); 75 })(jQuery); 76 56 77 </script> 57 78 <script type="text/javascript" src="test-basic-validators.js" ></script> … … 65 86 <script type="text/javascript" src="test-date.js" ></script> 66 87 <script type="text/javascript" src="test-numeric-range.js" ></script> 88 67 89 <!-- Haven't found a way to test the control since the page has to be completly loaded to be able to load the maps api 68 90 <script type="text/javascript" src="test-location.js" ></script> 69 91 --> 92 93 <!-- 70 94 <link rel="stylesheet" href="../../main/kauri/public/css/datepicker.css"/> 95 --> 71 96 <!-- TODO link to css of ui theme --> 72 97 … … 74 99 75 100 <body id="body"> 76 <h1 id="header">Kauri Forms Main Test Page</h1> 77 <h2 id="banner"></h2> 78 <h2 id="userAgent"></h2> 79 <h2>Note: to run these tests in google chrome: close all instances and start-up with --allow-file-access-from-files</h2> 101 <h1 id="qunit-header">Kauri Forms Main Test Page</h1> 102 <h2 id="qunit-banner"></h2> 103 <div id="qunit-testrunner-toolbar"></div> 104 <h2 id="qunit-userAgent"></h2> 105 <h2 class="qunit-like"> 106 Note: to run these tests in google chrome: close all instances and start-up with --allow-file-access-from-files 107 </h2> 108 109 <!-- Test HTML --> 110 <div id="main" style="display: none;"></div> 80 111 81 <!-- Test HTML --> 82 <div id="main" style="display: none;"> 83 84 </div> 112 <ol id="qunit-tests"></ol> 113 <div id="qunit-fixture">test markup, will be hidden</div> 85 114 <ol id="tests"></ol> 86 115 </body>
Note: See TracChangeset
for help on using the changeset viewer.