💄 Format frontend code

This commit is contained in:
Andrey Antukh 2024-01-05 14:23:30 +01:00 committed by Alonso Torres
parent b6ecc8b1be
commit 833871df65
150 changed files with 1735 additions and 1770 deletions

View file

@ -3,6 +3,7 @@
:remove-surrounding-whitespace? true
:remove-consecutive-blank-lines? false
:extra-indents {rumext.v2/fnc [[:inner 0]]
cljs.test/async [[:inner 0]]
promesa.exec/thread [[:inner 0]]
specify! [[:inner 0] [:inner 1]]}
}

View file

@ -263,4 +263,4 @@
(File. (fb/create-file name)))
(defn exports []
#js { :createFile create-file-export })
#js {:createFile create-file-export})

View file

@ -22,7 +22,7 @@
(fn [resolve reject]
(->> (r/render-page data)
(rx/take 1)
(rx/subs! resolve reject))) )))
(rx/subs! resolve reject))))))
(defn exports []
#js {:renderPage render-page-export})

View file

@ -1902,7 +1902,7 @@
;; - Align it to the limits on the x and y axis
;; - Respect the distance of the object to the right and bottom in the original frame
(gpt/point paste-x paste-y))]
[frame-id frame-id delta (dec (count (:shapes selected-frame-obj )))]))
[frame-id frame-id delta (dec (count (:shapes selected-frame-obj)))]))
(empty? page-selected)
(let [frame-id (ctst/top-nested-frame page-objects position)
@ -1953,8 +1953,7 @@
(ptk/reify ::paste-shapes
ptk/WatchEvent
(watch [it state _]
(let [
file-id (:current-file-id state)
(let [file-id (:current-file-id state)
page (wsh/lookup-page state)
media-idx (->> (:media pdata)

View file

@ -42,7 +42,7 @@
(rx/filter mse/mouse-click-event?)
(rx/switch-map #(rx/take 1 ms/mouse-position))
(rx/with-latest-from ms/keyboard-space)
(rx/filter (fn [[_ space]] (not space)) )
(rx/filter (fn [[_ space]] (not space)))
(rx/map first)
(rx/map handle-comment-layer-click)
(rx/take-until stoper))

View file

@ -82,7 +82,7 @@
(rx/merge
(rx/of (handle-drawing type))
(->> stream
(rx/filter (ptk/type? ::common/handle-finish-drawing) )
(rx/filter (ptk/type? ::common/handle-finish-drawing))
(rx/take 1)
(rx/map #(fn [state] (update state :workspace-drawing dissoc :lock)))))))))))

View file

@ -64,8 +64,7 @@
:zoom-selected {:tooltip (ds/shift "2")
:command "shift+2"
:fn #(st/emit! dw/zoom-to-selected-shape)}
})
:fn #(st/emit! dw/zoom-to-selected-shape)}})
(defn get-tooltip [shortcut]
(assert (contains? shortcuts shortcut) (str shortcut))

View file

@ -55,7 +55,7 @@
(empty? (remove removed-id? (:shapes group))))
;; Adds group to the remove and check its parent
(let [to-check (concat to-check [(cfh/get-parent-id objects current-id)]) ]
(let [to-check (concat to-check [(cfh/get-parent-id objects current-id)])]
(recur (first to-check)
(rest to-check)
(conj removed-id? current-id)

View file

@ -72,7 +72,7 @@
(ptk/reify ::rename-flow
ptk/WatchEvent
(watch [it state _]
(let [page (wsh/lookup-page state) ]
(let [page (wsh/lookup-page state)]
(rx/of (dch/commit-changes
(-> (pcb/empty-changes it)
(pcb/with-page page)

View file

@ -97,7 +97,7 @@
(rx/map #(svg/add-svg-shapes (assoc svg-data :image-data %) position))))))
(defn- process-uris
[{:keys [file-id local? name uris mtype on-image on-svg] }]
[{:keys [file-id local? name uris mtype on-image on-svg]}]
(letfn [(svg-url? [url]
(or (and mtype (= mtype "image/svg+xml"))
(str/ends-with? url ".svg")))

View file

@ -544,8 +544,7 @@
:layout-item-margin-type
:layout-grid-cells
:layout-grid-columns
:layout-grid-rows
]})
:layout-grid-rows]})
;; We've applied the text-modifier so we can dissoc the temporary data
(fn [state]
(update state :workspace-text-modifier #(apply dissoc % ids)))

View file

@ -131,7 +131,7 @@
(let [;; To match the angle, the angle should be matching (angle between points 180deg)
angle-handlers (angle-points node handler opposite)
match-angle? (and match-angle? (<= (mth/abs (- 180 angle-handlers) ) 0.1))
match-angle? (and match-angle? (<= (mth/abs (- 180 angle-handlers)) 0.1))
;; To match distance the distance should be matching
match-distance? (and match-distance? (mth/almost-zero? (- (gpt/distance node handler)

View file

@ -145,8 +145,7 @@
:revn file-revn
:session-id sid
:changes-with-metadata (into [] changes)
:features features
}]
:features features}]
(->> (rp/cmd! :update-file params)
(rx/mapcat (fn [lagged]

View file

@ -495,7 +495,7 @@
(not duplicating-component?)
(ctk/detach-shape))
; We want the first added object to touch it's parent, but not subsequent children
;; We want the first added object to touch it's parent, but not subsequent children
changes (-> (pcb/add-object changes new-obj {:ignore-touched (and duplicating-component? child?)})
(pcb/amend-last-change #(assoc % :old-id (:id obj)))
(cond-> (ctl/grid-layout? objects (:parent-id obj))
@ -506,7 +506,7 @@
(and is-component-root? is-component-main?)
(regenerate-component new-obj))
; This is needed for the recursive call to find the new object as parent
;; This is needed for the recursive call to find the new object as parent
page' (ctst/add-shape (:id new-obj)
new-obj
{:objects objects}

View file

@ -127,8 +127,7 @@
:attrs dwt/text-attrs}))))
(defn- update-attrs [shape props]
(let [
text-values (calculate-text-values shape)
(let [text-values (calculate-text-values shape)
font-size (d/parse-double (:font-size text-values))
line-height (d/parse-double (:line-height text-values))
letter-spacing (d/parse-double (:letter-spacing text-values))
@ -166,8 +165,7 @@
all-underline? (every? #(= (:text-decoration %) "underline") text-values)
all-line-through? (every? #(= (:text-decoration %) "line-through") text-values)
all-bold? (every? #(is-bold? (:font-variant-id %)) text-values)
all-italic? (every? #(is-italic? (:font-variant-id %)) text-values)
]
all-italic? (every? #(is-italic? (:font-variant-id %)) text-values)]
(cond
(= (:text-decoration props) "toggle-underline")
(if all-underline?

View file

@ -339,8 +339,7 @@
(and (d/not-empty? color-attrs) (nil? (:fills node)))
(-> (dissoc :fill-color :fill-opacity :fill-color-ref-id :fill-color-ref-file :fill-color-gradient)
(assoc :fills [color-attrs])))
))
(assoc :fills [color-attrs])))))
(defn migrate-content
[content]

View file

@ -45,13 +45,13 @@
;; for example, right will only grow in the x coordinate and left
;; will grow in the inverse of the x coordinate
(def ^:private handler-multipliers
{:right [ 1 0]
:bottom [ 0 1]
{:right [1 0]
:bottom [0 1]
:left [-1 0]
:top [ 0 -1]
:top-right [ 1 -1]
:top [0 -1]
:top-right [1 -1]
:top-left [-1 -1]
:bottom-right [ 1 1]
:bottom-right [1 1]
:bottom-left [-1 1]})
(defn- handler-resize-origin

View file

@ -66,8 +66,7 @@
:form-data? true}
:export-binfile {:response-type :blob}
:retrieve-list-of-builtin-templates {:query-params :all}
})
:retrieve-list-of-builtin-templates {:query-params :all}})
(defn- send!
"A simple helper for a common case of sending and receiving transit

View file

@ -181,7 +181,7 @@
range-tree
(- cd snap-distance-accuracy)
(+ cd snap-distance-accuracy))
(map #(- (first %) cd ))))))))
(map #(- (first %) cd))))))))
get-middle-snaps
(fn [lt-dist gt-dist]

View file

@ -43,7 +43,7 @@
(when (and *debug-events*
(ptk/event? e)
(not (debug-exclude-events (ptk/type e))))
(.log js/console (str "[stream]: " (ptk/repr-event e)) )))))
(.log js/console (str "[stream]: " (ptk/repr-event e)))))))
(defonce state
(ptk/store {:resolve ptk/resolve

View file

@ -28,7 +28,7 @@
[rumext.v2 :as mf]))
(mf/defc resizing-textarea
{::mf/wrap-props false }
{::mf/wrap-props false}
[props]
(let [value (d/nilv (unchecked-get props "value") "")
on-focus (unchecked-get props "on-focus")

View file

@ -481,7 +481,7 @@
(> (count value) length))
(defn validate-length
[field length errors-msg ]
[field length errors-msg]
(fn [errors data]
(cond-> errors
(max-length? (get data field) length)

View file

@ -50,7 +50,7 @@
(when (fn? on-change) (on-change id)))))]
[:div {:class (stl/css :tab-container)}
[:div {:class (dm/str class " "(stl/css :tab-container-tabs))}
[:div {:class (dm/str class " " (stl/css :tab-container-tabs))}
(when collapsable?
[:button
{:on-click handle-collapse
@ -69,5 +69,5 @@
:class (stl/css-case :tab-container-tab-title true
:current (= selected id))}
title]))]]
[:div {:class (dm/str content-class " " (stl/css :tab-container-content ))}
[:div {:class (dm/str content-class " " (stl/css :tab-container-content))}
(d/seek #(= selected (-> % .-props .-id)) children)]]))

View file

@ -96,18 +96,18 @@
(or (and (neg? ss) (pos? se))
(and (pos? ss) (neg? ee))
(and (neg? ss) (> ss se)))
(conj [ from-s (+ from-s ss) ])
(conj [from-s (+ from-s ss)])
(and (neg? se) (<= ss se))
(conj [ from-s (+ from-s se) ])
(conj [from-s (+ from-s se)])
(and (pos? es) (<= es ee))
(conj [ from-e (+ from-e es) ])
(conj [from-e (+ from-e es)])
(or (and (pos? ee) (neg? es))
(and (neg? ee) (pos? ss))
(and (pos? ee) (< ee es)))
(conj [ from-e (+ from-e ee) ]))))
(conj [from-e (+ from-e ee)]))))
;; ------------------------------------------------
;; COMPONENTS

View file

@ -93,7 +93,7 @@
(s/def ::questions-form-step-3
(s/keys :req-un [::experience-design-tool]
:opt-un[::experience-design-tool-other]))
:opt-un [::experience-design-tool-other]))
(defn- step-3-form-validator
[errors data]

View file

@ -134,8 +134,7 @@
[:div {:class (stl/css :action-buttons)
:data-test "change-email-submit"}
[:> fm/submit-button*
{:label (tr "modals.change-email.submit")}]]]]]]
))
{:label (tr "modals.change-email.submit")}]]]]]]))

View file

@ -253,7 +253,7 @@
[:*
(when (contains? shape :svg-attrs)
(let [svg-transform (get shape :svg-transform)
svg-attrs (->> shape :svg-attrs keys (mapv d/name) (str/join ",") )
svg-attrs (->> shape :svg-attrs keys (mapv d/name) (str/join ","))
svg-defs (->> shape :svg-defs keys (mapv d/name) (str/join ","))]
[:> "penpot:svg-import"
#js {:penpot:svg-attrs (when-not (empty? svg-attrs) svg-attrs)

View file

@ -196,7 +196,7 @@
;; We use a class here because react has a bug that won't use the appropriate selector for
;; `background-clip`
[:style ".text-node { background-clip: text;
-webkit-background-clip: text; }" ]
-webkit-background-clip: text; }"]
[:& render-node {:index 0
:shape shape
:node content}]]))

View file

@ -121,7 +121,7 @@
;; `background-clip`
(when (not code?)
[:style ".text-node { background-clip: text;
-webkit-background-clip: text; }" ])
-webkit-background-clip: text; }"])
[:& render-node {:index 0
:shape shape
:node content

View file

@ -80,7 +80,7 @@
handle-expand
(mf/use-callback
(mf/deps right-size)
(fn[]
(fn []
(set-right-size (if (> right-size 276) 276 768))))]
(mf/use-effect on-mount)

View file

@ -81,7 +81,7 @@
[:span {:class (stl/css :lib-name)}
(dm/str (tr "workspace.libraries.colors.recent-colors"))]
[:span {:class (stl/css :lib-num)}
(dm/str "("(count recent-colors) ")")]]
(dm/str "(" (count recent-colors) ")")]]
(when (= selected :recent)
[:span {:class (stl/css :icon-wrapper)}

View file

@ -58,7 +58,7 @@
(-> (dw/toggle-layout-flag :colorpalette)
(vary-meta assoc ::ev/origin "workspace-colorpicker"))))))
shared-libs-options (mapv (fn[lib] {:value (d/name (:id lib)) :label (:name lib)} ) (vals shared-libs))
shared-libs-options (mapv (fn [lib] {:value (d/name (:id lib)) :label (:name lib)}) (vals shared-libs))
library-options [{:value "recent" :label (tr "workspace.libraries.colors.recent-colors")}
@ -69,7 +69,7 @@
on-color-click
(mf/use-fn
(mf/deps state)
(fn[event]
(fn [event]
(on-select-color state event)))]
;; Load library colors when the select is changed

View file

@ -311,6 +311,4 @@
(reset! prev-modifiers modifiers)
(reset! prev-transforms transforms)
(reset! prev-shapes shapes))
))
(reset! prev-shapes shapes))))

View file

@ -308,7 +308,7 @@
;; edited
(mf/use-effect
(fn []
(let [text-nodes (->> text-shapes (vals)(mapcat #(txt/node-seq txt/is-text-node? (:content %))))
(let [text-nodes (->> text-shapes (vals) (mapcat #(txt/node-seq txt/is-text-node? (:content %))))
fonts (into #{} (keep :font-id) text-nodes)]
(run! fonts/ensure-loaded! fonts))))

View file

@ -111,7 +111,7 @@
(mf/defc right-sidebar
{::mf/wrap-props false
::mf/wrap [mf/memo]}
[{:keys [layout section file page-id ] :as props}]
[{:keys [layout section file page-id] :as props}]
(let [drawing-tool (:tool (mf/deref refs/workspace-drawing))
is-comments? (= drawing-tool :comments)

View file

@ -59,7 +59,7 @@
;; NOTE: We don't schedule the thumbnail generation on idle right now
;; until we can queue and handle thumbnail batching properly.
#_(mf/with-effect []
#_(mf/with-effect []
(when-not (some? thumbnail-uri)
(tm/schedule-on-idle
#(st/emit! (dwl/update-component-thumbnail (:id component) file-id)))))

View file

@ -387,7 +387,7 @@
(partial on-asset-click groups))]
(mf/use-effect
(mf/deps local-data )
(mf/deps local-data)
(fn []
(when (:edit-typography local-data)
(st/emit! #(update % :workspace-global dissoc :edit-typography)))))

View file

@ -310,7 +310,7 @@
(update-interaction index #(ctsi/set-animation-type % value)))))
change-duration
(mf/use-fn(fn [value]
(mf/use-fn (fn [value]
(update-interaction index #(ctsi/set-duration % value))))
change-easing

View file

@ -264,7 +264,5 @@
(when select-only
[:button {:class (stl/css :select-btn)
:on-click handle-select}
i/move-refactor])]
))
i/move-refactor])]))

View file

@ -21,7 +21,7 @@
shared-libs (mf/deref refs/workspace-libraries)]
[:& dropdown {:show show-menu?
:on-close close-menu}
[:ul {:class (stl/css :workspace-context-menu) }
[:ul {:class (stl/css :workspace-context-menu)}
(for [[idx cur-library] (map-indexed vector (vals shared-libs))]
(let [typographies (-> cur-library (get-in [:data :typographies]) vals)]
[:li

View file

@ -78,6 +78,4 @@
[:& cmt/draft-thread {:draft draft
:on-cancel on-draft-cancel
:on-submit on-draft-submit
:zoom zoom}])]]]
))
:zoom zoom}])]]]))

View file

@ -250,7 +250,7 @@
width-v (-> gradient-vec
(gpt/normal-left)
(gpt/multiply (gpt/point (* (:width gradient) (/ gradient-length (/ height 2) ))))
(gpt/multiply (gpt/point (* (:width gradient) (/ gradient-length (/ height 2)))))
(gpt/multiply (gpt/point (/ width 2))))
width-p (gpt/add from-p width-v)

View file

@ -553,7 +553,7 @@
[:rect.drop
{:x (:x start-p-drop)
:y (:y start-p-drop)
:width (if (= type :column)(/ 10 zoom) width)
:width (if (= type :column) (/ 10 zoom) width)
:height (if (= type :row) (/ 10 zoom) height)
:fill "var(--grid-editor-area-background)"}])

View file

@ -250,11 +250,11 @@
[guide frame]
(if (= :x (:axis guide))
(and (>= (:position guide) (:x frame) )
(<= (:position guide) (+ (:x frame) (:width frame)) ))
(and (>= (:position guide) (:x frame))
(<= (:position guide) (+ (:x frame) (:width frame))))
(and (>= (:position guide) (:y frame) )
(<= (:position guide) (+ (:y frame) (:height frame)) ))))
(and (>= (:position guide) (:y frame))
(<= (:position guide) (+ (:y frame) (:height frame))))))
(mf/defc guide
{::mf/wrap [mf/memo]}

View file

@ -252,7 +252,7 @@
[:g {:on-pointer-down start-move-position
:on-pointer-enter #(reset! hover-disabled? true)
:on-pointer-leave #(reset! hover-disabled? false)}
[:g {:transform (gmt/translate-matrix (gpt/point (- marker-x dest-x) (- marker-y dest-y))) }
[:g {:transform (gmt/translate-matrix (gpt/point (- marker-x dest-x) (- marker-y dest-y)))}
[:& (mf/provider muc/render-thumbnails) {:value true}
[:& (mf/provider embed/context) {:value false}
[:& shape-wrapper {:shape dest-shape}]]]]

View file

@ -90,8 +90,7 @@
:height h
:rx (obj/get border-attrs "rx")
:ry (obj/get border-attrs "ry")
:d (obj/get border-attrs "d")})))
]
:d (obj/get border-attrs "d")})))]
[:> outline-type props]))

View file

@ -38,7 +38,7 @@
canvas))
(def get-offscreen-canvas ((fn []
(let [internal-state #js { :canvas nil }]
(let [internal-state #js {:canvas nil}]
(fn [width height]
(let [canvas (unchecked-get internal-state "canvas")]
(if canvas

View file

@ -262,7 +262,7 @@
:style {:fill rules-background
:fill-opacity over-number-opacity}}]
[:rect {:x (+ (- center-x (/ (:height selection-rect) 2) (* rule-area-half-size zoom-inverse) ) (:height selection-rect))
[:rect {:x (+ (- center-x (/ (:height selection-rect) 2) (* rule-area-half-size zoom-inverse)) (:height selection-rect))
:y (- center-y (* rule-area-half-size zoom-inverse))
:width (* over-number-size zoom-inverse)
:height (* rule-area-size zoom-inverse)
@ -278,7 +278,7 @@
:fill selection-area-color}}
(fmt/format-number (- (:y2 selection-rect) offset-y))]
[:text {:x (+ center-x (/ (:height selection-rect) 2) )
[:text {:x (+ center-x (/ (:height selection-rect) 2))
:y center-y
:text-anchor "start"
:dominant-baseline "middle"

View file

@ -69,7 +69,7 @@
:outside
:inside)]
(->>
[ ;; TOP-LEFT
[;; TOP-LEFT
{:type :rotation
:position :top-left
:props {:cx x :cy y}}

View file

@ -15,7 +15,7 @@
(defn format-viewbox
"Format a viewbox to a string"
[vbox]
(dm/str (format-number(:x vbox 0)) " "
(dm/str (format-number (:x vbox 0)) " "
(format-number (:y vbox 0)) " "
(format-number (:width vbox 0)) " "
(format-number (:height vbox 0))))

View file

@ -217,9 +217,7 @@
:embed embed}
(when-let [component-id (:component-id @state)]
[:use {:x 0 :y 0 :href (str "#" component-id)}])]]
])))
[:use {:x 0 :y 0 :href (str "#" component-id)}])]]])))
(defn- fetch-components-bundle
[& {:keys [file-id]}]

View file

@ -31,8 +31,7 @@
:padding :size-array
:margin :size-array
:grid-template-rows :tracks
:grid-template-columns :tracks
})
:grid-template-columns :tracks})
(defmulti format-value
(fn [property _value _options] (css-formatters property)))
@ -139,7 +138,7 @@
[_ value options]
(->> value
(map #(format-shadow % options))
(str/join ", " )))
(str/join ", ")))
(defmethod format-value :blur
[_ value _options]

View file

@ -77,8 +77,7 @@
:grid-layout
;; Show an overlay to the grid cells to know its properties
:grid-cells
})
:grid-cells})
(defn enable!
[option]

View file

@ -1034,8 +1034,7 @@
:layout-item-min-w (get-meta data :layout-item-min-w d/parse-double)
:layout-item-align-self (get-meta data :layout-item-align-self keyword)
:layout-item-align-absolute (get-meta data :layout-item-align-absolute str->bool)
:layout-item-align-index (get-meta data :layout-item-align-index d/parse-double)
}))
:layout-item-align-index (get-meta data :layout-item-align-index d/parse-double)}))
props))
(defn parse-data

View file

@ -30,8 +30,7 @@
(.toFixed a path-precision)
(.toFixed b path-precision)
(.toFixed c path-precision)
(.toFixed d path-precision)
))
(.toFixed d path-precision)))
([a b c d e]
(js* "\"\"+~{}+\",\"+~{}+\",\"+~{}+\",\"+~{}+\",\"+~{}"
(.toFixed a path-precision)
@ -46,8 +45,7 @@
(.toFixed c path-precision)
(.toFixed d path-precision)
(.toFixed e path-precision)
(.toFixed f path-precision)
))
(.toFixed f path-precision)))
([a b c d e f g]
(js* "\"\"+~{}+\",\"+~{}+\",\"+~{}+\",\"+~{}+\",\"+~{}+\",\"+~{}+\",\"+~{}"
(.toFixed a path-precision)

View file

@ -8,11 +8,11 @@
"Performance profiling for react components."
(:require-macros [app.util.perf])
(:require
[app.common.math :as mth]
[rumext.v2 :as mf]
[goog.functions :as f]
["react" :as react]
["tdigest" :as td]))
["tdigest" :as td]
[app.common.math :as mth]
[goog.functions :as f]
[rumext.v2 :as mf]))
;; For use it, just wrap the component you want to profile with
;; `perf/profiler` component and pass a label for debug purpose.

View file

@ -229,8 +229,7 @@
(contains? node :typography-ref-id)
(conj {:id (:typography-ref-id node)
:file-id (:typography-ref-file node)})
)))
:file-id (:typography-ref-file node)}))))
(into [])))

View file

@ -549,7 +549,7 @@
(rx/tap #(progress! context :upload-media (:name %)))
(rx/merge-map #(rp/cmd! :upload-file-media-object %))
(rx/map (constantly media))
(rx/catch #(do (.error js/console (str "Error uploading media: " (:name media)) )
(rx/catch #(do (.error js/console (str "Error uploading media: " (:name media)))
(rx/empty)))))))
(rx/reduce fb/add-library-media file)))
(rx/of file)))

View file

@ -6,8 +6,8 @@
(ns frontend-tests.setup-test
(:require
[app.common.schema :as sm]
[app.common.pprint :as pp]
[app.common.schema :as sm]
[cljs.test :as t]))
(.on js/process "uncaughtException" (fn [cause]

View file

@ -77,8 +77,7 @@
(t/is (= (:name c-shape1) "Rect 1"))
(t/is (= (:touched c-shape1) nil))
(t/is (= (:fill-color c-shape1) clr/white))
(t/is (= (:fill-opacity c-shape1) 1))
)))]
(t/is (= (:fill-opacity c-shape1) 1)))))]
(ptk/emit!
store
@ -201,9 +200,7 @@
(t/is (= (:shape-ref c-shape1) nil))
(t/is (= (:name c-shape2) "Rect 2"))
(t/is (= (:touched c-shape2) nil))
(t/is (= (:shape-ref c-shape2) nil))
)))]
(t/is (= (:shape-ref c-shape2) nil)))))]
(ptk/emit!
store
@ -603,8 +600,7 @@
(t/is (= (:fill-color c-shape1) clr/black))
(t/is (= (:fill-opacity c-shape1) 0))
(t/is (= (:name c-shape2) "Rect 1"))
(t/is (= (:touched c-shape2) #{:fill-group}))
)))]
(t/is (= (:touched c-shape2) #{:fill-group})))))]
(ptk/emit!
store

View file

@ -341,8 +341,7 @@
;; Rect 1 #--> ?
;; Rect 1 ---> ?
;;;
(let [
[main1 shape1]
(let [[main1 shape1]
(thl/resolve-noninstance
new-state
(thp/id :main1))
@ -380,10 +379,7 @@
(t/is (some? (:objects component3)))
(t/is (= (:name saved-main1) "Rect 1"))
(t/is (= (:name saved-shape2) "Rect 1"))
)))
]
(t/is (= (:name saved-shape2) "Rect 1")))))]
(ptk/emit! store
(dwl/delete-component {:id (thp/id :component1)})
:the/end))))

View file

@ -6,10 +6,10 @@
(ns frontend-tests.util-simple-math-test
(:require
[cljs.test :as t :include-macros true]
[cljs.pprint :refer [pprint]]
[app.common.math :as cm]
[app.util.simple-math :as sm]))
[app.util.simple-math :as sm]
[cljs.pprint :refer [pprint]]
[cljs.test :as t :include-macros true]))
(t/deftest test-parser-inst
(t/testing "Evaluate an empty string"
@ -86,7 +86,5 @@
(t/testing "Evaluate a complex operation with decimals"
(let [result1 (sm/expr-eval "(20.333 + 10%) * (1 / 3)" 20)
result2 (sm/expr-eval "(20,333 + 10%) * (1 / 3)" 20)]
(t/is (cm/close? result1 result2 7.44433333))))
)
(t/is (cm/close? result1 result2 7.44433333)))))

View file

@ -7,8 +7,8 @@
(ns frontend-tests.util-snap-data-test
(:require
[app.common.files.builder :as fb]
[app.common.uuid :as uuid]
[app.common.types.shape :as cts]
[app.common.uuid :as uuid]
[app.util.snap-data :as sd]
[cljs.pprint :refer [pprint]]
[cljs.test :as t :include-macros true]))
@ -418,8 +418,7 @@
result-zero-x-2 (sd/query data (:id page) uuid/zero :x [0 200])
result-zero-y-2 (sd/query data (:id page) uuid/zero :y [0 200])
result-frame-x-2 (sd/query data (:id page) frame-id :x [0 200])
result-frame-y-2 (sd/query data (:id page) frame-id :y [0 200])
]
result-frame-y-2 (sd/query data (:id page) frame-id :y [0 200])]
(t/is (some? data))
@ -431,5 +430,4 @@
(t/is (= (count result-zero-x-2) 1))
(t/is (= (count result-zero-y-2) 0))
(t/is (= (count result-frame-x-2) 1))
(t/is (= (count result-frame-y-2) 0))))
)
(t/is (= (count result-frame-y-2) 0)))))