File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed
Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { render } from '@testing-library/react-native' ;
3+ import { MarkerProps , SliderTrackMark } from '../../src/components/TrackMark' ;
4+ import { View } from 'react-native' ;
5+
6+ const MockedStepMarker = ( { } : MarkerProps ) => (
7+ < View testID = "mockedStepMarker" />
8+ ) ;
9+
10+ const MockedThumbImage = 1 ;
11+
12+ describe ( 'TrackMark' , ( ) => {
13+ it ( 'Renders the StepMarker if custom component is given' , ( ) => {
14+ const { getByTestId} = render (
15+ < SliderTrackMark
16+ StepMarker = { MockedStepMarker }
17+ isTrue = { false }
18+ index = { 0 }
19+ currentValue = { 0 }
20+ min = { 0 }
21+ max = { 0 }
22+ /> ,
23+ ) ;
24+ expect ( getByTestId ( 'mockedStepMarker' ) ) . toBeDefined ( ) ;
25+ } ) ;
26+
27+ it ( 'Renders the StepMarker with thumbImage if provided' , ( ) => {
28+ const { getByTestId} = render (
29+ < SliderTrackMark
30+ thumbImage = { MockedThumbImage }
31+ StepMarker = { MockedStepMarker }
32+ isTrue = { true }
33+ index = { 0 }
34+ currentValue = { 0 }
35+ min = { 0 }
36+ max = { 0 }
37+ /> ,
38+ ) ;
39+ expect ( getByTestId ( 'sliderTrackMark-thumbImage' ) ) . toBeDefined ( ) ;
40+ } ) ;
41+ } ) ;
Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ export const SliderTrackMark = ({
4141 />
4242 ) : null }
4343 { thumbImage && isTrue ? (
44- < View style = { styles . thumbImageContainer } >
44+ < View
45+ style = { styles . thumbImageContainer }
46+ testID = "sliderTrackMark-thumbImage" >
4547 < Image
4648 source = { thumbImage as ImageSourcePropType }
4749 style = { styles . thumbImage }
You can’t perform that action at this time.
0 commit comments