[explorev2] adding support for client side validators on controls (#1920)

* Adding support for client side validators on controls

* Applying validators to more fields

* Addressing comments
This commit is contained in:
Maxime Beauchemin
2017-01-12 09:21:17 -08:00
committed by GitHub
parent fc74fbeeaa
commit 470a6e9d76
20 changed files with 237 additions and 105 deletions

View File

@@ -7,13 +7,13 @@ import { exploreReducer } from '../../../javascripts/explorev2/reducers/exploreR
describe('reducers', () => {
it('sets correct field value given a key and value', () => {
const newState = exploreReducer(
initialState('dist_bar'), actions.setFieldValue('table', 'x_axis_label', 'x'));
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', () => {
it('setFieldValue works as expected with a checkbox', () => {
const newState = exploreReducer(initialState('dist_bar'),
actions.setFieldValue('table', 'show_legend'));
expect(newState.viz.form_data.show_legend).to.equal(false);
actions.setFieldValue('show_legend', true));
expect(newState.viz.form_data.show_legend).to.equal(true);
});
it('adds a filter given a new filter', () => {
const newState = exploreReducer(initialState('table'),