mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-07 02:33:39 +02:00
Add bulma modal component
This commit is contained in:
parent
e911092113
commit
024b0547ea
4 changed files with 106 additions and 0 deletions
28
test/cljs/bulma/modal_test.cljs
Normal file
28
test/cljs/bulma/modal_test.cljs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
(ns bulma.modal-test
|
||||
(:require [cljs.test :refer-macros [deftest testing is]]
|
||||
[bulma.modal.subs :as sub]
|
||||
[bulma.modal.events :as ev]))
|
||||
|
||||
(enable-console-print!)
|
||||
|
||||
(deftest bulma-modals
|
||||
(testing "Should create a collection of modals if there is none"
|
||||
(let [new-db (ev/show-modal {} [::ev/show :some-modal-id])]
|
||||
(is (= :some-modal-id (sub/visible-modal new-db [::sub/visible-modal])))))
|
||||
(testing "Should hide other modals when displaying a new one"
|
||||
(let [modal-ids [:some-id-1 :some-id-2 :some-id-3]
|
||||
new-db (reduce (fn [db modal-id]
|
||||
(ev/show-modal db [::ev/show modal-id]))
|
||||
{} modal-ids)]
|
||||
(is (= :some-id-3 (sub/visible-modal new-db [::sub/visible-modal])))))
|
||||
(testing "Should remove a modal from the collection when we hide it"
|
||||
(let [modal-ids [:some-id-1 :some-id-2 :some-id-3]
|
||||
new-db (-> (reduce (fn [db modal-id]
|
||||
(ev/show-modal db [::ev/show modal-id]))
|
||||
{} modal-ids)
|
||||
(ev/hide-modal [::ev/hide]))]
|
||||
(is (not (some? (sub/visible-modal new-db [::sub/visible-modal]))))))
|
||||
(testing "Should tell us about the visibility of a modal with a predicate"
|
||||
(is (-> (ev/show-modal {} [::ev/show :getting-repetitive])
|
||||
(sub/visible-modal [::sub/visible-modal])
|
||||
(sub/visible? [::sub/visible? :getting-repetitive])))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue