From 625c75494e282b08045401247a5b7f5612ec41cb Mon Sep 17 00:00:00 2001 From: leizhe Date: Wed, 20 Oct 2021 11:01:57 +0800 Subject: [PATCH] fix property test --- src/main/frontend/util/property.cljs | 4 +++- src/test/frontend/util/property_test.cljs | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/frontend/util/property.cljs b/src/main/frontend/util/property.cljs index 5ce062243..a01826303 100644 --- a/src/main/frontend/util/property.cljs +++ b/src/main/frontend/util/property.cljs @@ -240,7 +240,9 @@ result (cond (and org? (not has-properties?)) (let [properties (build-properties-str format {key value})] - (string/join "\n" (concat [title] scheduled deadline [properties] body-without-timestamps))) + (if title + (string/join "\n" (concat [title] scheduled deadline [properties] body-without-timestamps)) + (str properties content))) (and has-properties? (>= start-idx 0) (> end-idx 0) (> end-idx start-idx)) (let [exists? (atom false) diff --git a/src/test/frontend/util/property_test.cljs b/src/test/frontend/util/property_test.cljs index 844459a95..e5fa3ca80 100644 --- a/src/test/frontend/util/property_test.cljs +++ b/src/test/frontend/util/property_test.cljs @@ -141,11 +141,11 @@ "title:: a/b/c\ntags:: d,e\n") (are [x y] (= (property/build-properties-str :org x) y) {:title "a"} - ":PROPERTIES:\n:title: a\n:END:\n" + ":PROPERTIES:\n:title: a\n:END:" {:title "a/b/c"} - ":PROPERTIES:\n:title: a/b/c\n:END:\n" + ":PROPERTIES:\n:title: a/b/c\n:END:" {:title "a/b/c" :tags "d,e"} - ":PROPERTIES:\n:title: a/b/c\n:tags: d,e\n:END:\n")) + ":PROPERTIES:\n:title: a/b/c\n:tags: d,e\n:END:")) (deftest test-with-built-in-properties (let [content "#+BEGIN_QUERY\n{:title \"cool NEXT\"\n :query [:find (pull ?h [*])\n :in $ ?start ?next\n :where\n [?h :block/marker ?marker]\n [(contains? #{\"NOW\" \"LATER\" \"TODO\"} ?marker)]\n [?h :block/ref-pages ?p]\n [?p :block/journal? true]\n [?p :block/journal-day ?d]\n [(> ?d ?start)]\n [(< ?d ?next)]]\n :inputs [:today :7d-after]\n :collapsed? false}\n#+END_QUERY"]