mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 03:26:31 +00:00
chore: fix unit test for slide button (#16302)
This commit is contained in:
parent
5214f34b31
commit
fdb042f4e9
@ -63,6 +63,15 @@
|
||||
:track-icon :face-id})
|
||||
|
||||
(h/describe "slide-button"
|
||||
(h/before-each
|
||||
(fn []
|
||||
(h/use-fake-timers)))
|
||||
|
||||
(h/after-each
|
||||
(fn []
|
||||
(h/clear-all-timers)
|
||||
(h/use-real-timers)))
|
||||
|
||||
(h/test "render the correct text"
|
||||
(h/render [slide-button/view default-props])
|
||||
(h/is-truthy (h/get-by-text :test-track-text)))
|
||||
@ -90,9 +99,12 @@
|
||||
slide-dest constants/default-width
|
||||
gesture-events (slide-events slide-dest)]
|
||||
(h/render [slide-button/view props])
|
||||
(-> (act #(gestures-jest/fireGestureHandler (get-by-gesture-test-id :slide-button-gestures)
|
||||
gesture-events))
|
||||
(.then #(h/was-called (:on-complete props))))))
|
||||
(let [promise
|
||||
(-> (act #(gestures-jest/fireGestureHandler (get-by-gesture-test-id :slide-button-gestures)
|
||||
gesture-events)))]
|
||||
(h/advance-timers-by-time 250)
|
||||
(-> promise
|
||||
(.then #(h/was-called (:on-complete props)))))))
|
||||
|
||||
(h/test
|
||||
"doesn't call on-complete if the slide was incomplete"
|
||||
@ -100,6 +112,9 @@
|
||||
slide-dest (- constants/default-width 100)
|
||||
gesture-events (slide-events slide-dest)]
|
||||
(h/render [slide-button/view props])
|
||||
(-> (act #(gestures-jest/fireGestureHandler (get-by-gesture-test-id :slide-button-gestures)
|
||||
gesture-events))
|
||||
(.then #(h/was-not-called (:on-complete props)))))))
|
||||
(let [promise (-> (act #(gestures-jest/fireGestureHandler (get-by-gesture-test-id
|
||||
:slide-button-gestures)
|
||||
gesture-events)))]
|
||||
(h/advance-timers-by-time 250)
|
||||
(-> promise (.then #(h/was-not-called (:on-complete props))))))))
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
[quo2.components.banners.banner.component-spec]
|
||||
[quo2.components.buttons.--tests--.buttons-component-spec]
|
||||
[quo2.components.buttons.predictive-keyboard.component-spec]
|
||||
[quo2.components.buttons.slide-button.component-spec]
|
||||
[quo2.components.colors.color-picker.component-spec]
|
||||
[quo2.components.counter.--tests--.counter-component-spec]
|
||||
[quo2.components.counter.step.component-spec]
|
||||
@ -32,7 +33,7 @@
|
||||
[quo2.components.selectors.filter.component-spec]
|
||||
[quo2.components.selectors.reactions.component-spec]
|
||||
[quo2.components.selectors.selectors.component-spec]
|
||||
[quo2.components.settings.reorder-item.component-spec]
|
||||
[quo2.components.settings.settings-list.component-spec]
|
||||
[quo2.components.share.share-qr-code.component-spec]
|
||||
[quo2.components.tags.--tests--.status-tags-component-spec]
|
||||
[quo2.components.settings.reorder-item.component-spec]))
|
||||
[quo2.components.tags.--tests--.status-tags-component-spec]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user