diff --git a/client/apps/webapp/components.d.ts b/client/apps/webapp/components.d.ts index ae0bd8342..92bf4ed7e 100644 --- a/client/apps/webapp/components.d.ts +++ b/client/apps/webapp/components.d.ts @@ -5,7 +5,6 @@ // ------ // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 -import { GlobalComponents } from 'vue' export {} @@ -18,11 +17,3 @@ declare module 'vue' { UserNav: typeof import('./src/components/UserNav.vue')['default'] } } - -// For TSX support -declare global { - const RouterLink: typeof import('vue-router')['RouterLink'] - const RouterView: typeof import('vue-router')['RouterView'] - const ThemeSwitcher: typeof import('./src/components/ThemeSwitcher.vue')['default'] - const UserNav: typeof import('./src/components/UserNav.vue')['default'] -} \ No newline at end of file diff --git a/client/apps/webapp/src/components/ThemeSwitcher.spec.ts b/client/apps/webapp/src/components/ThemeSwitcher.spec.ts new file mode 100644 index 000000000..144da38a1 --- /dev/null +++ b/client/apps/webapp/src/components/ThemeSwitcher.spec.ts @@ -0,0 +1,29 @@ +import { axe } from "vitest-axe"; +import { render, cleanup } from "@testing-library/vue"; +import ThemeSwitcher from "./ThemeSwitcher.vue"; +import { expect, it, describe, vi, afterEach } from "vitest"; + +vi.mock("@/composables/useTheme", () => ({ + useTheme: () => ({ + theme: "light", + resolvedTheme: "light", + setTheme: vi.fn(), + }), +})); + +describe("ThemeSwitcher", () => { + afterEach(() => { + cleanup(); + }); + + it("should have no accessibility violations", async () => { + const { container } = render(ThemeSwitcher); + const results = await axe(container); + expect(results).toHaveNoViolations(); + }); + + it("should render the component", () => { + const { getByRole } = render(ThemeSwitcher); + expect(getByRole("button", { name: /select theme/i })).toBeTruthy(); + }); +}); diff --git a/client/apps/webapp/src/components/ThemeSwitcher.vue b/client/apps/webapp/src/components/ThemeSwitcher.vue index 6be81abb9..73cd7aa08 100644 --- a/client/apps/webapp/src/components/ThemeSwitcher.vue +++ b/client/apps/webapp/src/components/ThemeSwitcher.vue @@ -25,8 +25,15 @@ const themes = [