* TODO / problems: have hard-coded ticks to be yyyy-MMM but that may not work well for all time series (may need to guess this from the resolution of the data or allow user to configure)
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
module("View - Graph");
|
|
|
|
test('basics', function () {
|
|
var dataset = Fixture.getDataset();
|
|
var view = new recline.View.Graph({
|
|
model: dataset
|
|
});
|
|
$('.fixtures').append(view.el);
|
|
equal(view.state.get('graphType'), 'lines-and-points');
|
|
// view will auto render ...
|
|
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();
|
|
});
|
|
|
|
test('dates in graph view', function () {
|
|
var dataset = Fixture.getDataset();
|
|
var view = new recline.View.Graph({
|
|
model: dataset,
|
|
state: {
|
|
'graphType': 'lines',
|
|
'group': 'date',
|
|
'series': ['y', 'z']
|
|
}
|
|
});
|
|
$('.fixtures').append(view.el);
|
|
|
|
// view.remove();
|
|
});
|