-
Notifications
You must be signed in to change notification settings - Fork 13.3k
fix(datetime): allow disabling datetime with prefer-wheel #28511
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
ed7f7a8
fix(datetime): allow disabling datetime with prefer-wheel
mapsandapps b7e42be
chore(): add updated snapshots
Ionitron 254294e
Merge branch 'main' into FW-5408
mapsandapps be8f483
Convert test
mapsandapps 41b6369
Improve test (still failing)
mapsandapps 031e9ab
Fix test
mapsandapps 0bab06e
Merge branch 'main' into FW-5408
mapsandapps aff808a
Rearrange styles
mapsandapps eb3dd1d
Merge branch 'main' into FW-5408
mapsandapps c5c6405
Merge branch 'main' into FW-5408
mapsandapps b2b4116
Refactor & address PR feedback
mapsandapps 549a11f
Fix refactoring typo
mapsandapps 9759820
Make IntersectionObserver mocking more consistent
mapsandapps 8477187
Fix styles
mapsandapps d8d04be
Simplify selector
mapsandapps 450448c
Address PR feedback
mapsandapps 048bb82
Address PR feedback
mapsandapps b15fbfa
Address PR feedback
mapsandapps 7a3771a
Try to fix flaky test
mapsandapps 4661667
Try to fix test by setting value initially
mapsandapps d49a495
Revert 7a3771a
mapsandapps 845ecb3
Set value on element
mapsandapps c86735f
Add snapshot test for disabled datetime with wheel
mapsandapps ffec723
chore(): add updated snapshots
Ionitron fab89a7
test: remove redundant test
liamdebeasi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
core/src/components/datetime/test/disabled/datetime.spec.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { h } from '@stencil/core'; | ||
| import { newSpecPage } from '@stencil/core/testing'; | ||
|
|
||
| import { Datetime } from '../../../datetime/datetime'; | ||
| import { PickerColumnInternal } from '../../../picker-column-internal/picker-column-internal'; | ||
| import { PickerInternal } from '../../../picker-internal/picker-internal'; | ||
|
|
||
| describe('ion-datetime disabled', () => { | ||
| beforeEach(() => { | ||
| // IntersectionObserver isn't available in test environment | ||
| const mockIntersectionObserver = jest.fn(); | ||
| mockIntersectionObserver.mockReturnValue({ | ||
| observe: () => null, | ||
| unobserve: () => null, | ||
| disconnect: () => null, | ||
| }); | ||
| global.IntersectionObserver = mockIntersectionObserver; | ||
| }); | ||
|
|
||
| it('picker should be disabled in prefer wheel mode', async () => { | ||
| const page = await newSpecPage({ | ||
| components: [Datetime, PickerColumnInternal, PickerInternal], | ||
| template: () => ( | ||
| <ion-datetime id="inline-datetime-wheel" disabled prefer-wheel value="2022-04-21T00:00:00"></ion-datetime> | ||
| ), | ||
| }); | ||
|
|
||
| await page.waitForChanges(); | ||
|
|
||
| const datetime = page.body.querySelector('ion-datetime')!; | ||
| const columns = datetime.shadowRoot!.querySelectorAll('ion-picker-column-internal'); | ||
|
|
||
| await expect(columns.length).toEqual(4); | ||
|
|
||
| columns.forEach((column) => { | ||
| expect(column.disabled).toBe(true); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.