Identity e-mail notifications, ASF-hosting en testfixes (run 636) #11
@@ -27,6 +27,39 @@ describe('AppLayout desktop', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('AppLayout scrolling', () => {
|
||||
// jsdom has no layout engine, so these assert the classes that make the browser behave: a one-screen-high
|
||||
// shell that does not scroll itself, with the content area as the only scroll container.
|
||||
it('is one screen high and does not scroll as a whole, so the sidebar stays put', async () => {
|
||||
mockAuthenticated();
|
||||
renderApp('/dashboard');
|
||||
const shell = await screen.findByTestId('app-shell');
|
||||
|
||||
expect(shell).toHaveClass('h-svh', 'overflow-hidden');
|
||||
expect(shell).not.toHaveClass('min-h-svh');
|
||||
});
|
||||
|
||||
it('scrolls only the content area', async () => {
|
||||
mockAuthenticated();
|
||||
renderApp('/dashboard');
|
||||
await screen.findByTestId('app-sidebar');
|
||||
|
||||
expect(screen.getByTestId('app-main')).toHaveClass('overflow-y-auto');
|
||||
expect(screen.getByTestId('app-sidebar-column')).toHaveClass('h-full');
|
||||
// The sidebar's own menu scrolls inside it on a very short screen, never the page.
|
||||
expect(screen.getByTestId('app-sidebar').querySelector('nav')).toHaveClass('overflow-y-auto');
|
||||
});
|
||||
|
||||
it('applies on every page of the shell, for example the settings page', async () => {
|
||||
mockAuthenticated();
|
||||
renderApp('/settings');
|
||||
await screen.findByTestId('settings-title', {}, { timeout: 10000 });
|
||||
|
||||
expect(screen.getByTestId('app-shell')).toHaveClass('h-svh', 'overflow-hidden');
|
||||
expect(screen.getByTestId('app-main')).toContainElement(screen.getByTestId('settings-title'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('AppLayout mobile menu', () => {
|
||||
it('opens sidebar overlay when hamburger is clicked', async () => {
|
||||
mockAuthenticated();
|
||||
|
||||
@@ -33,14 +33,17 @@ export function AppLayout() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex min-h-svh">
|
||||
<div className="hidden md:flex">
|
||||
// The shell is exactly one screen high and does not scroll itself: the sidebar stays where it is and
|
||||
// only the content area scrolls. (With min-h-svh the whole document scrolled as soon as the content
|
||||
// was a little taller than the screen, and the sidebar scrolled away with it.)
|
||||
<div className="flex h-svh overflow-hidden" data-testid="app-shell">
|
||||
<div className="hidden h-full md:flex" data-testid="app-sidebar-column">
|
||||
<Sidebar />
|
||||
</div>
|
||||
{isMenuOpen && <SidebarOverlay onClose={() => setIsMenuOpen(false)} />}
|
||||
<div className="flex flex-1 flex-col">
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<MobileBar onMenuOpen={() => setIsMenuOpen(true)} />
|
||||
<main className="flex-1 p-6" data-testid="app-main">
|
||||
<main className="flex-1 overflow-y-auto p-6" data-testid="app-main">
|
||||
<Outlet />
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@@ -81,7 +81,7 @@ export function Sidebar({ onClose }: SidebarProps = {}) {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<nav className="flex-1 space-y-1 p-3">
|
||||
<nav className="flex-1 space-y-1 overflow-y-auto p-3">
|
||||
{visibleItems.map((item) => {
|
||||
const Icon = item.icon;
|
||||
const blocked = systemUnavailable && !ALLOWED_WHEN_UNAVAILABLE.some(p => item.to.startsWith(p));
|
||||
|
||||
Reference in New Issue
Block a user