adjust minor test config: global mock of HTML functions and addition of test-id
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user