datahub/test/model.test.js

24 lines
565 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');
raises(function() {
var field = new recline.Model.Field('xxx');
},
'should throw an error if not passed in a hash with id'
);
});
})(this.jQuery);