Fix tests

This commit is contained in:
Nicolas Gallagher
2016-11-03 08:51:51 -07:00
parent 2b826dc7f4
commit b248de552d
2 changed files with 7 additions and 7 deletions
@@ -22,12 +22,12 @@ const testIfDocumentIsFocused = (message, fn) => {
suite('components/TextInput', () => {
test('prop "autoComplete"', () => {
// off
let input = findNativeInput(shallow(<TextInput />));
assert.equal(input.prop('autoComplete'), undefined);
// on
input = findNativeInput(shallow(<TextInput autoComplete />));
let input = findNativeInput(shallow(<TextInput />));
assert.equal(input.prop('autoComplete'), 'on');
// off
input = findNativeInput(shallow(<TextInput autoComplete='off' />));
assert.equal(input.prop('autoComplete'), 'off');
});
test('prop "autoFocus"', () => {
@@ -179,8 +179,8 @@ suite('components/TextInput', () => {
const input = findNativeInput(mount(<TextInput defaultValue='12345' onSelectionChange={onSelectionChange} />));
input.simulate('select', { target: { selectionStart: 0, selectionEnd: 3 } });
function onSelectionChange(e) {
assert.equal(e.selectionEnd, 3);
assert.equal(e.selectionStart, 0);
assert.equal(e.nativeEvent.selection.end, 3);
assert.equal(e.nativeEvent.selection.start, 0);
done();
}
});
+1 -1
View File
@@ -79,11 +79,11 @@ class TextInput extends Component {
placeholder: PropTypes.string,
placeholderTextColor: PropTypes.string,
secureTextEntry: PropTypes.bool,
selectTextOnFocus: PropTypes.bool,
selection: PropTypes.shape({
start: PropTypes.number.isRequired,
end: PropTypes.number
}),
selectTextOnFocus: PropTypes.bool,
style: Text.propTypes.style,
testID: Text.propTypes.testID,
value: PropTypes.string