adjust minor test config: global mock of HTML functions and addition of test-id

This commit is contained in:
2025-11-20 09:52:37 +01:00
parent c7526be3c9
commit c81196343f
2 changed files with 10 additions and 9 deletions

View File

@@ -6,6 +6,14 @@ import { ROUTE_NAMES } from '../../src/routes';
import { actions } from '../../src/routes/(angemeldet)/list/+page.server';
import { createVorgang } from '$lib/server/vorgangService';
// mock animation features of the browser
window.HTMLElement.prototype.scrollIntoView = vi.fn();
window.HTMLElement.prototype.animate = vi.fn(() => ({
finished: Promise.resolve(),
cancel: vi.fn(),
}))
describe('Vorgänge Liste Page EmptyList-Komponente View', () => {
it('zeigt EmptyList-Komponente an, wenn Liste leer ist', () => {
const testData = { ...baseData, vorgangList: [] };
@@ -47,16 +55,8 @@ describe('Teste Links auf Korrektheit', () => {
});
async function clickPlusButton() {
// mock animation features of the browser
window.HTMLElement.prototype.scrollIntoView = vi.fn();
window.HTMLElement.prototype.animate = vi.fn(() => ({
finished: Promise.resolve(),
cancel: vi.fn(),
}))
// button is visible
const button = screen.getByRole('button')
const button = screen.getByTestId('expand-button')
expect(button).toBeInTheDocument();
await fireEvent.click(button)