datahub/test/model.test.js
Rufus Pollock cf42e43ff0 [#25,model][s]: introduce new Field Model and FieldList collection and attach to Dataset.
* NB: no refactoring elsewhere yet to take account of this
* model.test.js: tests for Field (first proper model tests!)
2012-02-18 07:33:15 +00:00

22 lines
612 B
JavaScript

(function ($) {
module("Model");
test('Field: basics', function () {
var field = new recline.Model.Field({
id: 'x'
});
equal(field.attributes.label, 'x', 'Field label should be set from id');
var field = new recline.Model.Field({
id: 'x',
label: 'My label'
});
equal(field.attributes.label, 'My label', 'Field label should be set from id but not if explicitly provided');
var field = new recline.Model.Field('x');
equal(field.id, 'x', 'Set of id from single argumentst to ctor');
equal(field.attributes.id, 'x', 'Set of id from single argumentst to ctor');
});
})(this.jQuery);