Skip to content

Commit

Permalink
add validation rule for VisualizeModal
Browse files Browse the repository at this point in the history
- add check for requiresDimension
- add check for requiresAggregationFn
- use chart types defined from visTypes.js
  • Loading branch information
Grace Guo committed May 28, 2017
1 parent f705ff7 commit 1c523d4
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions superset/assets/spec/javascripts/sqllab/VisualizeModal_spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,19 @@ describe('VisualizeModal', () => {
});

describe('render', () => {
const wrapper = getVisualizeModalWrapper();
expect(wrapper.find(Modal)).to.have.length(1);
it('should have 4 chart types', () => {
const wrapper = getVisualizeModalWrapper();
expect(wrapper.find(Modal)).to.have.length(1);

const selectorOptions = wrapper.find(Modal).dive()
.find(Modal.Body).dive()
.find(Select)
.props().options;
expect(selectorOptions).to.have.length(4);
const selectorOptions = wrapper.find(Modal).dive()
.find(Modal.Body).dive()
.find(Select)
.props().options;
expect(selectorOptions).to.have.length(4);

const selectorOptionsValues =
Object.keys(selectorOptions).map(key => selectorOptions[key].value);
expect(selectorOptionsValues).to.have.same.members(['bar', 'line', 'pie', 'dist_bar']);
const selectorOptionsValues =
Object.keys(selectorOptions).map(key => selectorOptions[key].value);
expect(selectorOptionsValues).to.have.same.members(['bar', 'line', 'pie', 'dist_bar']);
});
});
});

0 comments on commit 1c523d4

Please sign in to comment.