-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(datetime): presentation time emits ionChange once #24968
Conversation
core/src/components/picker-column-internal/picker-column-internal.tsx
Outdated
Show resolved
Hide resolved
el.scrollTo(0, 300); | ||
}); | ||
|
||
expect(ionChangeSpy).not.toHaveReceivedEvent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(ionChangeSpy).not.toHaveReceivedEvent(); | |
expect(ionChangeSpy).toHaveReceivedEvent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, I also needed to wait for the event:
await ionChangeSpy.next();
expect(ionChangeSpy).toHaveReceivedEvent();
Confirmed this test passed with the changes and failed against main. I'll wait for CI before finally merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to merge once test is fixed
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
When modifying the value of an
ion-datetime[presentation="time"]
with the picker wheel visible in the viewport; the datetime component will emit 4ionChange
events, resulting in an incorrect value and in Angular, an incorrect display of the picker wheel.For example, when setting the value to
06:02:40
, the emitted events will be:This corresponds to:
ion-datetime
watch callback for the value being modified/ionChange.ion-picker-column-internal
hour column detecting a change/modifying the value.ion-picker-column-internal
minute column detecting a change/modifying the value.ion-picker-column-internal
am/pm column detecting a change/modifying the value.Issue URL: #24967
What is the new behavior?
ion-datetime[presentation="time"]
will only emit a singleionChange
event when the value is modified, regardless if the picker wheel is visible in the viewport or not.This results in the value correctly reflecting the new datetime value and the display of the component to be correct.
The
ion-picker-column-internal
will not emitionChange
events when the value is modified externally. It will only emit change events as a result of selecting a new value or the fallback setting the initial value.Does this introduce a breaking change?
Other information