Add initial tests on property handler

This commit is contained in:
Tienson Qin
2023-11-30 00:33:48 +08:00
parent 1117ad3cb4
commit f342303e6a
10 changed files with 255 additions and 21 deletions

View File

@@ -11,10 +11,12 @@
(defn lookup
"Get the value of coll's (a map) `key`. For file and db graphs"
[coll key]
(let [repo (state/get-current-repo)]
(if (and (config/db-based-graph? repo)
(keyword? key))
(when-let [property (db/entity repo [:block/name (gp-util/page-name-sanity-lc (name key))])]
(let [repo (state/get-current-repo)
property-name (if (keyword? key)
(name key)
key)]
(if (config/db-based-graph? repo)
(when-let [property (db/entity repo [:block/name (gp-util/page-name-sanity-lc property-name)])]
(get coll (:block/uuid property)))
(get coll key))))
@@ -47,4 +49,4 @@
(get-property block :logseq.tldraw.page))
(defn shape-block? [block]
(= :whiteboard-shape (get-property block :ls-type)))
(= :whiteboard-shape (get-property block :ls-type)))