@@ -3,7 +3,7 @@ import {Hint} from 'react-native-ui-lib';
3
3
import { Colors } from '../../../style' ;
4
4
import { render , findStyle } from '../../../uilib-test-renderer' ;
5
5
6
- const HintTestComponent = ( { showHint} ) => {
6
+ const HintTestComponent = ( { showHint, color } ) => {
7
7
return (
8
8
< Hint
9
9
visible = { showHint }
@@ -13,7 +13,7 @@ const HintTestComponent = ({showHint}) => {
13
13
key = { '1' }
14
14
targetFrame = { { x : 1 , y : 1 , height : 1 , width : 1 } }
15
15
onBackgroundPress = { ( ) => { } }
16
- color = { Colors . white }
16
+ color = { color }
17
17
removePaddings
18
18
enableShadow
19
19
testID = { 'Hint' }
@@ -28,16 +28,20 @@ describe('Hint Screen component test', () => {
28
28
const expectedColor = Colors . primary ;
29
29
const element = < HintTestComponent showHint /> ;
30
30
31
- const { getByTestId} = render ( element ) ;
31
+ const { getByTestId, rerender } = render ( element ) ;
32
32
33
33
const wrapper = getByTestId ( 'Hint' ) ;
34
34
expect ( wrapper ) . toBeTruthy ( ) ;
35
35
36
36
const hint = getByTestId ( hintTestId ) ;
37
- const color = findStyle ( 'backgroundColor' , hint ) ;
37
+ let color = findStyle ( 'backgroundColor' , hint ) ;
38
38
39
39
expect ( color ) . toBe ( expectedColor ) ;
40
40
expect ( hint ) . toBeTruthy ( ) ;
41
+
42
+ rerender ( < HintTestComponent showHint color = { Colors . white } /> ) ;
43
+ color = findStyle ( 'backgroundColor' , hint ) ;
44
+ expect ( color ) . toBe ( Colors . white ) ;
41
45
} ) ;
42
46
43
47
it ( 'Test Hint modal is not visible when showHint is false' , async ( ) => {
0 commit comments