Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions desktop/src/renderer/src/pages/SettingsPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,7 @@ function toggleLocal(key: keyof LocalOptions) {
<div class="space-y-6">
<h1 class="text-2xl font-bold">Settings</h1>

<div class="grid items-start gap-6 lg:grid-cols-[10rem_minmax(0,1fr)]">
<nav aria-label="Settings sections" class="flex gap-1 overflow-x-auto lg:sticky lg:top-0 lg:flex-col">
<a class="rounded-md px-3 py-2 text-sm text-muted-foreground hover:bg-muted hover:text-foreground" href="#general">General</a>
<a class="rounded-md px-3 py-2 text-sm text-muted-foreground hover:bg-muted hover:text-foreground" href="#appearance">Appearance</a>
<a class="rounded-md px-3 py-2 text-sm text-muted-foreground hover:bg-muted hover:text-foreground" href="#updates">Updates</a>
<a class="rounded-md px-3 py-2 text-sm text-muted-foreground hover:bg-muted hover:text-foreground" href="#advanced">Advanced</a>
</nav>

<div class="min-w-0 max-w-3xl space-y-6">
<div class="min-w-0 max-w-3xl space-y-6">
<section id="general" aria-labelledby="general-heading" class="scroll-mt-6 rounded-lg border p-4 sm:p-6">
<h2 id="general-heading" class="text-lg font-semibold">General</h2>
{#if loading}
Expand Down Expand Up @@ -370,6 +362,5 @@ function toggleLocal(key: keyof LocalOptions) {
</div>
</div>
</section>
</div>
</div>
</div>
25 changes: 25 additions & 0 deletions desktop/src/renderer/src/pages/SettingsPage.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { render, screen } from "@testing-library/svelte"
import { afterEach, describe, expect, it, vi } from "vitest"

vi.mock("$lib/components/update/UpdatesPanel.svelte", () => ({
default: vi.fn(),
}))

import SettingsPage from "./SettingsPage.svelte"

describe("SettingsPage layout", () => {
afterEach(() => {
document.body.innerHTML = ""
})

it("renders all settings sections as one page without section navigation links", () => {
render(SettingsPage)

expect(screen.queryByRole("navigation", { name: "Settings sections" })).toBeNull()
expect(document.querySelectorAll('a[href^="#"]')).toHaveLength(0)

for (const name of ["General", "Appearance", "Updates", "Advanced"]) {
expect(screen.getByRole("heading", { name, level: 2 })).toBeTruthy()
}
})
})
Loading