فهرست منبع

fix: e2e tests

Tienson Qin 2 هفته پیش
والد
کامیت
4a2d9c1308
1فایلهای تغییر یافته به همراه14 افزوده شده و 11 حذف شده
  1. 14 11
      src/main/frontend/components/cmdk/core.cljs

+ 14 - 11
src/main/frontend/components/cmdk/core.cljs

@@ -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)