mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
fix(alerts): show screenshot width field for PDF reports (#37037)
This commit is contained in:
@@ -528,6 +528,30 @@ test('does not show screenshot width when csv is selected', async () => {
|
||||
expect(screen.queryByRole('spinbutton')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('shows screenshot width when PDF is selected', async () => {
|
||||
render(<AlertReportModal {...generateMockedProps(false, true, false)} />, {
|
||||
useRedux: true,
|
||||
});
|
||||
userEvent.click(screen.getByTestId('contents-panel'));
|
||||
await screen.findByText(/test chart/i);
|
||||
const contentTypeSelector = screen.getByRole('combobox', {
|
||||
name: /select content type/i,
|
||||
});
|
||||
await comboboxSelect(contentTypeSelector, 'Chart', () =>
|
||||
screen.getByText(/select chart/i),
|
||||
);
|
||||
const reportFormatSelector = screen.getByRole('combobox', {
|
||||
name: /select format/i,
|
||||
});
|
||||
await comboboxSelect(
|
||||
reportFormatSelector,
|
||||
'PDF',
|
||||
() => screen.getAllByText(/Send as PDF/i)[0],
|
||||
);
|
||||
expect(screen.getByText(/screenshot width/i)).toBeInTheDocument();
|
||||
expect(screen.getByRole('spinbutton')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// Schedule Section
|
||||
test('opens Schedule Section on click', async () => {
|
||||
render(<AlertReportModal {...generateMockedProps(false, true, false)} />, {
|
||||
|
||||
@@ -513,7 +513,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
|
||||
|
||||
const [isScreenshot, setIsScreenshot] = useState<boolean>(false);
|
||||
useEffect(() => {
|
||||
setIsScreenshot(reportFormat === 'PNG');
|
||||
setIsScreenshot(reportFormat === 'PNG' || reportFormat === 'PDF');
|
||||
}, [reportFormat]);
|
||||
|
||||
// Dropdown options
|
||||
|
||||
Reference in New Issue
Block a user