fix: update fix-note-filename-on-rename smoke test for title-sync rename

Title sync now triggers a full rename flow instead of in-memory update,
so the Cmd+S test expectations needed updating.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-03-11 19:55:51 +01:00
parent 12a5a7af47
commit 891e298f3a

View File

@@ -38,24 +38,26 @@ test.describe('Note filename updates on title change + save', () => {
await page.waitForTimeout(2500)
})
test('Cmd+N creates untitled note, typing new title + Cmd+S renames file', async ({ page }) => {
test('Cmd+N creates untitled note, typing new title triggers rename via title sync', async ({ page }) => {
const errors: string[] = []
page.on('pageerror', (err) => { if (!isKnownEditorError(err.message)) errors.push(err.message) })
await createNoteWithTitle(page, 'Test Note ABC')
// Breadcrumb should already show the new title (title sync fired)
const breadcrumb = page.locator('span.truncate.font-medium')
await expect(breadcrumb.first()).toContainText('Test Note ABC', { timeout: 2000 })
// 5. Cmd+S → save + rename
await sendShortcut(page, 's', ['Control'])
// 6. Toast should show "Renamed" (appears within 5s, auto-dismisses after 2s)
// Title sync now triggers a full rename (save + rename + wikilink update).
// The toast should show "Renamed" after the debounce fires.
const toast = page.locator('.fixed.bottom-8')
await expect(toast).toContainText('Renamed', { timeout: 5000 })
// 7. No unexpected JS errors
// Breadcrumb should show the new title
const breadcrumb = page.locator('span.truncate.font-medium')
await expect(breadcrumb.first()).toContainText('Test Note ABC', { timeout: 2000 })
// Cmd+S should NOT trigger another rename (filename already matches)
await sendShortcut(page, 's', ['Control'])
await page.waitForTimeout(500)
// No unexpected JS errors
expect(errors).toEqual([])
})
@@ -75,7 +77,7 @@ test.describe('Note filename updates on title change + save', () => {
expect(toastText).not.toContain('Renamed')
})
test('rapid title changes only rename to final title on Cmd+S', async ({ page }) => {
test('rapid title changes only rename to final title', async ({ page }) => {
const errors: string[] = []
page.on('pageerror', (err) => { if (!isKnownEditorError(err.message)) errors.push(err.message) })
@@ -86,12 +88,9 @@ test.describe('Note filename updates on title change + save', () => {
await heading.click({ clickCount: 3 })
await page.keyboard.type('Final Title', { delay: 20 })
// Wait for debounce again
// Wait for debounce to fire — title sync triggers rename automatically
await page.waitForTimeout(800)
// Cmd+S → should rename to final-title.md
await sendShortcut(page, 's', ['Control'])
const toast = page.locator('.fixed.bottom-8')
await expect(toast).toContainText('Renamed', { timeout: 5000 })