mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
✨ Add color checks and test of event creation for fills
This commit is contained in:
48
frontend/test/frontend_tests/data/workspace_colors_test.cljs
Normal file
48
frontend/test/frontend_tests/data/workspace_colors_test.cljs
Normal file
@@ -0,0 +1,48 @@
|
||||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) KALEIDOS INC
|
||||
|
||||
(ns frontend-tests.data.workspace-colors-test
|
||||
(:require
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace.colors :as dwc]
|
||||
[clojure.test :as t]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(t/deftest build-change-fill-event
|
||||
(let [color1 {:color "#fabada"
|
||||
:opacity 1}
|
||||
color2 {:color "#fabada"
|
||||
:opacity 1
|
||||
:ref-id uuid/zero
|
||||
:ref-file uuid/zero}
|
||||
color3 {:color "#fabada"
|
||||
:opacity -1}
|
||||
color4 {:opacity 1
|
||||
:color "ffffff"}]
|
||||
(t/is (ptk/event? (dwc/change-fill #{uuid/zero} color1 1)))
|
||||
(t/is (ptk/event? (dwc/change-fill #{uuid/zero} color2 1)))
|
||||
(t/is (thrown? js/Error
|
||||
(ptk/event? (dwc/change-fill #{uuid/zero} color3 1))))
|
||||
(t/is (thrown? js/Error
|
||||
(ptk/event? (dwc/change-fill #{uuid/zero} color4 1))))))
|
||||
|
||||
(t/deftest build-add-fill-event
|
||||
(let [color1 {:color "#fabada"
|
||||
:opacity 1}
|
||||
color2 {:color "#fabada"
|
||||
:opacity 1
|
||||
:ref-id uuid/zero
|
||||
:ref-file uuid/zero}
|
||||
color3 {:color "#fabada"
|
||||
:opacity -1}
|
||||
color4 {:opacity 1
|
||||
:color "ffffff"}]
|
||||
(t/is (ptk/event? (dwc/add-fill #{uuid/zero} color1 1)))
|
||||
(t/is (ptk/event? (dwc/add-fill #{uuid/zero} color2 1)))
|
||||
(t/is (thrown? js/Error
|
||||
(ptk/event? (dwc/add-fill #{uuid/zero} color3 1))))
|
||||
(t/is (thrown? js/Error
|
||||
(ptk/event? (dwc/add-fill #{uuid/zero} color4 1))))))
|
||||
@@ -2,6 +2,7 @@
|
||||
(:require
|
||||
[cljs.test :as t]
|
||||
[frontend-tests.basic-shapes-test]
|
||||
[frontend-tests.data.workspace-colors-test]
|
||||
[frontend-tests.helpers-shapes-test]
|
||||
[frontend-tests.logic.comp-remove-swap-slots-test]
|
||||
[frontend-tests.logic.components-and-tokens]
|
||||
@@ -39,6 +40,7 @@
|
||||
'frontend-tests.util-snap-data-test
|
||||
'frontend-tests.util-simple-math-test
|
||||
'frontend-tests.basic-shapes-test
|
||||
'frontend-tests.data.workspace-colors-test
|
||||
'frontend-tests.tokens.logic.token-actions-test
|
||||
'frontend-tests.tokens.logic.token-data-test
|
||||
'frontend-tests.tokens.import-export-test
|
||||
|
||||
Reference in New Issue
Block a user