-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(datetime): timepicker popover will position relative to click target
Resolves #24531, #24415, #24585 Co-authored-by: mixalbl4 <[email protected]>
- Loading branch information
1 parent
43c5977
commit 82a7212
Showing
8 changed files
with
105 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,27 @@ | ||
import { newE2EPage } from '@stencil/core/testing'; | ||
|
||
describe('datetime: position', () => { | ||
|
||
it('should position the time picker relative to the click target', async () => { | ||
const page = await newE2EPage({ | ||
url: '/src/components/datetime/test/position?ionic:_testing=true' | ||
}); | ||
const screenshotCompares = []; | ||
|
||
const openDateTimeBtn = await page.find('ion-button'); | ||
await openDateTimeBtn.click(); | ||
|
||
screenshotCompares.push(await page.compareScreenshot()); | ||
|
||
const timepickerBtn = await page.find('ion-datetime >>> .time-body'); | ||
await timepickerBtn.click(); | ||
|
||
screenshotCompares.push(await page.compareScreenshot()); | ||
|
||
for (const screenshotCompare of screenshotCompares) { | ||
expect(screenshotCompare).toMatchScreenshot(); | ||
} | ||
|
||
}); | ||
|
||
}); |
This file contains 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,51 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" dir="ltr"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Datetime - Position</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> | ||
</head> | ||
|
||
<body> | ||
<ion-app> | ||
<ion-header translucent="true"> | ||
<ion-toolbar> | ||
<ion-title>Datetime - Position</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding"> | ||
|
||
<ion-button onclick="presentPopover(defaultPopover, event)">Present Popover</ion-button> | ||
<ion-popover class="datetime-popover" id="default-popover"> | ||
<ion-datetime></ion-datetime> | ||
</ion-popover> | ||
|
||
</ion-content> | ||
|
||
<script> | ||
const defaultPopover = document.querySelector('ion-popover#default-popover'); | ||
const presentPopover = (popover, ev) => { | ||
popover.event = ev; | ||
popover.showBackdrop = false; | ||
popover.isOpen = true; | ||
|
||
const dismiss = () => { | ||
popover.isOpen = false; | ||
popover.event = undefined; | ||
|
||
popover.removeEventListener('didDismiss', dismiss); | ||
} | ||
|
||
popover.addEventListener('didDismiss', dismiss); | ||
} | ||
</script> | ||
|
||
</ion-app> | ||
</body> | ||
|
||
</html> |
This file contains 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 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 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