Skip to content

Commit 25964fa

Browse files
Fix broken tests
1 parent 910f390 commit 25964fa

File tree

7 files changed

+46
-37
lines changed

7 files changed

+46
-37
lines changed

src/lang/el-GR.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
{:modify-selection "Τροποποίηση επιλογής"
119119
:select-element "Επιλογή στοιχείου"
120120
:select-elements "Επιλογή στοιχείων"
121+
:delete-selection "Διαγραφή επιλεγμένου"
121122
:toggle "Εναλλαγή %1"}
122123

123124
:renderer.element.views

src/lang/en-US.edn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@
116116

117117
:renderer.element.events
118118
{:modify-selection "Modify selection"
119-
:select-element "Select elementssss"
119+
:select-element "Select element"
120120
:select-elements "Select elements"
121+
:delete-selection "Delete selection"
121122
:toggle "Toggle %1"}
122123

123124
:renderer.element.views

src/renderer/element/events.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
::toggle-prop
3636
(fn [db [_ id k]]
3737
(-> (element.handlers/update-prop db id k not)
38-
(history.handlers/finalize #(t [::toggle (str "Toggle " (name k))] [(name k)])))))
38+
(history.handlers/finalize #(t [::toggle "Toggle %1"] [(name k)])))))
3939

4040
(rf/reg-event-db
4141
::set-prop
@@ -83,7 +83,7 @@
8383
::delete
8484
(fn [db]
8585
(-> (element.handlers/delete db)
86-
(history.handlers/finalize #(t [::select-element "Delete selection"])))))
86+
(history.handlers/finalize #(t [::delete-selection "Delete selection"])))))
8787

8888
(rf/reg-event-db
8989
::deselect-all

src/renderer/history/db.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
(def HistoryState
77
[:map {:closed true}
8-
[:explanation string?]
8+
[:explanation [:or fn? string?]]
99
[:timestamp number?]
1010
[:index [:or pos-int? zero?]]
1111
[:id uuid?]

src/renderer/utils/bounds.cljs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,22 @@
8282
(defn ->snapping-points
8383
[bbox options]
8484
(let [[min-x min-y max-x max-y] bbox
85-
[cx cy] (center bbox)]
85+
[cx cy] (center bbox)
86+
bounds-corner-txt (t [::bounds-corner "bounds corner"])
87+
bounds-center-txt (t [::bounds-center "bounds center"])
88+
bounds-midpoints-txt (t [::bounds-midpoint "bounds midpoint"])]
8689
(cond-> []
8790
(:corners options)
88-
(into [(with-meta [min-x min-y] {:label (t [::bounds-corner "bounds corner"])})
89-
(with-meta [min-x max-y] {:label (t [::bounds-corner "bounds corner"])})
90-
(with-meta [max-x min-y] {:label (t [::bounds-corner "bounds corner"])})
91-
(with-meta [max-x max-y] {:label (t [::bounds-corner "bounds corner"])})])
91+
(into [(with-meta [min-x min-y] {:label bounds-corner-txt})
92+
(with-meta [min-x max-y] {:label bounds-corner-txt})
93+
(with-meta [max-x min-y] {:label bounds-corner-txt})
94+
(with-meta [max-x max-y] {:label bounds-corner-txt})])
9295

9396
(:centers options)
94-
(into [(with-meta [cx cy] {:label (t [::bounds-center "bounds center"])})])
97+
(into [(with-meta [cx cy] {:label bounds-center-txt})])
9598

9699
(:midpoints options)
97-
(into [(with-meta [min-x cy] {:label (t [::bounds-corner "bounds midpoint"])})
98-
(with-meta [max-x cy] {:label (t [::bounds-corner "bounds midpoint"])})
99-
(with-meta [cx min-y] {:label (t [::bounds-corner "bounds midpoint"])})
100-
(with-meta [cx max-y] {:label (t [::bounds-corner "bounds midpoint"])})]))))
100+
(into [(with-meta [min-x cy] {:label bounds-midpoints-txt})
101+
(with-meta [max-x cy] {:label bounds-midpoints-txt})
102+
(with-meta [cx min-y] {:label bounds-midpoints-txt})
103+
(with-meta [cx max-y] {:label bounds-midpoints-txt})]))))

test/utils/attribute_test.cljs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
(ns utils.attribute-test
22
(:require
33
[cljs.test :refer-macros [deftest testing are]]
4-
[renderer.utils.attribute :as utils.attribute]))
4+
[renderer.utils.attribute :as utils.attribute]
5+
[renderer.utils.i18n :as i18n]))
56

67
(deftest test-str->seq
78
(testing "string to sequence conversion"
@@ -34,20 +35,21 @@
3435
:glyphOrientationHorizontal (utils.attribute/->camel-case :Glyphorientationhorizontal))))
3536

3637
(deftest test-defaults
37-
(testing "default tag attributes"
38-
(are [x y] (= x y)
39-
{:x ""
40-
:y ""
41-
:rx ""
42-
:ry ""
43-
:width ""
44-
:height ""
45-
:fill ""
46-
:stroke ""
47-
:stroke-dasharray ""
48-
:stroke-linejoin ""
49-
:style ""
50-
:stroke-width ""
51-
:opacity ""
52-
:id ""
53-
:class ""} (utils.attribute/defaults :rect))))
38+
(with-redefs [i18n/t (fn [& _] "translation")]
39+
(testing "default tag attributes"
40+
(are [x y] (= x y)
41+
{:x ""
42+
:y ""
43+
:rx ""
44+
:ry ""
45+
:width ""
46+
:height ""
47+
:fill ""
48+
:stroke ""
49+
:stroke-dasharray ""
50+
:stroke-linejoin ""
51+
:style ""
52+
:stroke-width ""
53+
:opacity ""
54+
:id ""
55+
:class ""} (utils.attribute/defaults :rect)))))

test/utils/bounds_test.cljs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
(ns utils.bounds-test
22
(:require
33
[cljs.test :refer-macros [deftest testing are is]]
4-
[renderer.utils.bounds :as utils.bounds]))
4+
[renderer.utils.bounds :as utils.bounds]
5+
[renderer.utils.i18n :as i18n]))
56

67
(deftest test-union
78
(testing "united bounds"
@@ -38,8 +39,9 @@
3839
(is (= (utils.bounds/center [0 0 10 10]) [5 5]))))
3940

4041
(deftest test-->snapping-points
41-
(testing "snapping points of bounds"
42-
(is (= (utils.bounds/->snapping-points [0 0 10 10] #{:corners :centers :midpoints})
43-
[[0 0] [0 10] [10 0] [10 10] [5 5] [0 5] [10 5] [5 0] [5 10]]))
42+
(with-redefs [i18n/t (fn [& _] "translation")]
43+
(testing "snapping points of bounds"
44+
(is (= (utils.bounds/->snapping-points [0 0 10 10] #{:corners :centers :midpoints})
45+
[[0 0] [0 10] [10 0] [10 10] [5 5] [0 5] [10 5] [5 0] [5 10]]))
4446

45-
(is (= (utils.bounds/->snapping-points [0 0 10 10] #{}) []))))
47+
(is (= (utils.bounds/->snapping-points [0 0 10 10] #{}) [])))))

0 commit comments

Comments
 (0)