mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-04-30 21:31:40 +08:00
@@ -330,7 +330,8 @@ describe('components/TextInput', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('prop "onSelectionChange"', done => {
|
||||
describe('prop "onSelectionChange"', () => {
|
||||
test('is called on select', done => {
|
||||
const input = findNativeInput(
|
||||
mount(<TextInput defaultValue="12345" onSelectionChange={onSelectionChange} />)
|
||||
);
|
||||
@@ -344,6 +345,14 @@ describe('components/TextInput', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('is called on change', () => {
|
||||
const onSelectionChange = jest.fn();
|
||||
const input = findNativeInput(mount(<TextInput onSelectionChange={onSelectionChange} />));
|
||||
input.simulate('change');
|
||||
expect(onSelectionChange).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('prop "onSubmitEditing"', () => {
|
||||
test('single-line input', done => {
|
||||
const input = findNativeInput(
|
||||
|
||||
@@ -282,6 +282,7 @@ class TextInput extends Component<*> {
|
||||
if (onChangeText) {
|
||||
onChangeText(text);
|
||||
}
|
||||
this._handleSelectionChange(e);
|
||||
};
|
||||
|
||||
_handleFocus = e => {
|
||||
|
||||
Reference in New Issue
Block a user