【发布时间】:2020-10-09 08:51:46
【问题描述】:
如何在测试文件(Jest 和 Enzyme)中访问组件中的 props 值? 这是我的组件,我想在测试文件(Jest 和 Enzyme)中访问 Pin 组件中的 prop 值,可以吗?
<View style={styles.containerForm}>
<Text style={styles.textDescriptionGreyFont}>Enter Code</Text>
<Pin testID={'input_pin'} count={4} value={otp} setCode={(code) => setOtpCode(code)} />
<View style={styles.containerResendTimer}>
{renderResend()}
<Text style={styles.textDescriptionThemaFont}>{renderTimer()}</Text>
</View>
<ButtonFull
testID={'submit_otp'}
isDisabled={false}
buttonColor={fullFilled ? color.thema : color.disabledButton}
onPress={() => submitOtp()}
title={submitting ? 'Loading ...' : 'Submit'}
/>
</View>
【问题讨论】:
-
你的意思是
this.props? -
我的错,我想在 jest 和酵素中从 pin 组件访问 prop
标签: react-native jestjs enzyme