mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(checkbox): ionChange fires on user interaction (#25923)
BREAKING CHANGE: `ionChange` is no longer emitted when the `checked` property of `ion-checkbox` is modified externally. `ionChange` is only emitted from user committed changes, such as clicking or tapping the checkbox.
This commit is contained in:
@@ -388,7 +388,10 @@ export class IonCardTitle {
|
||||
import type { CheckboxChangeEventDetail as ICheckboxCheckboxChangeEventDetail } from '@ionic/core';
|
||||
export declare interface IonCheckbox extends Components.IonCheckbox {
|
||||
/**
|
||||
* Emitted when the checked property has changed.
|
||||
* Emitted when the checked property has changed
|
||||
as a result of a user action such as a click.
|
||||
This event will not emit when programmatically
|
||||
setting the checked property.
|
||||
*/
|
||||
ionChange: EventEmitter<CustomEvent<ICheckboxCheckboxChangeEventDetail>>;
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('Inputs', () => {
|
||||
it('change values should update angular', () => {
|
||||
cy.get('#reset-button').click();
|
||||
|
||||
cy.get('ion-checkbox').invoke('prop', 'checked', true);
|
||||
cy.get('ion-checkbox#first-checkbox').click();
|
||||
cy.get('ion-toggle').invoke('prop', 'checked', true);
|
||||
|
||||
cy.get('ion-input').eq(0).type('hola');
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Checkbox</ion-label>
|
||||
<ion-checkbox [(ngModel)]="checkbox" slot="start"></ion-checkbox>
|
||||
<ion-checkbox [(ngModel)]="checkbox" slot="start" id="first-checkbox"></ion-checkbox>
|
||||
<ion-note slot="end" id="checkbox-note">{{checkbox}}</ion-note>
|
||||
</ion-item>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user