Skip to content

Commit 291424d

Browse files
committed
chore(Collapse): add unit test for open panel behavior
1 parent b5011da commit 291424d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.test.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,21 @@ describe('ExtraOptions Component', () => {
220220
);
221221
expect(sqlLabTab).toHaveAttribute('aria-expanded', 'false');
222222
});
223+
224+
test('all collapse panels should expand when clicking anywhere on the header', () => {
225+
renderComponent();
226+
const allPanelTabs = screen.getAllByRole('tab');
227+
expect(allPanelTabs.length).toBeGreaterThanOrEqual(4); // At least 4 main panels
228+
229+
allPanelTabs.forEach(panelTab => {
230+
// Initially should be collapsed
231+
expect(panelTab).toHaveAttribute('aria-expanded', 'false');
232+
// Click on the panel tab (entire header should be clickable)
233+
fireEvent.click(panelTab);
234+
expect(panelTab).toHaveAttribute('aria-expanded', 'true');
235+
fireEvent.click(panelTab);
236+
// Panel should collapse back
237+
expect(panelTab).toHaveAttribute('aria-expanded', 'false');
238+
});
239+
});
223240
});

0 commit comments

Comments
 (0)