diff --git a/test/uxbox/data/workspace_tests.cljs b/test/uxbox/data/workspace_tests.cljs deleted file mode 100644 index 1da8a14e81..0000000000 --- a/test/uxbox/data/workspace_tests.cljs +++ /dev/null @@ -1,42 +0,0 @@ -(ns uxbox.data.workspace-tests - (:require [cljs.test :as t :include-macros true] - [cljs.pprint :refer (pprint)] - [uxbox.rstore :as rs] - [uxbox.data.workspace :as dw])) - -;; delete shape: delete from page -(t/deftest delete-shape-test1 - (let [initial {:pages-by-id {1 {:id 1 :shapes [1 3 4]}} - :shapes-by-id {1 {:id 1 :page 1 - :type :builtin/group - :items [2]} - 2 {:id 2 :page 1 :group 1} - 3 {:id 3 :page 1} - 4 {:id 4 :page 1}}} - event (dw/delete-shape 4) - expected (-> initial - (assoc-in [:pages-by-id 1 :shapes] [1 3]) - (update-in [:shapes-by-id] dissoc 4)) - result (rs/-apply-update event initial)] - ;; (pprint expected) - ;; (pprint result) - (t/is (= result expected)))) - -;; delete shape: delete from group -(t/deftest delete-shape-test2 - (let [initial {:pages-by-id {1 {:id 1 :shapes [1 3 4]}} - :shapes-by-id {1 {:id 1 :page 1 - :type :builtin/group - :items [2]} - 2 {:id 2 :page 1 :group 1} - 3 {:id 3 :page 1} - 4 {:id 4 :page 1}}} - event (dw/delete-shape 2) - expected (-> initial - (assoc-in [:pages-by-id 1 :shapes] [3 4]) - (update-in [:shapes-by-id] dissoc 2) - (update-in [:shapes-by-id] dissoc 1)) - result (rs/-apply-update event initial)] - ;; (pprint expected) - ;; (pprint result) - (t/is (= result expected)))) diff --git a/test/uxbox/state/shapes_tests.cljs b/test/uxbox/state/shapes_tests.cljs index 7f557b22fb..3d389c0cfd 100644 --- a/test/uxbox/state/shapes_tests.cljs +++ b/test/uxbox/state/shapes_tests.cljs @@ -259,6 +259,49 @@ (assoc-in [:shapes-by-id 1 :items] [2 5]) (update-in [:shapes-by-id 6] assoc :group 2)) result (ssh/drop-shape initial 6 4 :after)] - (pprint expected) - (pprint result) + ;; (pprint expected) + ;; (pprint result) + (t/is (= result expected)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Delete Shape +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; delete shape: delete from page + +(t/deftest delete-shape-test1 + (let [initial {:pages-by-id {1 {:id 1 :shapes [1 3 4]}} + :shapes-by-id {1 {:id 1 :page 1 + :type :builtin/group + :items [2]} + 2 {:id 2 :page 1 :group 1} + 3 {:id 3 :page 1} + 4 {:id 4 :page 1}}} + + shape (get-in initial [:shapes-by-id 4]) + expected (-> initial + (assoc-in [:pages-by-id 1 :shapes] [1 3]) + (update-in [:shapes-by-id] dissoc 4)) + result (ssh/dissoc-shape initial shape)] + ;; (pprint expected) + ;; (pprint result) + (t/is (= result expected)))) + +;; delete shape: delete from group +(t/deftest delete-shape-test2 + (let [initial {:pages-by-id {1 {:id 1 :shapes [1 3 4]}} + :shapes-by-id {1 {:id 1 :page 1 + :type :builtin/group + :items [2]} + 2 {:id 2 :page 1 :group 1} + 3 {:id 3 :page 1} + 4 {:id 4 :page 1}}} + shape (get-in initial [:shapes-by-id 2]) + expected (-> initial + (assoc-in [:pages-by-id 1 :shapes] [3 4]) + (update-in [:shapes-by-id] dissoc 2) + (update-in [:shapes-by-id] dissoc 1)) + result (ssh/dissoc-shape initial shape)] + ;; (pprint expected) + ;; (pprint result) (t/is (= result expected)))) diff --git a/test/uxbox/test_runner.cljs b/test/uxbox/test_runner.cljs index 574bd10827..29b0ed0e84 100644 --- a/test/uxbox/test_runner.cljs +++ b/test/uxbox/test_runner.cljs @@ -1,7 +1,6 @@ (ns uxbox.test-runner (:require [cljs.test :as test] [uxbox.state.shapes-tests] - [uxbox.data.workspace-tests] [uxbox.util.geom-tests])) (enable-console-print!) @@ -10,7 +9,6 @@ [] (test/run-tests (test/empty-env) - 'uxbox.data.workspace-tests 'uxbox.util.geom-tests 'uxbox.state.shapes-tests ))