This issue says that fireEvent.changeText
event should not call onChangeText
function when editable
is false
, yet when I run this:
import React from 'react';
import { fireEvent, render } from '@testing-library/react-native';
import { TextInput } from 'react-native';
describe('Button', () => {
it('should not be editable, if editable is false', () => {
const handleChangeText = jest.fn();
const screen = render(<TextInput onChangeText={ handleChangeText } editable={ false } testID={ 'stuff' }/>);
fireEvent.changeText(screen.getByTestId('stuff'), 'Trigger');
expect(handleChangeText).not.toHaveBeenCalled();
});
});
My test fails, because handleChangeText
is called.
I use:
"@testing-library/react-native": "7.1.0"
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.0.tar.gz"