-
Notifications
You must be signed in to change notification settings - Fork 13.4k
fix(datetime): update active calendar display when value changes #24244
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
6 commits
Select commit
Hold shift + click to select a range
5e975ed
fix(datetime): update active calendar display when value changes
sean-perkins 454aedf
fix(datetime): update the active date value in picker
sean-perkins 27bd317
fix(datetime): update the display to match the current value
sean-perkins 80a0cdc
test(datetime): setting the value programmatically updates the display
sean-perkins 01e89b6
fix(datetime): localize test
sean-perkins 3f5a7a6
refactor(datetime): use activePartsClone variable naming
sean-perkins 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { newE2EPage } from '@stencil/core/testing'; | ||
|
||
describe('datetime: setting the value', () => { | ||
|
||
it('should update the active date', async () => { | ||
const page = await newE2EPage({ | ||
url: '/src/components/datetime/test/set-value?ionic:_testing=true' | ||
}); | ||
|
||
await page.$eval('ion-datetime', (elm: any) => { | ||
elm.value = '2021-11-25T12:40:00.000Z'; | ||
}); | ||
|
||
await page.waitForChanges(); | ||
|
||
const activeDate = await page.find('ion-datetime >>> .calendar-day-active'); | ||
|
||
expect(activeDate).toEqualText('25'); | ||
}); | ||
|
||
it('should update the active time', async () => { | ||
const page = await newE2EPage({ | ||
url: '/src/components/datetime/test/set-value?ionic:_testing=true' | ||
}); | ||
|
||
await page.$eval('ion-datetime', (elm: any) => { | ||
elm.value = '2021-11-25T12:40:00.000Z'; | ||
}); | ||
|
||
await page.waitForChanges(); | ||
|
||
const activeTime = await page.find('ion-datetime >>> .time-body'); | ||
|
||
expect(activeTime).toEqualText('12:40 PM'); | ||
}) | ||
}) | ||
|
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,42 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" dir="ltr"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Datetime - Set Value</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"> | ||
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet"> | ||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet"> | ||
<script src="../../../../../scripts/testing/scripts.js"></script> | ||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> | ||
<style> | ||
h2 { | ||
font-size: 12px; | ||
font-weight: normal; | ||
|
||
color: #6f7378; | ||
|
||
margin-top: 10px; | ||
margin-left: 5px; | ||
} | ||
|
||
ion-datetime { | ||
width: 350px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<ion-app> | ||
<ion-header translucent="true"> | ||
<ion-toolbar> | ||
<ion-title>Datetime - Set Value</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding"> | ||
<ion-datetime value="2021-11-22T14:23:00.000Z" locale="en-US"></ion-datetime> | ||
</ion-content> | ||
</ion-app> | ||
</body> | ||
|
||
</html> |
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
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.