mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-10 05:10:58 +00:00
fix(ui): align sidebar pin controls
Keep the pin with the expanded header actions and center the collapsed version link with the navigation rail.
This commit is contained in:
@@ -21,14 +21,20 @@ function renderSidebar() {
|
||||
);
|
||||
}
|
||||
|
||||
test('keeps the sidebar expanded after pinning it and restores the choice', () => {
|
||||
test('keeps the sidebar expanded after pinning it from the header and restores the choice', () => {
|
||||
const first = renderSidebar();
|
||||
const sidebar = first.container.querySelector('.ant-layout-sider');
|
||||
const sidebarRoot = first.container.querySelector('.ant-sidebar');
|
||||
|
||||
expect(sidebar?.classList.contains('ant-layout-sider-collapsed')).toBe(true);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Pin sidebar' }));
|
||||
fireEvent.mouseLeave(first.container.querySelector('.ant-sidebar')!);
|
||||
fireEvent.mouseEnter(sidebarRoot!);
|
||||
|
||||
const pinButton = screen.getByRole('button', { name: 'Pin sidebar' });
|
||||
expect(pinButton.closest('.brand-actions')).not.toBeNull();
|
||||
|
||||
fireEvent.click(pinButton);
|
||||
fireEvent.mouseLeave(sidebarRoot!);
|
||||
|
||||
expect(sidebar?.classList.contains('ant-layout-sider-collapsed')).toBe(false);
|
||||
expect(localStorage.getItem('sidebar-pinned')).toBe('true');
|
||||
|
||||
Reference in New Issue
Block a user