mirror of https://github.com/apache/superset.git
Dashboard filter box default (#6236)
* Setting default FilterBox date filter to No Filter * Adding test for FilterBox
This commit is contained in:
parent
59109f62b4
commit
d34217ef97
|
@ -0,0 +1,25 @@
|
|||
import { FORM_DATA_DEFAULTS } from './shared.helper';
|
||||
|
||||
export default () => describe('FilterBox', () => {
|
||||
const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'filter_box' };
|
||||
|
||||
function verify(formData) {
|
||||
cy.visitChartByParams(JSON.stringify(formData));
|
||||
cy.verifySliceSuccess({ waitAlias: '@getJson' });
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
cy.server();
|
||||
cy.login();
|
||||
cy.route('POST', '/superset/explore_json/**').as('getJson');
|
||||
});
|
||||
|
||||
it('should work with default date filter', () => {
|
||||
verify(VIZ_DEFAULTS);
|
||||
// Filter box should default to having a date filter with no filter selected
|
||||
cy.get('div.filter_box').within(() => {
|
||||
cy.get('span').contains('No filter');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
|
@ -5,6 +5,7 @@ import BubbleTest from './bubble';
|
|||
import CompareTest from './compare';
|
||||
import DistBarTest from './dist_bar';
|
||||
import DualLineTest from './dual_line';
|
||||
import FilterBox from './filter_box';
|
||||
import HistogramTest from './histogram';
|
||||
import LineTest from './line';
|
||||
import PieTest from './pie';
|
||||
|
@ -23,6 +24,7 @@ describe('All Visualizations', () => {
|
|||
CompareTest();
|
||||
DistBarTest();
|
||||
DualLineTest();
|
||||
FilterBox();
|
||||
HistogramTest();
|
||||
LineTest();
|
||||
PieTest();
|
||||
|
|
|
@ -123,7 +123,7 @@ class FilterBox extends React.Component {
|
|||
label={t('Time range')}
|
||||
description={t('Select start and end date')}
|
||||
onChange={(...args) => { this.changeFilter(TIME_RANGE, ...args); }}
|
||||
value={this.state.selectedValues[TIME_RANGE]}
|
||||
value={this.state.selectedValues[TIME_RANGE] || 'No filter'}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue