Files
makelore/tests/unit/modal-layering.test.tsx
inman f4113a872f
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled
收口 Makelore 客户端变更
2026-08-12 22:43:09 +08:00

50 lines
1.2 KiB
TypeScript

import { cleanup, render, screen } from '@testing-library/react';
import { afterEach, describe, expect, it } from 'vitest';
import {
Dialog,
DialogContent,
DialogTitle,
} from '@/components/ui/dialog';
import {
Sheet,
SheetContent,
SheetTitle,
} from '@/components/ui/sheet';
function findOpenOverlay() {
return Array.from(document.querySelectorAll<HTMLElement>('[data-state="open"]'))
.find((element) => element.classList.contains('z-[100]'));
}
describe('modal layering', () => {
afterEach(() => {
cleanup();
});
it('places dialog content above the workspace sidebar layer', () => {
render(
<Dialog open>
<DialogContent>
<DialogTitle></DialogTitle>
</DialogContent>
</Dialog>,
);
expect(screen.getByRole('dialog')).toHaveClass('z-[110]');
expect(findOpenOverlay()).toHaveClass('z-[100]');
});
it('places sheet content above the workspace sidebar layer', () => {
render(
<Sheet open>
<SheetContent>
<SheetTitle></SheetTitle>
</SheetContent>
</Sheet>,
);
expect(screen.getByRole('dialog')).toHaveClass('z-[110]');
expect(findOpenOverlay()).toHaveClass('z-[100]');
});
});