mirror of
https://github.com/Zakkaus/doona.git
synced 2026-12-06 08:02:04 +00:00
The diagnostics list sat below the editor (beside it on wide screens) and was easy to miss. A summary bar now sits under the editor toolbar with the error and warning counts and whether they belong to the accepted config, the file or the current draft; with nothing to report it is one quiet line. It opens on errors and stays shut for warnings; a collapse holds per source until a new error appears. Rows read line: message, keep the backend's words under a disclosure, and their action jumps the editor to the line or opens the other source. The editor gains lint gutter markers, and the Config files tab shows the error count. The level filter, the side panel and their strings and styles are gone.
61 lines
3.2 KiB
TypeScript
61 lines
3.2 KiB
TypeScript
import {expect, test} from './fixtures';
|
|
|
|
test.use({viewport: {width: 1440, height: 1000}});
|
|
|
|
test('the editor toolbar opens find and replace and goes to a line', async ({page}) => {
|
|
await page.goto('/#/config?source=src-rules');
|
|
const editor = page.locator('.cm-content[aria-label="/etc/honk/rules.dae"]');
|
|
await expect(editor).toHaveAttribute('contenteditable', 'true');
|
|
await page.getByRole('button', {name: 'Find and replace', exact: true}).click();
|
|
const search = page.locator('.cm-search');
|
|
await expect(search.locator('input[name=search]')).toBeFocused();
|
|
await expect(search.locator('input[name=replace]')).toBeVisible();
|
|
await page.keyboard.press('Escape');
|
|
await expect(search).toHaveCount(0);
|
|
await page.getByRole('button', {name: 'Go to line', exact: true}).click();
|
|
const line = page.locator('.cm-goto-line input[name=line]');
|
|
await expect(line).toBeFocused();
|
|
await line.fill('3');
|
|
await page.keyboard.press('Enter');
|
|
await expect(page.locator('.cm-goto-line')).toHaveCount(0);
|
|
await expect(page.locator('.cm-lineNumbers .cm-activeLineGutter')).toHaveText('3');
|
|
});
|
|
|
|
test('a read-only source keeps Find and Go to line, and its editing commands are disabled', async ({page}) => {
|
|
await page.goto('/#/config?source=src-harbor');
|
|
await expect(page.locator('.cm-content[aria-label="/var/lib/honk/subscriptions/harbor.dae"]')).toHaveAttribute('contenteditable', 'false');
|
|
await expect(page.getByRole('button', {name: 'Editing commands', exact: true})).toBeDisabled();
|
|
await page.getByRole('button', {name: 'Find', exact: true}).click();
|
|
const search = page.locator('.cm-search');
|
|
await expect(search.locator('input[name=search]')).toBeFocused();
|
|
await expect(search.locator('input[name=replace]')).toHaveCount(0);
|
|
await page.keyboard.press('Escape');
|
|
await page.getByRole('button', {name: 'Go to line', exact: true}).click();
|
|
await expect(page.locator('.cm-goto-line input[name=line]')).toBeFocused();
|
|
});
|
|
|
|
test('the editing commands menu undoes an edit', async ({page}) => {
|
|
await page.goto('/#/config?source=src-rules');
|
|
const editor = page.locator('.cm-content[aria-label="/etc/honk/rules.dae"]');
|
|
await expect(editor).toHaveAttribute('contenteditable', 'true');
|
|
const original = await editor.innerText();
|
|
const unsaved = page.locator('.rp-badge', {hasText: 'Not applied'});
|
|
await editor.click();
|
|
await page.keyboard.press('ControlOrMeta+End');
|
|
await page.keyboard.insertText('# typed');
|
|
await expect(unsaved).toBeVisible();
|
|
await page.getByRole('button', {name: 'Editing commands', exact: true}).click();
|
|
await page.getByRole('menuitem', {name: 'Undo', exact: true}).click();
|
|
await expect(editor).toHaveText(original, {useInnerText: true});
|
|
await expect(unsaved).toHaveCount(0);
|
|
await page.getByRole('button', {name: 'Editing commands', exact: true}).click();
|
|
await page.getByRole('menuitem', {name: 'Redo', exact: true}).click();
|
|
await expect(editor).toContainText('# typed');
|
|
const first = editor.locator('.cm-line').first();
|
|
await expect(first).toHaveText(/^#/);
|
|
await first.click();
|
|
await page.getByRole('button', {name: 'Editing commands', exact: true}).click();
|
|
await page.getByRole('menuitem', {name: 'Toggle comment', exact: true}).click();
|
|
await expect(first).not.toHaveText(/^#/);
|
|
});
|