fix: e2e tests

This commit is contained in:
Tienson Qin
2025-12-17 00:19:45 +08:00
parent 584dd3e362
commit 4a2d9c1308

View File

@@ -262,16 +262,16 @@
"Return hiccup of highlighted content FTS result"
[content q]
(when-not (or (string/blank? content) (string/blank? q))
[:div (loop [content content ;; why recur? because there might be multiple matches
result []]
(let [[b-cut hl-cut e-cut] (text-util/cut-by content "$pfts_2lqh>$" "$<pfts_2lqh$")
hiccups-add [[:span b-cut]
[:mark.p-0.rounded-none hl-cut]]
hiccups-add (remove nil? hiccups-add)
new-result (concat result hiccups-add)]
(if-not (string/blank? e-cut)
(recur e-cut new-result)
new-result)))]))
[:span (loop [content content ;; why recur? because there might be multiple matches
result []]
(let [[b-cut hl-cut e-cut] (text-util/cut-by content "$pfts_2lqh>$" "$<pfts_2lqh$")
hiccups-add [[:span b-cut]
[:mark.p-0.rounded-none hl-cut]]
hiccups-add (remove nil? hiccups-add)
new-result (concat result hiccups-add)]
(if-not (string/blank? e-cut)
(recur e-cut new-result)
new-result)))]))
(defn page-item
[repo page input]
@@ -288,7 +288,10 @@
{:alias (:block/title source-page)})]
(hash-map :icon icon
:icon-theme :gray
:text (highlight-content-query title input)
:text (if (string/includes? title "$pfts_2lqh>$") ; sqlite matched
[:span {"data-testid" title}
(highlight-content-query title input)]
title)
:header (when (:block/parent entity)
(block/breadcrumb {:disable-preview? true
:search? true} repo (:block/uuid page)