[#145,view/refactor][m]: switch to a proper sidebar setup where views can have both a main element and a sidebar element and this added to central sidebar.
* this fixes functional and visual bugs with current (new) setup where fields where in separate in RHS sidebar * Refactored map and graph view to put menu/controls in the sidebar (this is quite nice!)
This commit is contained in:
@@ -8,7 +8,7 @@ test('basics', function () {
|
||||
$('.fixtures').append(view.el);
|
||||
equal(view.state.get('graphType'), 'lines-and-points');
|
||||
// view will auto render ...
|
||||
assertPresent('.editor', view.el);
|
||||
assertPresent('.editor', view.elSidebar);
|
||||
view.remove();
|
||||
});
|
||||
|
||||
@@ -27,9 +27,9 @@ test('initialize', function () {
|
||||
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) {
|
||||
equal(view.elSidebar.find('.editor-type select').val(), 'lines');
|
||||
equal(view.elSidebar.find('.editor-group select').val(), 'x');
|
||||
var out = _.map(view.elSidebar.find('.editor-series select'), function($el) {
|
||||
return $($el).val();
|
||||
});
|
||||
deepEqual(out, ['y', 'z']);
|
||||
@@ -51,3 +51,20 @@ test('dates in graph view', function () {
|
||||
|
||||
view.remove();
|
||||
});
|
||||
|
||||
test('GraphControls basics', function () {
|
||||
var dataset = Fixture.getDataset();
|
||||
var view = new recline.View.GraphControls({
|
||||
model: dataset,
|
||||
state: {
|
||||
graphType: 'bars',
|
||||
series: []
|
||||
}
|
||||
});
|
||||
$('.fixtures').append(view.el);
|
||||
equal(view.state.get('graphType'), 'bars');
|
||||
// view will auto render ...
|
||||
assertPresent('.editor', view.el);
|
||||
view.remove();
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ test('basics', function () {
|
||||
//Fire query, otherwise the map won't be initialized
|
||||
dataset.query();
|
||||
|
||||
assertPresent('.editor',view.el);
|
||||
assertPresent('.editor-field-type', view.elSidebar);
|
||||
|
||||
// Check that the Leaflet map was set up
|
||||
assertPresent('.leaflet-container',view.el);
|
||||
@@ -42,6 +42,21 @@ test('basics', function () {
|
||||
view.remove();
|
||||
});
|
||||
|
||||
test('_setupGeometryField', function () {
|
||||
var dataset = Fixture.getDataset();
|
||||
var view = new recline.View.Map({
|
||||
model: dataset
|
||||
});
|
||||
var exp = {
|
||||
geomField: null,
|
||||
lonField: 'lon',
|
||||
latField: 'lat',
|
||||
autoZoom: true
|
||||
};
|
||||
deepEqual(view.state.toJSON(), exp);
|
||||
deepEqual(view.menu.state.toJSON(), exp);
|
||||
});
|
||||
|
||||
test('Lat/Lon geom fields', function () {
|
||||
var dataset = Fixture.getDataset();
|
||||
var view = new recline.View.Map({
|
||||
@@ -138,6 +153,15 @@ test('Popup', function () {
|
||||
view.remove();
|
||||
});
|
||||
|
||||
test('MapMenu', function () {
|
||||
var dataset = Fixture.getDataset();
|
||||
var controls = new recline.View.MapMenu({
|
||||
model: dataset,
|
||||
state: {}
|
||||
});
|
||||
assertPresent('.editor-field-type', controls.el);
|
||||
});
|
||||
|
||||
var _getFeaturesCount = function(features){
|
||||
var cnt = 0;
|
||||
features._iterateLayers(function(layer){
|
||||
|
||||
Reference in New Issue
Block a user