Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions core/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ export class Input implements ComponentInterface {
*/
@Watch('value')
protected valueChanged() {
if (this.nativeInput && !this.isComposing) {
const nativeInput = this.nativeInput;
const value = this.getValue();
if (nativeInput && nativeInput.value !== value && !this.isComposing) {
/**
* Assigning the native input's value on attribute
* value change, allows `ionInput` implementations
Expand All @@ -241,11 +243,7 @@ export class Input implements ComponentInterface {
* Used for patterns such as input trimming (removing whitespace),
* or input masking.
*/
const { selectionStart, selectionEnd } = this.nativeInput;
this.nativeInput.value = this.getValue();
// TODO: FW-727 Remove this when we drop support for iOS 15.3
// Set the cursor position back to where it was before the value change
this.nativeInput.setSelectionRange(selectionStart, selectionEnd);
nativeInput.value = value;
}
this.emitStyle();
this.ionChange.emit({ value: this.value == null ? this.value : this.value.toString() });
Expand Down
25 changes: 25 additions & 0 deletions core/src/components/input/test/basic/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,29 @@ test('input: basic', async () => {
for (const compare of compares) {
expect(compare).toMatchScreenshot();
}


});

test('input: basic should not error on input', async () => {
const page = await newE2EPage({
url: '/src/components/input/test/basic?ionic:_testing=true'
});

const errors = [];

page.on('console', msg => {
if (msg.type() === 'error') {
errors.push(msg.text);
}
});

const inputs = await page.findAll('ion-input');

for (const input of inputs) {
await input.click();
await input.type('letters and 12345');
}

expect(errors.length).toEqual(0);
})