mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
add new slice form improvements (#2928)
* dont set first datasource as default * not used * add a disabled class if datasource is not selected * sort datasources alphabettically * make btn disabled is no datasource is selected * fix linting
This commit is contained in:
@@ -32,7 +32,27 @@ describe('AddSliceContainer', () => {
|
||||
expect(wrapper.find(Button)).to.have.lengthOf(1);
|
||||
});
|
||||
|
||||
it('renders a disabled button if no datasource is selected', () => {
|
||||
expect(wrapper.find(Button).dive().find('.btn[disabled=true]')).to.have.length(1);
|
||||
});
|
||||
|
||||
it('renders an enabled button if datasource is selected', () => {
|
||||
const datasourceValue = defaultProps.datasources[0].value;
|
||||
wrapper.setState({
|
||||
datasourceValue,
|
||||
datasourceId: datasourceValue.split('__')[0],
|
||||
datasourceType: datasourceValue.split('__')[1],
|
||||
});
|
||||
expect(wrapper.find(Button).dive().find('.btn[disabled=false]')).to.have.length(1);
|
||||
});
|
||||
|
||||
it('formats explore url', () => {
|
||||
const datasourceValue = defaultProps.datasources[0].value;
|
||||
wrapper.setState({
|
||||
datasourceValue,
|
||||
datasourceId: datasourceValue.split('__')[0],
|
||||
datasourceType: datasourceValue.split('__')[1],
|
||||
});
|
||||
const formattedUrl = '/superset/explore/table/1?form_data=%7B%22viz_type%22%3A%22table%22%7D';
|
||||
expect(wrapper.instance().exploreUrl()).to.equal(formattedUrl);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user