feat: add 13 components adapted from Oat UI
Components (.cljc + .css + tests): - Alert (success/warning/danger/info variants) - Badge (primary/secondary/outline/success/warning/danger) - Card (card/card-header/card-body/card-footer) - Accordion (collapsible with open/closed state) - Table (headers/rows, striped/bordered variants) - Dialog (modal with header/body/footer sections) - Breadcrumb (nav with active item) - Pagination (current/total with prev/next) - Progress (value bar with color variants) - Spinner (sm/md/lg sizes) - Skeleton (line/box/circle/heading placeholders) - Switch (toggle with checked/disabled states) - Tooltip (hover text via data-tooltip attr) CSS-only additions: - Form elements (inputs, selects, checkboxes, radios, range, groups) - Grid (12-column system with offsets, responsive) - Utilities (flex, spacing, alignment, sr-only) Also adds warning/fg-on-warning tokens to light and dark themes. All 3 dev targets updated with full component showcase. 40 tests, 213 assertions, all passing.
This commit is contained in:
34
test/ui/dialog_test.clj
Normal file
34
test/ui/dialog_test.clj
Normal file
@@ -0,0 +1,34 @@
|
||||
(ns ui.dialog-test
|
||||
(:require [clojure.test :refer [deftest is testing]]
|
||||
[ui.dialog :as dialog]))
|
||||
|
||||
(deftest dialog-class-list-test
|
||||
(testing "always returns dialog class"
|
||||
(is (= ["dialog"] (dialog/dialog-class-list {})))))
|
||||
|
||||
(deftest dialog-component-test
|
||||
(testing "renders a dialog element"
|
||||
(let [result (dialog/dialog {:id "my-dialog"} "Content")]
|
||||
(is (= :dialog (first result)))
|
||||
(is (= "dialog" (get-in result [1 :class])))
|
||||
(is (= "my-dialog" (get-in result [1 :id])))))
|
||||
|
||||
(testing "open dialog has open attr"
|
||||
(let [result (dialog/dialog {:open true} "Content")]
|
||||
(is (true? (get-in result [1 :open]))))))
|
||||
|
||||
(deftest dialog-sections-test
|
||||
(testing "dialog-header renders header"
|
||||
(let [result (dialog/dialog-header {} [:h3 "Title"])]
|
||||
(is (= :header (first result)))
|
||||
(is (= "dialog-header" (get-in result [1 :class])))))
|
||||
|
||||
(testing "dialog-body renders div"
|
||||
(let [result (dialog/dialog-body {} "Body")]
|
||||
(is (= :div (first result)))
|
||||
(is (= "dialog-body" (get-in result [1 :class])))))
|
||||
|
||||
(testing "dialog-footer renders footer"
|
||||
(let [result (dialog/dialog-footer {} "Footer")]
|
||||
(is (= :footer (first result)))
|
||||
(is (= "dialog-footer" (get-in result [1 :class]))))))
|
||||
Reference in New Issue
Block a user