mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-08-15 18:45:06 +00:00
Fix tests
This commit is contained in:
@@ -22,12 +22,12 @@ const testIfDocumentIsFocused = (message, fn) => {
|
|||||||
|
|
||||||
suite('components/TextInput', () => {
|
suite('components/TextInput', () => {
|
||||||
test('prop "autoComplete"', () => {
|
test('prop "autoComplete"', () => {
|
||||||
// off
|
|
||||||
let input = findNativeInput(shallow(<TextInput />));
|
|
||||||
assert.equal(input.prop('autoComplete'), undefined);
|
|
||||||
// on
|
// on
|
||||||
input = findNativeInput(shallow(<TextInput autoComplete />));
|
let input = findNativeInput(shallow(<TextInput />));
|
||||||
assert.equal(input.prop('autoComplete'), 'on');
|
assert.equal(input.prop('autoComplete'), 'on');
|
||||||
|
// off
|
||||||
|
input = findNativeInput(shallow(<TextInput autoComplete='off' />));
|
||||||
|
assert.equal(input.prop('autoComplete'), 'off');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('prop "autoFocus"', () => {
|
test('prop "autoFocus"', () => {
|
||||||
@@ -179,8 +179,8 @@ suite('components/TextInput', () => {
|
|||||||
const input = findNativeInput(mount(<TextInput defaultValue='12345' onSelectionChange={onSelectionChange} />));
|
const input = findNativeInput(mount(<TextInput defaultValue='12345' onSelectionChange={onSelectionChange} />));
|
||||||
input.simulate('select', { target: { selectionStart: 0, selectionEnd: 3 } });
|
input.simulate('select', { target: { selectionStart: 0, selectionEnd: 3 } });
|
||||||
function onSelectionChange(e) {
|
function onSelectionChange(e) {
|
||||||
assert.equal(e.selectionEnd, 3);
|
assert.equal(e.nativeEvent.selection.end, 3);
|
||||||
assert.equal(e.selectionStart, 0);
|
assert.equal(e.nativeEvent.selection.start, 0);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -79,11 +79,11 @@ class TextInput extends Component {
|
|||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
placeholderTextColor: PropTypes.string,
|
placeholderTextColor: PropTypes.string,
|
||||||
secureTextEntry: PropTypes.bool,
|
secureTextEntry: PropTypes.bool,
|
||||||
|
selectTextOnFocus: PropTypes.bool,
|
||||||
selection: PropTypes.shape({
|
selection: PropTypes.shape({
|
||||||
start: PropTypes.number.isRequired,
|
start: PropTypes.number.isRequired,
|
||||||
end: PropTypes.number
|
end: PropTypes.number
|
||||||
}),
|
}),
|
||||||
selectTextOnFocus: PropTypes.bool,
|
|
||||||
style: Text.propTypes.style,
|
style: Text.propTypes.style,
|
||||||
testID: Text.propTypes.testID,
|
testID: Text.propTypes.testID,
|
||||||
value: PropTypes.string
|
value: PropTypes.string
|
||||||
|
|||||||
Reference in New Issue
Block a user