feat: Add "open in new tab" link to history entries
Each history entry now has a third action: a real anchor (rendered via the Button's href, target="_blank") linking to the editor with that entry's serialized state. Being a normal link, users can also copy it or open it in a new tab via the context menu. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
64e8822e32
commit
8dd9cb49a0
@@ -67,6 +67,25 @@ test.describe('History', () => {
|
||||
await expect(page.locator('#view')).toContainText('NewYear');
|
||||
});
|
||||
|
||||
test('each entry has a copyable link that opens it in a new tab', async ({ page }) => {
|
||||
await page.evaluate(
|
||||
(manual) => localStorage.setItem('manualHistoryStore', manual),
|
||||
JSON.stringify(manualHistory)
|
||||
);
|
||||
await page.reload();
|
||||
await openHistory(page);
|
||||
|
||||
// It is a real link (so it can be copied / opened in a new tab), not a button.
|
||||
const link = page.getByRole('link', { name: 'Open in new tab' }).first();
|
||||
await expect(link).toHaveAttribute('target', '_blank');
|
||||
const href = await link.getAttribute('href');
|
||||
expect(href).toContain('/edit#pako:');
|
||||
|
||||
// Following it loads that entry's diagram.
|
||||
await page.goto(href ?? '');
|
||||
await expect(page.locator('#view')).toContainText('Halloween');
|
||||
});
|
||||
|
||||
test('keeps the active tab highlighted when switching modes', async ({ page }) => {
|
||||
await openHistory(page);
|
||||
const saved = page.getByRole('tab', { name: 'Saved' });
|
||||
|
||||
Reference in New Issue
Block a user