Skip to content
Closed
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
24 changes: 0 additions & 24 deletions apps/desktop/e2e/settings.spec.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,30 +5,6 @@ function settingsNavigation(page: Page) {
return page.getByRole('navigation', { name: /^(设置分组|Settings sections)$/ });
}

/**
* Settings take effect: open settings, switch the theme to dark, and confirm
* the <html> root picks up the `dark` class (theme.ts applies it via
* classList.toggle). This exercises the settings open → navigate → mutate →
* apply path without depending on pixel colors.
*/
test('changing the theme in settings applies to the UI', async ({ window: page }) => {
await page.getByRole('button', { name: '展开侧边栏' }).click();
await page.getByRole('button', { name: '设置' }).click();
await expect(page.getByLabel('设置内容')).toBeVisible();

await settingsNavigation(page).getByRole('button', { name: '外观', exact: true }).click();
const themeGroup = page.getByRole('radiogroup', { name: '主题' });
const lightTheme = themeGroup.getByRole('radio', { name: '浅色' });
const darkTheme = themeGroup.getByRole('radio', { name: '深色' });
await lightTheme.focus();
await lightTheme.press('ArrowDown');
await expect(darkTheme).toBeChecked();

await expect.poll(
async () => page.evaluate(() => document.documentElement.classList.contains('dark')),
).toBe(true);
});

test('remote access prioritizes a configured channel that needs attention', async ({ window: page }) => {
const runtimeError = 'runtime-diagnostic-'.repeat(10);
await page.evaluate(async (lastError) => {
Expand Down
7 changes: 5 additions & 2 deletions apps/desktop/stories/settings/settings-pages.stories.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -814,8 +814,11 @@ function assertDailyReviewSettingsBounds(
): void {
const time = canvasElement.querySelector<HTMLInputElement>('input[type="text"]');
const page = canvasElement.querySelector<HTMLElement>('.settingsFormPage');
const timeForm = time?.closest<HTMLElement>('.settingsFormLayout');
const selectorForm = selector.closest<HTMLElement>('.settingsFormLayout');
// The rows kit (#1972) retired `.settingsFormLayout`. A control now lives in
// its row's capped end slot, so `.settingsRowEnd` is the container this
// contract has always meant: the bound the control must not overflow.
const timeForm = time?.closest<HTMLElement>('.settingsRowEnd');
const selectorForm = selector.closest<HTMLElement>('.settingsRowEnd');
const listbox = document.querySelector<HTMLElement>('[role="listbox"]');
const popover = listbox?.closest<HTMLElement>('[popover]');
if (!time || !page || !timeForm || !selectorForm || !popover) {
Expand Down
Loading