Skip to content

Commit

Permalink
test(e2e): renaming between cases
Browse files Browse the repository at this point in the history
  • Loading branch information
cnrpman authored and logseq-cldwalker committed Jun 5, 2023
1 parent 66239e3 commit 0d88792
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion e2e-tests/page-rename.spec.ts
@@ -1,6 +1,6 @@
import { expect, Page } from '@playwright/test'
import { test } from './fixtures'
import { createPage, randomLowerString, randomString, renamePage } from './utils'
import { createPage, randomLowerString, randomString, renamePage, searchPage } from './utils'

/***
* Test rename feature
Expand Down Expand Up @@ -64,6 +64,15 @@ test('page rename test', async ({ page }) => {
await page_rename_test(page, "abcd", "a.b.c.d")
await page_rename_test(page, "abcd", "a/b/c/d")

// The page name in page search are not updated after changing the capitalization of the page name #9577
// https://github.com/logseq/logseq/issues/9577
// Expect the page name to be updated in the search results
await page_rename_test(page, "DcBA", "dCBA")
const results = await searchPage(page, "DcBA")
// search result 0 is the new page & 1 is the new whiteboard
const thirdResultRow = await results[2].innerText()
expect(thirdResultRow).toContain("dCBA");
expect(thirdResultRow).not.toContain("DcBA");
})

// TODO introduce more samples when #4722 is fixed
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/search.cljs
Expand Up @@ -261,12 +261,13 @@
(let [data (:tx-data tx-report)
datoms (filter
(fn [datom]
;; Capture any direct change on page display title, page ref or block content
(contains? #{:block/name :block/original-name :block/content} (:a datom)))
data)]
(when (seq datoms)
(let [datoms (group-by :a datoms)
blocks (:block/content datoms)
pages (concat
pages (concat ;; Duplicated eids are handled in `get-pages-from-datoms-impl`
(:block/name datoms)
(:block/original-name datoms))]
(merge (get-blocks-from-datoms-impl blocks)
Expand Down

0 comments on commit 0d88792

Please sign in to comment.