收口 Makelore 客户端变更
This commit is contained in:
49
tests/unit/modal-layering.test.tsx
Normal file
49
tests/unit/modal-layering.test.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
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]');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user