mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: show TIME COLUMN options in dashboard (#11210)
* fix: show TIME COLUMN options in dashboard * add unit test
This commit is contained in:
@@ -17,9 +17,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow, mount } from 'enzyme';
|
||||
|
||||
import FilterBox from 'src/visualizations/FilterBox/FilterBox';
|
||||
import SelectControl from 'src/explore/components/controls/SelectControl';
|
||||
|
||||
describe('FilterBox', () => {
|
||||
it('should only add defined non-predefined options to filtersChoices', () => {
|
||||
@@ -58,4 +59,30 @@ describe('FilterBox', () => {
|
||||
inst.setState({ selectedValues: { name: 'James' } });
|
||||
expect(inst.props.filtersChoices.name.length).toEqual(3);
|
||||
});
|
||||
|
||||
it('should support granularity_sqla options', () => {
|
||||
const wrapper = mount(
|
||||
<FilterBox
|
||||
chartId={1001}
|
||||
datasource={{
|
||||
id: 1,
|
||||
columns: [],
|
||||
databases: {},
|
||||
granularity_sqla: [
|
||||
['created_on', 'created_on'],
|
||||
['changed_on', 'changed_on'],
|
||||
],
|
||||
}}
|
||||
showSqlaTimeColumn
|
||||
instantFiltering
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(wrapper.find(SelectControl).props().choices).toEqual(
|
||||
expect.arrayContaining([
|
||||
['created_on', 'created_on'],
|
||||
['changed_on', 'changed_on'],
|
||||
]),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user