Changeset 1867
- Timestamp:
- 2011-02-24 08:51:02 (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/kauri-forms/kauri-forms-framework/src/test/kauri.forms/test-collection.js
r1856 r1867 272 272 $main.html("").hide(); 273 273 }); 274 275 test("collection 'add' button (trac #417)", function() { 276 // create 277 var $main = $('#main').show(); 278 279 var id = "tcoll4"; 280 var fconf = { "members": {}}; 281 var fconf = { 282 "members": { 283 "tcoll4": { 284 "base": "collection", 285 "label": "Countries", 286 "control": { 287 "base": "collection-control", 288 "templates" : { 289 "layout": "<div kauri-role='input' style='border-style: dashed; border-width: 1px; margin: 10px; padding: 10px;'><span kauri-role='label'/><span kauri-role='control'/><span kauri-role='messages'/><input type='button' kauri-role='delete' value='Delete'/></div>", 290 "control": "<div kauri-role='container' ></div><input type='button' kauri-role='add' value='Add'></div>" 291 } 292 }, 293 "child": { 294 "members": { 295 "name": "string", 296 "capital": "string", 297 "area": "integer" 298 } 299 } 300 } 301 } 302 } 303 304 var $form = $("<form />").appendTo($main); 305 var form = new $.org.kauriproject.forms.Form($form, fconf); 306 307 expect(6); 308 309 // verify creation of control 310 var c = form.findControl(id); 311 312 // baseline checks 313 ok(c != null, "control creation passed"); 314 equals(c.getForm(), form, "control form ok"); 315 equals(c.getId(), id, "control id checked"); 316 317 // test that there are 0 children initially 318 equals(0, c.getChildren().length, "collection control should have 0 children"); 319 320 // find the 'ads' button and click it 321 var $addButton = $form.find("input[kauri-role='add']"); // this doesn't work (why?) 322 ok($addButton.length == 1, "found the add button"); 323 324 $addButton.click(); 325 326 // 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 });
Note: See TracChangeset
for help on using the changeset viewer.