[#85,view-graph][m]: graph controls are now correctly configure themselves from loaded state.
* Also heavily refactor to have a cleaner and better code e.g. using templating to add new series.
This commit is contained in:
@@ -11,3 +11,28 @@ test('basics', function () {
|
||||
assertPresent('.editor', view.el);
|
||||
view.remove();
|
||||
});
|
||||
|
||||
test('initialize', function () {
|
||||
var dataset = Fixture.getDataset();
|
||||
var view = new recline.View.Graph({
|
||||
model: dataset,
|
||||
state: {
|
||||
'graphType': 'lines',
|
||||
'group': 'x',
|
||||
'series': ['y', 'z']
|
||||
}
|
||||
});
|
||||
$('.fixtures').append(view.el);
|
||||
equal(view.state.get('graphType'), 'lines');
|
||||
deepEqual(view.state.get('series'), ['y', 'z']);
|
||||
|
||||
// check we have updated editor with state info
|
||||
equal(view.el.find('.editor-type select').val(), 'lines');
|
||||
equal(view.el.find('.editor-group select').val(), 'x');
|
||||
var out = _.map(view.el.find('.editor-series select'), function($el) {
|
||||
return $($el).val();
|
||||
});
|
||||
deepEqual(out, ['y', 'z']);
|
||||
|
||||
// view.remove();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user