fix(alerts): show screenshot width field for PDF reports (#37037)

This commit is contained in:
Abhishek Mishra
2026-02-07 00:49:18 +05:30
committed by GitHub
parent 46bca32677
commit e9ae212c1c
2 changed files with 25 additions and 1 deletions

View File

@@ -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)} />, {

View File

@@ -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