Added controls for Table Viz (#1253)

* Added controls for Table Viz

* Change control panel container to stateless

* Changed specs

* Resolved conflicts
This commit is contained in:
vera-liu
2016-10-05 14:53:51 -07:00
committed by GitHub
parent 659bf6d7e8
commit 66b498de25
11 changed files with 294 additions and 85 deletions

View File

@@ -16,34 +16,20 @@ describe('reducers', () => {
expect(newState.vizType).to.equal('bar');
});
it('should return new state with added column', () => {
const newColumn = 'col';
const newState = exploreReducer(initialState, actions.addColumn(newColumn));
expect(newState.columns).to.deep.equal([newColumn]);
it('should return new state with not groupby columns', () => {
const newColumn = ['col'];
const newState = exploreReducer(initialState, actions.setNotGroupByColumns(newColumn));
expect(newState.columns).to.deep.equal(['col']);
});
it('should return new state with removed column', () => {
const testState = { initialState, columns: ['col1', 'col2'] };
const remColumn = 'col1';
const newState = exploreReducer(testState, actions.removeColumn(remColumn));
expect(newState.columns).to.deep.equal(['col2']);
});
it('should return new state with added ordering', () => {
const newOrdering = 'ord';
const newState = exploreReducer(initialState, actions.addOrdering(newOrdering));
it('should return new state with orderings', () => {
const newOrdering = ['ord'];
const newState = exploreReducer(initialState, actions.setOrderings(newOrdering));
expect(newState.orderings).to.deep.equal(['ord']);
});
it('should return new state with removed ordering', () => {
const testState = { initialState, orderings: ['ord1', 'ord2'] };
const remOrdering = 'ord1';
const newState = exploreReducer(testState, actions.removeOrdering(remOrdering));
expect(newState.orderings).to.deep.equal(['ord2']);
});
it('should return new state with time stamp', () => {
const newState = exploreReducer(initialState, actions.setTimeStamp(1));
const newState = exploreReducer(initialState, actions.setTimeStampFormat(1));
expect(newState.timeStampFormat).to.equal(1);
});