Преглед изворни кода

enhance(plugins): add more property related e2e tests

charlie пре 7 месеци
родитељ
комит
f81849149d
2 измењених фајлова са 7 додато и 4 уклоњено
  1. 3 1
      clj-e2e/test/logseq/e2e/plugins_basic_test.clj
  2. 4 3
      src/main/logseq/api.cljs

+ 3 - 1
clj-e2e/test/logseq/e2e/plugins_basic_test.clj

@@ -110,4 +110,6 @@
       (is (= (get prop1 "type") "default"))
       (is (= (get prop2 "type") "number"))
       (is (= (get prop3 "ident") ":user.property/o3"))
-      (is (= (get prop3 "type") "node")))))
+      (is (= (get prop3 "type") "node"))
+      (ls-api-call! :editor.removeProperty "o2")
+      (is (nil? (w/find-one-by-text ".property-k" "o2"))))))

+ 4 - 3
src/main/logseq/api.cljs

@@ -936,9 +936,10 @@
 (defn ^:export remove_property
   [k]
   (this-as this
-           (p/let [prop (-get-property this k)]
-             (when-let [uuid (:block/uuid prop)]
-               (page-common-handler/<delete! uuid nil nil)))))
+    (p/let [prop (-get-property this k)]
+      (when-let [uuid (and (api-block/plugin-property-key? (:db/ident prop))
+                        (:block/uuid prop))]
+        (page-common-handler/<delete! uuid nil nil)))))
 
 ;; block properties
 (defn ^:export upsert_block_property