mirror of
https://github.com/apache/superset.git
synced 2026-04-14 05:34:38 +00:00
feat: add dashboard page full xlsx export (#24287)
Co-authored-by: Vitali Logvin <vitali.logvin@noogadev.com>
This commit is contained in:
@@ -45,6 +45,7 @@ const createProps = (viz_type = 'sunburst') =>
|
||||
exportCSV: jest.fn(),
|
||||
exportFullCSV: jest.fn(),
|
||||
exportXLSX: jest.fn(),
|
||||
exportFullXLSX: jest.fn(),
|
||||
forceRefresh: jest.fn(),
|
||||
handleToggleFullSize: jest.fn(),
|
||||
toggleExpandSlice: jest.fn(),
|
||||
@@ -223,6 +224,43 @@ test('Should not show export full CSV if report is not table', async () => {
|
||||
expect(screen.queryByText('Export to full .CSV')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('Export full Excel is under featureflag', async () => {
|
||||
// @ts-ignore
|
||||
global.featureFlags = {
|
||||
[FeatureFlag.ALLOW_FULL_CSV_EXPORT]: false,
|
||||
};
|
||||
const props = createProps('table');
|
||||
renderWrapper(props);
|
||||
userEvent.hover(screen.getByText('Download'));
|
||||
expect(await screen.findByText('Export to Excel')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Export to full Excel')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('Should "export full Excel"', async () => {
|
||||
// @ts-ignore
|
||||
global.featureFlags = {
|
||||
[FeatureFlag.ALLOW_FULL_CSV_EXPORT]: true,
|
||||
};
|
||||
const props = createProps('table');
|
||||
renderWrapper(props);
|
||||
expect(props.exportFullXLSX).toBeCalledTimes(0);
|
||||
userEvent.hover(screen.getByText('Download'));
|
||||
userEvent.click(await screen.findByText('Export to full Excel'));
|
||||
expect(props.exportFullXLSX).toBeCalledTimes(1);
|
||||
expect(props.exportFullXLSX).toBeCalledWith(371);
|
||||
});
|
||||
|
||||
test('Should not show export full Excel if report is not table', async () => {
|
||||
// @ts-ignore
|
||||
global.featureFlags = {
|
||||
[FeatureFlag.ALLOW_FULL_CSV_EXPORT]: true,
|
||||
};
|
||||
renderWrapper();
|
||||
userEvent.hover(screen.getByText('Download'));
|
||||
expect(await screen.findByText('Export to Excel')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Export to full Excel')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('Should "Show chart description"', () => {
|
||||
const props = createProps();
|
||||
renderWrapper(props);
|
||||
|
||||
Reference in New Issue
Block a user