[#25,view,refactor][s]: get views working with new field setup (fixes #25).

* One nastiness along the way (30m delay!) that is worth noting: flot graph was a problem because it turned out that a) (re-)render triggered by dataset attributes change and fields only got set *after* core dataset attributes and so info was rendering.
* model.test.js: basic test for Dataset.toTemplateJSON
This commit is contained in:
Rufus Pollock
2012-02-18 09:05:01 +00:00
parent 25c0177097
commit 4074f380d8
5 changed files with 24 additions and 16 deletions

View File

@@ -20,4 +20,12 @@ test('Field: basics', function () {
);
});
test('Dataset', function () {
var meta = {id: 'test', title: 'xyz'};
var dataset = new recline.Model.Dataset(meta);
dataset.fields = new recline.Model.FieldList([{id: 'xx'}, {id: 'yy'}]);
var out = dataset.toTemplateJSON();
equal(out.fields.length, 2);
});
})(this.jQuery);

View File

@@ -13,7 +13,7 @@ test('new DataTableRow View', function () {
var view = new recline.View.DataTableRow({
model: doc
, el: $el
, fields: ['a', 'b']
, fields: new recline.Model.FieldList([{id: 'a'}, {id: 'b'}])
});
view.render();
ok($el.attr('data-id'), '1');