feat(tasks): make a URL in a task's title or description clickable
A task is plain text — the title is an input, the description a textarea — so a pasted URL just sat there as words. It is now caught at display time and shown as a link in the list and on the board, without the stored text ever being anything but plain text. The link cannot live inside the row's open-button (an <a> in a <button> is invalid), so the body is a container with the open action as an overlay behind it: plain text and the meta row still open the task, links are raised above and take their own click. Conservative about what counts — an explicit http(s):// or a bare www. host, not every dotted word. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
923f911472
commit
9d4a13c2c2
@@ -86,6 +86,29 @@ test('hurtig tilføjelse opretter en opgave, og den kan lukkes', async ({ page }
|
||||
expect(trouble).toEqual([]);
|
||||
});
|
||||
|
||||
test('en URL i en opgave bliver et klikbart link, og resten åbner opgaven', async ({ page }) => {
|
||||
const trouble = watchForTrouble(page);
|
||||
await page.goto('/');
|
||||
|
||||
const box = page.getByLabel('Ny opgave');
|
||||
// The URL is one token, so the parser leaves it in the title; "i dag" is what it
|
||||
// takes. The link is made at display time — the stored title is still plain text.
|
||||
await box.fill('læs https://example.com/artikel i dag');
|
||||
await box.press('Enter');
|
||||
|
||||
const row = page.locator('.row').filter({ hasText: 'læs' });
|
||||
const link = row.getByRole('link', { name: 'https://example.com/artikel' });
|
||||
await expect(link).toHaveAttribute('href', 'https://example.com/artikel');
|
||||
await expect(link).toHaveAttribute('rel', /noopener/);
|
||||
|
||||
// Clicking anywhere but the link still opens the task — the open-overlay sits
|
||||
// behind the text, the link above it.
|
||||
await row.getByRole('button', { name: /læs https/ }).click();
|
||||
await expect(page.getByRole('complementary', { name: 'Opgave' })).toBeVisible();
|
||||
|
||||
expect(trouble).toEqual([]);
|
||||
});
|
||||
|
||||
test('hvert link i sidebjælken fører et sted hen', async ({ page }) => {
|
||||
const trouble = watchForTrouble(page);
|
||||
await page.goto('/');
|
||||
|
||||
Reference in New Issue
Block a user