refactor: add page outliner ops

The rule is to avoid calling worker modules from UI, all db
transactions should go through apply-outliner-ops.
This commit is contained in:
Tienson Qin
2024-06-18 05:19:11 +08:00
parent 3c9c4b3f79
commit 0bd6c05e69
16 changed files with 146 additions and 119 deletions

View File

@@ -3,7 +3,6 @@
[clojure.test :refer [deftest is testing use-fixtures]]
[frontend.test.helper :as test-helper]
[datascript.core :as d]
[frontend.handler.page :as page-handler]
[frontend.db :as db]))
(def init-data (test-helper/initial-test-page-and-blocks))
@@ -20,7 +19,7 @@
(let [pages (map (fn [i] (str "Page " i)) (range 15))]
;; create pages
(doseq [page pages]
(page-handler/create! page {:redirect? false :create-first-block? false :class? true})
(test-helper/create-page! page {:redirect? false :create-first-block? false :class? true})
(db-recent-handler/add-page-to-recent! (:db/id (db/get-page page)) false))
(is (= (map :block/original-name (db-recent-handler/get-recent-pages)) (reverse pages)))
(testing "Click existing recent item shouldn't update its position"