-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 17996-cl-biometry-login
- Loading branch information
Showing
30 changed files
with
979 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{:linters | ||
{:unresolved-symbol | ||
{:exclude [(cljs.test/is [match? thrown-match?]) | ||
(clojure.test/is [match? thrown-match?])]}}} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions
99
src/quo/components/wallet/confirmation_progress/component_spec.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
(ns quo.components.wallet.confirmation-progress.component-spec | ||
(:require [quo.core :as quo] | ||
[reagent.core :as reagent] | ||
[test-helpers.component :as h])) | ||
|
||
(defn- get-test-data | ||
[{:keys [state network] | ||
:or {state :pending network :mainnet}}] | ||
{:counter (reagent/atom 0) | ||
:total-box 85 | ||
:progress-value "10" | ||
:network network | ||
:state state | ||
:customization-color :blue}) | ||
|
||
(h/describe "Confirmation Progress" | ||
(h/test "component renders when state is sending and network is optimism" | ||
(h/render [quo/confirmation-propgress | ||
(get-test-data {:state :sending | ||
:network :optimism})]) | ||
(h/is-truthy (h/get-by-label-text :progress-box))) | ||
|
||
(h/test "component renders when state is confirmed and network is optimism" | ||
(h/render [quo/confirmation-propgress | ||
(get-test-data {:state :confirmed | ||
:network :optimism})]) | ||
(h/is-truthy (h/get-by-label-text :progress-box))) | ||
|
||
(h/test "component renders when state is finalising and network is optimism" | ||
(h/render [quo/confirmation-propgress | ||
(get-test-data {:state :finalising | ||
:network :optimism})]) | ||
(h/is-truthy (h/get-by-label-text :progress-box))) | ||
|
||
(h/test "component renders when state is finalized and network is optimism" | ||
(h/render [quo/confirmation-propgress | ||
(get-test-data {:state :finalized | ||
:network :optimism})]) | ||
(h/is-truthy (h/get-by-label-text :progress-box))) | ||
|
||
(h/test "component renders when state is error and network is optimism" | ||
(h/render [quo/confirmation-propgress | ||
(get-test-data {:state :error | ||
:network :optimism})]) | ||
(h/is-truthy (h/get-by-label-text :progress-box))) | ||
|
||
(h/test "component renders when state is sending and network is arbitrum" | ||
(h/render [quo/confirmation-propgress | ||
(get-test-data {:state :sending | ||
:network :arbitrum})]) | ||
(h/is-truthy (h/get-by-label-text :progress-box))) | ||
|
||
(h/test "component renders when state is confirmed and network is arbitrum" | ||
(h/render [quo/confirmation-propgress | ||
(get-test-data {:state :confirmed | ||
:network :arbitrum})]) | ||
(h/is-truthy (h/get-by-label-text :progress-box))) | ||
|
||
(h/test "component renders when state is finalising and network is arbitrum" | ||
(h/render [quo/confirmation-propgress | ||
(get-test-data {:state :finalising | ||
:network :arbitrum})]) | ||
(h/is-truthy (h/get-by-label-text :progress-box))) | ||
|
||
(h/test "component renders when state is finalized and network is arbitrum" | ||
(h/render [quo/confirmation-propgress | ||
(get-test-data {:state :finalized | ||
:network :arbitrum})]) | ||
(h/is-truthy (h/get-by-label-text :progress-box))) | ||
|
||
(h/test "component renders when state is error and network is arbitrum" | ||
(h/render [quo/confirmation-propgress | ||
(get-test-data {:state :error | ||
:network :arbitrum})]) | ||
(h/is-truthy (h/get-by-label-text :progress-box))) | ||
|
||
(h/test "component renders when state is pending and network is mainnet" | ||
(h/render [quo/confirmation-propgress (get-test-data {})]) | ||
(h/is-truthy (h/get-by-label-text :mainnet-progress-box))) | ||
|
||
(h/test "component renders when state is sending and network is mainnet" | ||
(h/render [quo/confirmation-propgress (get-test-data {:state :sending})]) | ||
(h/is-truthy (h/get-by-label-text :mainnet-progress-box))) | ||
|
||
(h/test "component renders when state is confirmed and network is mainnet" | ||
(h/render [quo/confirmation-propgress (get-test-data {:state :confirmed})]) | ||
(h/is-truthy (h/get-by-label-text :mainnet-progress-box))) | ||
|
||
(h/test "component renders when state is finalising and network is mainnet" | ||
(h/render [quo/confirmation-propgress (get-test-data {:state :finalising})]) | ||
(h/is-truthy (h/get-by-label-text :mainnet-progress-box))) | ||
|
||
(h/test "component renders when state is finalized and network is mainnet" | ||
(h/render [quo/confirmation-propgress (get-test-data {:state :finalized})]) | ||
(h/is-truthy (h/get-by-label-text :mainnet-progress-box))) | ||
|
||
(h/test "component renders when state is error and network is mainnet" | ||
(h/render [quo/confirmation-propgress (get-test-data {:state :error})]) | ||
(h/is-truthy (h/get-by-label-text :mainnet-progress-box)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns quo.components.wallet.confirmation-progress.style) | ||
|
||
(def progress-box-container | ||
{:flex-direction :row | ||
:align-items :center | ||
:padding-horizontal 12 | ||
:padding-bottom 10 | ||
:padding-top 4 | ||
:flex-wrap :wrap}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
(ns quo.components.wallet.confirmation-progress.view | ||
(:require [quo.components.wallet.confirmation-progress.style :as style] | ||
[quo.components.wallet.progress-bar.view :as progress-box] | ||
[quo.theme :as quo.theme] | ||
[react-native.core :as rn])) | ||
|
||
(def ^:private max-progress 100) | ||
(def ^:private min-progress 0) | ||
|
||
(defn- calculate-box-state | ||
[state counter index] | ||
(cond | ||
(and (= state :sending) (>= counter index) (< index 3)) :confirmed | ||
(and (= state :confirmed) (>= counter index) (< index 5)) :confirmed | ||
(and (= state :finalising) (>= counter index) (< index 5)) :confirmed | ||
(and (= state :finalising) (>= counter index) (> index 4) (< index 20)) :finalized | ||
(and (= state :finalized) (>= counter index) (< index 5)) :confirmed | ||
(and (= state :finalized) (>= counter index) (> index 4)) :finalized | ||
(and (= state :error) (>= counter index) (< index 2)) :error | ||
:else :pending)) | ||
|
||
(defn- calculate-box-state-sidenet | ||
[state] | ||
(case state | ||
:error :error | ||
(:confirmed :finalising :finalized) :finalized | ||
:pending)) | ||
|
||
(defn- calculate-progressed-value | ||
[state progress-value] | ||
(case state | ||
:finalising progress-value | ||
:finalized max-progress | ||
min-progress)) | ||
|
||
(defn- progress-boxes-mainnet | ||
[{:keys [state counter total-box]}] | ||
[rn/view | ||
{:accessibility-label :mainnet-progress-box | ||
:style style/progress-box-container} | ||
(let [numbers (range 1 total-box)] | ||
(doall (for [n numbers] | ||
[progress-box/view | ||
{:state (calculate-box-state state counter n) | ||
:customization-color :blue | ||
:key n}])))]) | ||
|
||
(defn- progress-boxes-sidenet | ||
[{:keys [state progress-value]}] | ||
[rn/view | ||
{:accessibility-label :progress-box | ||
:style style/progress-box-container} | ||
[progress-box/view | ||
{:state (calculate-box-state-sidenet state) | ||
:customization-color :success}] | ||
[progress-box/view | ||
{:state (calculate-box-state-sidenet state) | ||
:full-width? true | ||
:progressed-value (calculate-progressed-value state progress-value) | ||
:customization-color :blue}]]) | ||
|
||
(defn- view-internal | ||
[{:keys [network] :as props}] | ||
(case network | ||
:mainnet [progress-boxes-mainnet props] | ||
(:arbitrum :optimism) [progress-boxes-sidenet props] | ||
nil)) | ||
|
||
(def view (quo.theme/with-theme view-internal)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.