2017-05-30 13 views
0

私は酵素の浅いレンダーを使ってonPressをシミュレートしようとしています。 しかし、私は反応intlのためにTouchableOpacityにアクセスすることができませんenyzmeを使った浅い反応と反応したintlを使った反応の実験

私は反応コンポーネントにintlを注入するためのヘルパー関数を見てきましたが、これらはReactでのみ動作し、反応ネイティブではないようです。

it("should handle button presses",() => { 
    const onPress = sinon.spy(); 
    const button = shallow(
    <IntlProvider locale='en'> 
     <ButtonApprove 
     tintColor={STYLES.COLOR.BRAND_SUCCESS} 
     buttonStyle={{}} 
     containerStyle={{}} 
     handlePress={onPress} 
     /> 
    </IntlProvider> 
); 
    // console.log(button.instance()); 
    button.find(TouchableOpacity).simulate('press'); 
    expect(onPress.calledOnce).toEqual(true); 
}); 

JSdomはこの問題を回避する方法ですか?

+0

私は私の質問を解決しました。 この記事は本当に私を助けました。 https://stackoverflow.com/questions/41649728/how-can-i-test-react-native-component-with-mocha-enzyme-chai-when-its-wrapp?rq=1 – Henry

答えて

関連する問題