diff --git a/ember-phone-input/src/components/phone-input.js b/ember-phone-input/src/components/phone-input.js index ba40e079..33b7d013 100644 --- a/ember-phone-input/src/components/phone-input.js +++ b/ember-phone-input/src/components/phone-input.js @@ -297,6 +297,8 @@ export default Component.extend({ if (this.number) { this._iti.setNumber(this.number); + } else { + this._iti.setNumber(''); } }, diff --git a/test-app/tests/integration/components/phone-input-test.js b/test-app/tests/integration/components/phone-input-test.js index 4fcc790c..c3861b04 100644 --- a/test-app/tests/integration/components/phone-input-test.js +++ b/test-app/tests/integration/components/phone-input-test.js @@ -19,9 +19,9 @@ module('Integration | Component | phone-input', function (hooks) { }); test('renders the value', async function (assert) { - assert.expect(3); + assert.expect(4); - const newValue = '2'; + let newValue = '2'; this.set('number', null); this.set('update', () => {}); @@ -39,6 +39,11 @@ module('Integration | Component | phone-input', function (hooks) { await fillIn('input', newValue); assert.dom('input').hasValue(newValue); + + this.set('number', null); + newValue = null; + + assert.dom('input').hasValue(''); }); test('renders the custom placeholder', async function (assert) {