fix: upload data model Collapse state (#32734)

This commit is contained in:
SBIN2010
2025-07-09 11:53:10 +03:00
committed by GitHub
parent d951158ce6
commit 0bc214e889
2 changed files with 66 additions and 0 deletions

View File

@@ -601,3 +601,59 @@ describe('File Extension Validation', () => {
});
});
});
describe('UploadDataModal Collapse Tabs', () => {
it('renders the collaps tab CSV correctly and resets to default tab after closing', () => {
const { rerender } = render(<UploadDataModal {...csvProps} />, {
useRedux: true,
});
const generalInfoTab = screen.getByRole('tab', {
name: /expanded General information Upload a file to a database./i,
});
expect(generalInfoTab).toHaveAttribute('aria-expanded', 'true');
const fileSettingsTab = screen.getByRole('tab', {
name: /collapsed File settings Adjust how spaces, blank lines, null values are handled and other file wide settings./i,
});
userEvent.click(fileSettingsTab);
expect(fileSettingsTab).toHaveAttribute('aria-expanded', 'true');
rerender(<UploadDataModal {...csvProps} show={false} />);
rerender(<UploadDataModal {...csvProps} />);
expect(generalInfoTab).toHaveAttribute('aria-expanded', 'true');
});
it('renders the collaps tab Excel correctly and resets to default tab after closing', () => {
const { rerender } = render(<UploadDataModal {...excelProps} />, {
useRedux: true,
});
const generalInfoTab = screen.getByRole('tab', {
name: /expanded General information Upload a file to a database./i,
});
expect(generalInfoTab).toHaveAttribute('aria-expanded', 'true');
const fileSettingsTab = screen.getByRole('tab', {
name: /collapsed File settings Adjust how spaces, blank lines, null values are handled and other file wide settings./i,
});
userEvent.click(fileSettingsTab);
expect(fileSettingsTab).toHaveAttribute('aria-expanded', 'true');
rerender(<UploadDataModal {...excelProps} show={false} />);
rerender(<UploadDataModal {...excelProps} />);
expect(generalInfoTab).toHaveAttribute('aria-expanded', 'true');
});
it('renders the collaps tab Columnar correctly and resets to default tab after closing', () => {
const { rerender } = render(<UploadDataModal {...columnarProps} />, {
useRedux: true,
});
const generalInfoTab = screen.getByRole('tab', {
name: /expanded General information Upload a file to a database./i,
});
expect(generalInfoTab).toHaveAttribute('aria-expanded', 'true');
const fileSettingsTab = screen.getByRole('tab', {
name: /collapsed File settings Adjust how spaces, blank lines, null values are handled and other file wide settings./i,
});
userEvent.click(fileSettingsTab);
expect(fileSettingsTab).toHaveAttribute('aria-expanded', 'true');
rerender(<UploadDataModal {...columnarProps} show={false} />);
rerender(<UploadDataModal {...columnarProps} />);
expect(generalInfoTab).toHaveAttribute('aria-expanded', 'true');
});
});