diff --git a/__tests__/TelInput.test.js b/__tests__/TelInput.test.js index 2ddbac789..90db68f86 100644 --- a/__tests__/TelInput.test.js +++ b/__tests__/TelInput.test.js @@ -446,6 +446,16 @@ describe('TelInput', function () { // eslint-disable-line func-names subject.setProps({ value: 'foo bar' }); expect(inputComponent.props().value).toBe('foo bar'); }); + + it('should be able to delete country code after input field has been populated with number', () => { + const subject = this.makeSubject(); + + subject.setProps({ value: '+447598455159' }); + + subject.setProps({ value: '+' }); + + expect(subject.state().value).toBe('+'); + }); }); describe('uncontrolled', () => { diff --git a/src/components/IntlTelInputApp.js b/src/components/IntlTelInputApp.js index 9338c3ae3..c39a4f0ca 100644 --- a/src/components/IntlTelInputApp.js +++ b/src/components/IntlTelInputApp.js @@ -726,9 +726,6 @@ class IntlTelInputApp extends Component { // Note: use getNumeric here because the number has not been // formatted yet, so could contain bad chars countryCode = null; - } else if (!number || number === '+') { - // empty, or just a plus, so default - countryCode = this.defaultCountry; } if (countryCode !== null) {