Closed cr1979 closed 2 years ago
ok it's not a bug. You have to use the ionChange event instead of the input event.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Prerequisites
Ionic Framework Version
Current Behavior
We're using angular reactive forms and jest for TDD in our project. And we want to test the input behavior. In our spec file, a specific value that we set will not be changed in the form group. I tried to dispatch an input and a change event. In our HTML we use the ion-input element. If I exchange it with an angular input element the value will be changed. Maybe this is a bug or someone has a workaround for me. I also tried it with fakeAsync and a tick between dispatchEvent and detectChanges
Here are some code snippets: login.page.html: `
`
login.page.ts: `
`
login.page.spec.ts: `
`
package.json: `
`
Expected Behavior
A modified value will be transmitted by an input or/and change event. So that will be changed in the form group of reactive forms
Steps to Reproduce
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 6.13.1 (C:\Users\CyrillRoth\AppData\Roaming\npm\node_modules\@ionic\cli) Ionic Framework : @ionic/angular 6.0.8 @angular-devkit/build-angular : 12.1.4 @angular-devkit/schematics : 12.1.4 @angular/cli : 12.1.4 @ionic/angular-toolkit : 4.0.0
Cordova:
Cordova CLI : 8.1.0 Cordova Platforms : not available Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 6 other plugins)
Utility:
cordova-res : not installed native-run : 1.4.1
System:
Android SDK Tools : 26.1.1 (C:\Users\CyrillRoth\AppData\Local\Android\Sdk) NodeJS : v15.12.0 (C:\Program Files\nodejs\node.exe) npm : 7.6.3 OS : Windows 10
─────────────────────────────────────────────────
─────────────────────────────────────────────────
Additional Information
It is working with an input element from angular.