|
| 1 | +(ns quo2.components.wallet.progress-bar.component-spec |
| 2 | + (:require [test-helpers.component :as h] |
| 3 | + [quo2.components.wallet.progress-bar.view :as progress-bar] |
| 4 | + [quo2.foundations.colors :as colors])) |
| 5 | + |
| 6 | +(h/describe "Progress bar" |
| 7 | + (h/test "pending state in light mode" |
| 8 | + (let [theme :light |
| 9 | + props {:state :pending |
| 10 | + :customization-color :blue}] |
| 11 | + (h/render-with-theme-provider [progress-bar/view props] theme) |
| 12 | + (h/has-style (h/query-by-label-text :progress-bar) |
| 13 | + {:height 12 |
| 14 | + :width 8 |
| 15 | + :borderRadius 3 |
| 16 | + :borderColor colors/neutral-80-opa-5 |
| 17 | + :backgroundColor colors/neutral-5}))) |
| 18 | + |
| 19 | + (h/test "pending state in dark mode" |
| 20 | + (let [theme :dark |
| 21 | + props {:state :pending |
| 22 | + :customization-color :blue}] |
| 23 | + (h/render-with-theme-provider [progress-bar/view props] theme) |
| 24 | + (h/has-style (h/query-by-label-text :progress-bar) |
| 25 | + {:height 12 |
| 26 | + :width 8 |
| 27 | + :borderRadius 3 |
| 28 | + :borderColor colors/neutral-70 |
| 29 | + :backgroundColor colors/neutral-80}))) |
| 30 | + |
| 31 | + (h/test "finalized state with customtization-color blue in light mode" |
| 32 | + (let [theme :light |
| 33 | + props {:state :finalized |
| 34 | + :customization-color :blue}] |
| 35 | + (h/render-with-theme-provider [progress-bar/view props] theme) |
| 36 | + (h/has-style (h/query-by-label-text :progress-bar) |
| 37 | + {:height 12 |
| 38 | + :width 8 |
| 39 | + :borderRadius 3 |
| 40 | + :borderColor colors/neutral-80-opa-5 |
| 41 | + :backgroundColor (colors/custom-color (:customization-color props) 50)}))) |
| 42 | + |
| 43 | + (h/test "finalized state with customtization-color blue in dark mode" |
| 44 | + (let [theme :dark |
| 45 | + props {:state :finalized |
| 46 | + :customization-color :blue}] |
| 47 | + (h/render-with-theme-provider [progress-bar/view props] theme) |
| 48 | + (h/has-style (h/query-by-label-text :progress-bar) |
| 49 | + {:height 12 |
| 50 | + :width 8 |
| 51 | + :borderRadius 3 |
| 52 | + :borderColor colors/neutral-80-opa-5 |
| 53 | + :backgroundColor (colors/custom-color (:customization-color props) 60)}))) |
| 54 | + |
| 55 | + (h/test "finalized state with customtization-color army in light mode" |
| 56 | + (let [theme :light |
| 57 | + props {:state :finalized |
| 58 | + :customization-color :army}] |
| 59 | + (h/render-with-theme-provider [progress-bar/view props] theme) |
| 60 | + (h/has-style (h/query-by-label-text :progress-bar) |
| 61 | + {:height 12 |
| 62 | + :width 8 |
| 63 | + :borderRadius 3 |
| 64 | + :borderColor colors/neutral-80-opa-5 |
| 65 | + :backgroundColor (colors/custom-color (:customization-color props) 50)}))) |
| 66 | + |
| 67 | + (h/test "confirmed state in light mode" |
| 68 | + (let [theme :light |
| 69 | + props {:state :confirmed |
| 70 | + :customization-color :blue}] |
| 71 | + (h/render-with-theme-provider [progress-bar/view props] theme) |
| 72 | + (h/has-style (h/query-by-label-text :progress-bar) |
| 73 | + {:height 12 |
| 74 | + :width 8 |
| 75 | + :borderRadius 3 |
| 76 | + :borderColor colors/neutral-80-opa-5 |
| 77 | + :backgroundColor colors/success-50}))) |
| 78 | + |
| 79 | + (h/test "confirmed state in dark mode" |
| 80 | + (let [theme :dark |
| 81 | + props {:state :confirmed |
| 82 | + :customization-color :blue}] |
| 83 | + (h/render-with-theme-provider [progress-bar/view props] theme) |
| 84 | + (h/has-style (h/query-by-label-text :progress-bar) |
| 85 | + {:height 12 |
| 86 | + :width 8 |
| 87 | + :borderRadius 3 |
| 88 | + :borderColor colors/white-opa-5 |
| 89 | + :backgroundColor colors/success-60}))) |
| 90 | + |
| 91 | + (h/test "error state in light mode" |
| 92 | + (let [theme :light |
| 93 | + props {:state :error |
| 94 | + :customization-color :blue}] |
| 95 | + (h/render-with-theme-provider [progress-bar/view props] theme) |
| 96 | + (h/has-style (h/query-by-label-text :progress-bar) |
| 97 | + {:height 12 |
| 98 | + :width 8 |
| 99 | + :borderRadius 3 |
| 100 | + :borderColor colors/neutral-80-opa-5 |
| 101 | + :backgroundColor colors/danger-50}))) |
| 102 | + |
| 103 | + (h/test "error state in dark mode" |
| 104 | + (let [theme :dark |
| 105 | + props {:state :error |
| 106 | + :customization-color :blue}] |
| 107 | + (h/render-with-theme-provider [progress-bar/view props] theme) |
| 108 | + (h/has-style (h/query-by-label-text :progress-bar) |
| 109 | + {:height 12 |
| 110 | + :width 8 |
| 111 | + :borderRadius 3 |
| 112 | + :borderColor colors/white-opa-5 |
| 113 | + :backgroundColor colors/danger-60})))) |
0 commit comments