mirror of
https://github.com/bretzel-app/crumbs.git
synced 2026-10-12 12:06:57 +02:00
fix: address review feedback on auto-save
- Snapshot fields at start of performSave to avoid race with user edits during async save (fields could change between await and lastSaved update) - Only update lastSaved tracking on successful save, so failed saves are retried on the next debounce cycle - Stop restoring title after Untitled fallback in autoSave(), which was re-triggering the auto-save effect - Capture note count before opening editor in empty-note e2e test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
Fred Cabassut
co-authored by
Claude Opus 4.6
parent
07b27c01e7
commit
9d1c898b84
@@ -41,20 +41,20 @@ test.describe('Auto-save', () => {
|
||||
});
|
||||
|
||||
test('Scenario: Empty note is not auto-saved', async ({ authenticatedPage: page }) => {
|
||||
// Given the current number of notes
|
||||
const noteCards = page.locator('[data-testid="note-card"]');
|
||||
const countBefore = await noteCards.count();
|
||||
|
||||
// When the user opens a new note but leaves it empty
|
||||
await page.getByTestId('new-note-btn').click();
|
||||
|
||||
// And waits longer than the auto-save delay
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Then no note card appears in the list
|
||||
const noteCards = page.locator('[data-testid="note-card"]');
|
||||
const countBefore = await noteCards.count();
|
||||
|
||||
// Close the empty editor
|
||||
// And closes the empty editor
|
||||
await page.getByTestId('close-editor-btn').click();
|
||||
|
||||
// And no new note was created
|
||||
// Then no new note was created
|
||||
const countAfter = await noteCards.count();
|
||||
expect(countAfter).toBe(countBefore);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user