Vliu put datasource in store (#1610)

* Move datasource from global store object to form_data

* Moved datasource_id  and datasource_name to form_data

* Refetch defaultFormData when switching datasource

* Fixed js tests
This commit is contained in:
vera-liu
2016-11-17 09:26:25 -08:00
committed by GitHub
parent ab5da5ba28
commit 4f7f437527
9 changed files with 76 additions and 48 deletions

View File

@@ -6,11 +6,12 @@ import { exploreReducer } from '../../../javascripts/explorev2/reducers/exploreR
describe('reducers', () => {
it('sets correct field value given a key and value', () => {
const newState = exploreReducer(initialState, actions.setFieldValue('x_axis_label', 'x'));
const newState = exploreReducer(
initialState('dist_bar'), actions.setFieldValue('x_axis_label', 'x'));
expect(newState.viz.form_data.x_axis_label).to.equal('x');
});
it('toggles a boolean field value given only a key', () => {
const newState = exploreReducer(initialState, actions.setFieldValue('show_legend'));
const newState = exploreReducer(initialState('dist_bar'), actions.setFieldValue('show_legend'));
expect(newState.viz.form_data.show_legend).to.equal(false);
});
});