style: add eslint and prettier, fix style errors
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
import AppHeader from "$components/layout/AppHeader.svelte";
|
||||
import { themeState } from "$states/theme.svelte";
|
||||
import { render, screen } from "@testing-library/svelte";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
describe("AppHeader.svelte", () => {
|
||||
beforeEach(() => {
|
||||
themeState.current = "dark";
|
||||
});
|
||||
|
||||
it("should toggle theme on button click", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(AppHeader);
|
||||
|
||||
const toggleButton = screen.getByRole("button", { name: /toggle theme/i });
|
||||
|
||||
themeState.current = "dark";
|
||||
await user.click(toggleButton);
|
||||
expect(themeState.current).toBe("light");
|
||||
|
||||
await user.click(toggleButton);
|
||||
expect(themeState.current).toBe("dark");
|
||||
});
|
||||
});
|
||||
import AppHeader from "$components/layout/AppHeader.svelte";
|
||||
import { themeState } from "$states/theme.svelte";
|
||||
import { render, screen } from "@testing-library/svelte";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
describe("AppHeader.svelte", () => {
|
||||
beforeEach(() => {
|
||||
themeState.current = "dark";
|
||||
});
|
||||
|
||||
it("should toggle theme on button click", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(AppHeader);
|
||||
|
||||
const toggleButton = screen.getByRole("button", { name: /toggle theme/i });
|
||||
|
||||
themeState.current = "dark";
|
||||
await user.click(toggleButton);
|
||||
expect(themeState.current).toBe("light");
|
||||
|
||||
await user.click(toggleButton);
|
||||
expect(themeState.current).toBe("dark");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { render, screen } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import CardTest from "./CardTest.svelte";
|
||||
|
||||
describe("Card.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
render(CardTest);
|
||||
expect(screen.getByText("Test Title")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("card-content")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
import { render, screen } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import CardTest from "./CardTest.svelte";
|
||||
|
||||
describe("Card.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
render(CardTest);
|
||||
expect(screen.getByText("Test Title")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("card-content")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import Card from "$components/layout/Card.svelte";
|
||||
</script>
|
||||
|
||||
<Card title="Test Title">
|
||||
<div data-testid="card-content">Test content</div>
|
||||
</Card>
|
||||
<script>
|
||||
import Card from "$components/layout/Card.svelte";
|
||||
</script>
|
||||
|
||||
<Card title="Test Title">
|
||||
<div data-testid="card-content">Test content</div>
|
||||
</Card>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { render, screen } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import InputGroupTest from "./InputGroupTest.svelte";
|
||||
|
||||
describe("InputGroup.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
render(InputGroupTest);
|
||||
expect(screen.getByTestId("input1")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("input2")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("button")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
import { render, screen } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import InputGroupTest from "./InputGroupTest.svelte";
|
||||
|
||||
describe("InputGroup.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
render(InputGroupTest);
|
||||
expect(screen.getByTestId("input1")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("input2")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("button")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script>
|
||||
import InputGroup from "$components/layout/InputGroup.svelte";
|
||||
</script>
|
||||
|
||||
<InputGroup>
|
||||
<input type="text" data-testid="input1" />
|
||||
<input type="text" data-testid="input2" />
|
||||
<button data-testid="button">Кнопка</button>
|
||||
</InputGroup>
|
||||
<script>
|
||||
import InputGroup from "$components/layout/InputGroup.svelte";
|
||||
</script>
|
||||
|
||||
<InputGroup>
|
||||
<input type="text" data-testid="input1" />
|
||||
<input type="text" data-testid="input2" />
|
||||
<button data-testid="button">Кнопка</button>
|
||||
</InputGroup>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import PanelBar from "$components/layout/PanelBar.svelte";
|
||||
import { render } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("PanelBar.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
const { container } = render(PanelBar);
|
||||
expect(container).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
import PanelBar from "$components/layout/PanelBar.svelte";
|
||||
import { render } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("PanelBar.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
const { container } = render(PanelBar);
|
||||
expect(container).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { render, screen } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import SettingsGridTest from "./SettingsGridTest.svelte";
|
||||
|
||||
describe("SettingsGrid.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
render(SettingsGridTest);
|
||||
expect(screen.getByTestId("item1")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("item2")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("item3")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
import { render, screen } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import SettingsGridTest from "./SettingsGridTest.svelte";
|
||||
|
||||
describe("SettingsGrid.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
render(SettingsGridTest);
|
||||
expect(screen.getByTestId("item1")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("item2")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("item3")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script>
|
||||
import SettingsGrid from "$components/layout/SettingsGrid.svelte";
|
||||
</script>
|
||||
|
||||
<SettingsGrid>
|
||||
<div data-testid="item1">Item 1</div>
|
||||
<div data-testid="item2">Item 2</div>
|
||||
<div data-testid="item3">Item 3</div>
|
||||
</SettingsGrid>
|
||||
<script>
|
||||
import SettingsGrid from "$components/layout/SettingsGrid.svelte";
|
||||
</script>
|
||||
|
||||
<SettingsGrid>
|
||||
<div data-testid="item1">Item 1</div>
|
||||
<div data-testid="item2">Item 2</div>
|
||||
<div data-testid="item3">Item 3</div>
|
||||
</SettingsGrid>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { render, screen } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import SettingsRowTest from "./SettingsRowTest.svelte";
|
||||
|
||||
describe("SettingsRow.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
render(SettingsRowTest);
|
||||
expect(screen.getByText("Test Label")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("test-input")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
import { render, screen } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import SettingsRowTest from "./SettingsRowTest.svelte";
|
||||
|
||||
describe("SettingsRow.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
render(SettingsRowTest);
|
||||
expect(screen.getByText("Test Label")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("test-input")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import SettingsRow from "$components/layout/SettingsRow.svelte";
|
||||
</script>
|
||||
|
||||
<SettingsRow label="Test Label">
|
||||
<input type="text" data-testid="test-input" />
|
||||
</SettingsRow>
|
||||
<script>
|
||||
import SettingsRow from "$components/layout/SettingsRow.svelte";
|
||||
</script>
|
||||
|
||||
<SettingsRow label="Test Label">
|
||||
<input type="text" data-testid="test-input" />
|
||||
</SettingsRow>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import TextBar from "$components/layout/TextBar.svelte";
|
||||
import { render } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("TextBar.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
const { container } = render(TextBar);
|
||||
expect(container).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
import TextBar from "$components/layout/TextBar.svelte";
|
||||
import { render } from "@testing-library/svelte";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("TextBar.svelte", () => {
|
||||
it("should render without crashing", () => {
|
||||
const { container } = render(TextBar);
|
||||
expect(container).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user