formatting
This commit is contained in:
@@ -1,15 +1,12 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/svelte';
|
||||
import { describe, expect, it, test, vi } from "vitest";
|
||||
import { describe, expect, it, test, vi } from 'vitest';
|
||||
import NameItemEditor from '$lib/components/NameItemEditor.svelte';
|
||||
import { baseData } from './fixtures';
|
||||
|
||||
|
||||
|
||||
const testCrimesListIndex = 0;
|
||||
const testItem = baseData.crimesList[testCrimesListIndex];
|
||||
const testCurrentName = testItem.name;
|
||||
const testLocalName = 'Fall-C'
|
||||
|
||||
const testCurrentName = testItem.name;
|
||||
const testLocalName = 'Fall-C';
|
||||
|
||||
describe('NameItemEditor - Funktionalität', () => {
|
||||
const onSave = vi.fn();
|
||||
@@ -18,12 +15,13 @@ describe('NameItemEditor - Funktionalität', () => {
|
||||
list: baseData.crimesList,
|
||||
currentName: testCurrentName,
|
||||
onSave,
|
||||
onDelete}
|
||||
onDelete
|
||||
};
|
||||
|
||||
test.todo('FocusIn nach Klick auf edit')
|
||||
test.todo('FocusIn nach Klick auf edit');
|
||||
|
||||
it('zeigt initial Edit/Delete Buttons und aktuellen Namen', () => {
|
||||
render(NameItemEditor, {props: baseProps});
|
||||
render(NameItemEditor, { props: baseProps });
|
||||
|
||||
expect(screen.getByTestId('edit-button')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('delete-button')).toBeInTheDocument();
|
||||
@@ -33,7 +31,7 @@ describe('NameItemEditor - Funktionalität', () => {
|
||||
});
|
||||
|
||||
it('wechselt zu Commit/Cancel nach Klick auf Edit', async () => {
|
||||
render(NameItemEditor, {props: baseProps});
|
||||
render(NameItemEditor, { props: baseProps });
|
||||
await fireEvent.click(screen.getByTestId('edit-button'));
|
||||
const input = screen.getByTestId('test-input');
|
||||
|
||||
@@ -75,7 +73,7 @@ describe('NameItemEditor - Funktionalität', () => {
|
||||
await fireEvent.input(input, { target: { value: 'Fall-C' } });
|
||||
|
||||
expect(screen.queryByText('Name darf nicht leer sein.')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
it('zeigt Fehlermeldung bei Duplikat', async () => {
|
||||
const duplicateName = baseData.crimesList[1].name;
|
||||
|
||||
Reference in New Issue
Block a user