feat(datetime): add datetime styles for ionic theme (#29807)
Adds the styles for Datetime in the `ionic` theme for the following (days, months, arrows, weeks): - Typography - Colors - Spacing - Sizing - States (selected, pressed, focus, hover)
@ -691,19 +691,16 @@ ion-datetime,event,ionFocus,void,true
|
||||
ion-datetime,css-prop,--background,ionic
|
||||
ion-datetime,css-prop,--background,ios
|
||||
ion-datetime,css-prop,--background,md
|
||||
ion-datetime,css-prop,--background-rgb,ionic
|
||||
ion-datetime,css-prop,--background-rgb,ios
|
||||
ion-datetime,css-prop,--background-rgb,md
|
||||
ion-datetime,css-prop,--title-color,ionic
|
||||
ion-datetime,css-prop,--focus-ring-color,ionic
|
||||
ion-datetime,css-prop,--focus-ring-width,ionic
|
||||
ion-datetime,css-prop,--title-color,ios
|
||||
ion-datetime,css-prop,--title-color,md
|
||||
ion-datetime,css-prop,--wheel-fade-background-rgb,ionic
|
||||
ion-datetime,css-prop,--wheel-fade-background-rgb,ios
|
||||
ion-datetime,css-prop,--wheel-fade-background-rgb,md
|
||||
ion-datetime,css-prop,--wheel-highlight-background,ionic
|
||||
ion-datetime,css-prop,--wheel-highlight-background,ios
|
||||
ion-datetime,css-prop,--wheel-highlight-background,md
|
||||
ion-datetime,css-prop,--wheel-highlight-border-radius,ionic
|
||||
ion-datetime,css-prop,--wheel-highlight-border-radius,ios
|
||||
ion-datetime,css-prop,--wheel-highlight-border-radius,md
|
||||
ion-datetime,part,calendar-day
|
||||
|
@ -1,23 +1,12 @@
|
||||
@import "../../themes/native/native.globals";
|
||||
|
||||
// Datetime
|
||||
// Datetime: Common Styles
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
/**
|
||||
* @prop --background: The primary background of the datetime component.
|
||||
* @prop --background-rgb: The primary background of the datetime component in RGB format.
|
||||
* @prop --title-color: The text color of the title.
|
||||
*
|
||||
* @prop --wheel-highlight-background: The background of the highlight under the selected
|
||||
* item when using a wheel style layout, or in the month/year picker for grid style layouts.
|
||||
* @prop --wheel-highlight-border-radius: The border radius of the highlight under the selected
|
||||
* item when using a wheel style layout, or in the month/year picker for grid style layouts.
|
||||
* @prop --wheel-fade-background-rgb: The color of the gradient covering non-selected items
|
||||
* when using a wheel style layout, or in the month/year picker for grid style layouts. Must
|
||||
* be in RGB format, e.g. `255, 255, 255`.
|
||||
*/
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-flow: column;
|
||||
@ -32,19 +21,6 @@
|
||||
height: auto;
|
||||
}
|
||||
|
||||
:host(.datetime-size-fixed:not(.datetime-prefer-wheel)) {
|
||||
max-width: 350px;
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures that the picker is appropriately
|
||||
* sized and never truncates the text.
|
||||
*/
|
||||
:host(.datetime-size-fixed.datetime-prefer-wheel) {
|
||||
min-width: 350px;
|
||||
max-width: max-content;
|
||||
}
|
||||
|
||||
:host(.datetime-size-cover) {
|
||||
width: 100%;
|
||||
}
|
||||
@ -68,6 +44,7 @@
|
||||
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changing the physical order of the
|
||||
* picker columns in the DOM is added
|
||||
@ -157,7 +134,6 @@
|
||||
* Disabled buttons should have full opacity
|
||||
* in readonly mode
|
||||
*/
|
||||
|
||||
.calendar-day[disabled]:not(.calendar-day-constrained),
|
||||
.datetime-action-buttons ion-button[disabled] {
|
||||
opacity: 1;
|
||||
@ -213,12 +189,9 @@
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:host .calendar-action-buttons ion-button {
|
||||
--background: transparent;
|
||||
}
|
||||
|
||||
// Calendar / Header / Days of Week
|
||||
// -----------------------------------
|
||||
|
||||
:host .calendar-days-of-week {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
@ -237,6 +210,7 @@
|
||||
|
||||
// Calendar / Body
|
||||
// -----------------------------------
|
||||
|
||||
:host .calendar-body {
|
||||
/**
|
||||
* Show all calendar months inline
|
||||
@ -330,7 +304,6 @@
|
||||
* and horizontally within its grid cell.
|
||||
*/
|
||||
.calendar-day {
|
||||
@include border-radius(50%);
|
||||
@include padding(0px);
|
||||
@include margin(0px);
|
||||
|
||||
@ -348,8 +321,6 @@
|
||||
background: none;
|
||||
color: currentColor;
|
||||
|
||||
font-family: $font-family-base;
|
||||
|
||||
cursor: pointer;
|
||||
|
||||
appearance: none;
|
||||
@ -357,16 +328,8 @@
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
:host .calendar-day[disabled] {
|
||||
.calendar-day[disabled] {
|
||||
pointer-events: none;
|
||||
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.calendar-day:focus {
|
||||
background: current-color(base, 0.2);
|
||||
|
||||
box-shadow: 0px 0px 0px 4px current-color(base, 0.2);
|
||||
}
|
||||
|
||||
// Time / Header
|
||||
@ -378,14 +341,6 @@
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:host(.datetime-presentation-time) .datetime-time {
|
||||
@include padding(0);
|
||||
}
|
||||
|
||||
:host ion-popover {
|
||||
--height: 200px;
|
||||
}
|
||||
|
||||
:host .time-header {
|
||||
display: flex;
|
||||
|
||||
@ -393,17 +348,10 @@
|
||||
}
|
||||
|
||||
:host .time-body {
|
||||
@include border-radius(8px);
|
||||
@include padding(6px, 12px, 6px, 12px);
|
||||
|
||||
display: flex;
|
||||
|
||||
border: none;
|
||||
|
||||
background: var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));
|
||||
|
||||
color: $text-color;
|
||||
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
|
||||
@ -412,19 +360,12 @@
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
:host .time-body-active {
|
||||
color: current-color(base);
|
||||
}
|
||||
|
||||
:host(.in-item) {
|
||||
position: static;
|
||||
}
|
||||
|
||||
// Year Picker
|
||||
// -----------------------------------
|
||||
:host(.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle {
|
||||
color: #{current-color(base)};
|
||||
}
|
||||
|
||||
.calendar-month-year {
|
||||
min-width: 0;
|
||||
@ -444,28 +385,9 @@
|
||||
cursor: pointer;
|
||||
|
||||
z-index: 1;
|
||||
|
||||
&::after {
|
||||
@include button-state();
|
||||
|
||||
transition: opacity 15ms linear, background-color 15ms linear;
|
||||
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
&.ion-focused::after {
|
||||
background: currentColor;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.3;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.calendar-month-year-toggle ion-icon {
|
||||
@include padding(0, 0, 0, 4px);
|
||||
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@ -474,12 +396,3 @@
|
||||
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
// Picker Custom Variables
|
||||
// -----------------------------------
|
||||
|
||||
ion-picker {
|
||||
--highlight-background: var(--wheel-highlight-background);
|
||||
--highlight-border-radius: var(--wheel-highlight-border-radius);
|
||||
--fade-background-rgb: var(--wheel-fade-background-rgb);
|
||||
}
|
140
core/src/components/datetime/datetime.ionic.scss
Normal file
@ -0,0 +1,140 @@
|
||||
@use "../../themes/ionic/ionic.globals.scss" as globals;
|
||||
@use "./datetime.common";
|
||||
|
||||
// Ionic Datetime
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
/**
|
||||
* @prop --focus-ring-color: The color of the ring around the focused element.
|
||||
* @prop --focus-ring-width: The width of the ring around the focused element.
|
||||
*/
|
||||
--background: #{globals.$ionic-color-base-white};
|
||||
--focus-ring-color: #{globals.$ionic-state-focus-1};
|
||||
--focus-ring-width: #{globals.$ionic-border-radius-050};
|
||||
}
|
||||
|
||||
// Calendar Header
|
||||
// -----------------------------------
|
||||
|
||||
.calendar-action-buttons {
|
||||
@include globals.padding(globals.$ionic-space-200, null);
|
||||
|
||||
align-items: center;
|
||||
|
||||
height: globals.$ionic-scale-1400;
|
||||
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.calendar-month-year {
|
||||
flex: 1 0 0;
|
||||
}
|
||||
|
||||
// Month year toggle should match the
|
||||
// default round clear button style
|
||||
.calendar-month-year-toggle {
|
||||
@include globals.border-radius(globals.$ionic-border-radius-full);
|
||||
@include globals.typography(globals.$ionic-action-lg);
|
||||
@include globals.padding(globals.$ionic-space-200, globals.$ionic-space-400);
|
||||
|
||||
min-width: globals.$ionic-scale-1600;
|
||||
min-height: globals.$ionic-scale-1000;
|
||||
|
||||
border: var(--focus-ring-width) globals.$ionic-border-style-solid transparent;
|
||||
|
||||
color: globals.$ionic-color-primary-base;
|
||||
}
|
||||
|
||||
// Hovered Month Year Toggle
|
||||
@media (any-hover: hover) {
|
||||
.calendar-month-year-toggle:hover {
|
||||
background: globals.$ionic-color-neutral-200;
|
||||
}
|
||||
}
|
||||
|
||||
// Focused Month Year Toggle
|
||||
.calendar-month-year-toggle.ion-focused {
|
||||
border-color: var(--focus-ring-color);
|
||||
}
|
||||
|
||||
// Activated Month Year Toggle
|
||||
.calendar-month-year-toggle.ion-activated {
|
||||
background: globals.$ionic-color-neutral-200;
|
||||
}
|
||||
|
||||
// TODO(ROU-11119): Rewrite this when we replace the ion-button with a native button
|
||||
.calendar-next-prev ion-button.button-has-icon-only {
|
||||
--color: #{globals.$ionic-color-neutral-1000};
|
||||
--background-activated: #{globals.$ionic-color-neutral-200};
|
||||
--background-hover: #{globals.$ionic-color-neutral-200};
|
||||
--background-hover-opacity: 1;
|
||||
}
|
||||
|
||||
// TODO(ROU-11119): Rewrite this when we replace the ion-button with a native button
|
||||
.calendar-next-prev ion-button.button-has-icon-only.ion-focused::part(native) {
|
||||
border: globals.$ionic-border-size-050 globals.$ionic-border-style-solid globals.$ionic-state-focus-1;
|
||||
|
||||
outline: none;
|
||||
}
|
||||
|
||||
// Calendar Days of Week
|
||||
// -----------------------------------
|
||||
|
||||
.calendar-days-of-week {
|
||||
@include globals.typography(globals.$ionic-overline-medium);
|
||||
|
||||
align-content: center;
|
||||
|
||||
height: globals.$ionic-scale-1200;
|
||||
|
||||
color: globals.$ionic-color-neutral-800;
|
||||
}
|
||||
|
||||
// Calendar Day
|
||||
// -----------------------------------
|
||||
|
||||
.calendar-day {
|
||||
@include globals.border-radius(globals.$ionic-border-radius-full);
|
||||
@include globals.padding(globals.$ionic-space-100);
|
||||
@include globals.typography(globals.$ionic-action-md);
|
||||
|
||||
width: globals.$ionic-scale-1200;
|
||||
min-width: globals.$ionic-scale-1200;
|
||||
|
||||
height: globals.$ionic-scale-1200;
|
||||
|
||||
color: globals.$ionic-color-neutral-1200;
|
||||
}
|
||||
|
||||
// Disabled Day
|
||||
.calendar-day[disabled]:not(.calendar-day-constrained) {
|
||||
color: globals.$ionic-color-neutral-500;
|
||||
}
|
||||
|
||||
// Current Day
|
||||
.calendar-day.calendar-day-today {
|
||||
color: globals.$ionic-color-primary-base;
|
||||
}
|
||||
|
||||
// Selected Day
|
||||
.calendar-day.calendar-day-active {
|
||||
background: globals.$ionic-color-primary-100;
|
||||
}
|
||||
|
||||
// Focused Day
|
||||
.calendar-day:focus-visible {
|
||||
border: var(--focus-ring-width) globals.$ionic-border-style-solid var(--focus-ring-color);
|
||||
}
|
||||
|
||||
// Hovered Day
|
||||
@media (any-hover: hover) {
|
||||
.calendar-day:not([disabled]):not(:active):hover {
|
||||
background: globals.$ionic-color-primary-200;
|
||||
}
|
||||
}
|
||||
|
||||
// Pressed Day
|
||||
.calendar-day:active {
|
||||
background: globals.$ionic-color-primary-300;
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
@import "./datetime.scss";
|
||||
@import "./datetime.native.scss";
|
||||
@import "./datetime.ios.vars.scss";
|
||||
@import "../../themes/native/native.globals.ios";
|
||||
|
||||
// iOS Datetime
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
--background: #{ion-color(light, base)};
|
||||
--background-rgb: #{ion-color(light, base, null, true)};
|
||||
|
@ -1,8 +1,10 @@
|
||||
@use "../../themes/native/native.globals" as globals;
|
||||
|
||||
// iOS Datetime
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Border color for dividers between header and footer
|
||||
$datetime-ios-border-color: 0.55px solid $background-color-step-200;
|
||||
$datetime-ios-border-color: 0.55px solid globals.$background-color-step-200;
|
||||
|
||||
/// @prop - Padding for content
|
||||
$datetime-ios-padding: 16px;
|
||||
|
@ -1,7 +1,10 @@
|
||||
@import "./datetime.scss";
|
||||
@import "./datetime.native.scss";
|
||||
@import "./datetime.md.vars.scss";
|
||||
@import "../../themes/native/native.globals.md";
|
||||
|
||||
// Material Design Datetime
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
--background: var(--ion-color-step-100, var(--ion-background-color-step-100, #ffffff));
|
||||
--title-color: #{current-color(contrast)};
|
||||
|
@ -1,14 +1,16 @@
|
||||
@use "../../themes/native/native.globals" as globals;
|
||||
|
||||
// MD Datetime
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Font size for title in header
|
||||
$datetime-md-title-font-size: dynamic-font(12px);
|
||||
$datetime-md-title-font-size: globals.dynamic-font(12px);
|
||||
|
||||
/// @prop - Font size for selected date in header
|
||||
$datetime-md-selected-date-font-size: dynamic-font(34px);
|
||||
$datetime-md-selected-date-font-size: globals.dynamic-font(34px);
|
||||
|
||||
/// @prop - Font size for calendar day button
|
||||
$datetime-md-calendar-item-font-size: dynamic-font(14px);
|
||||
$datetime-md-calendar-item-font-size: globals.dynamic-font(14px);
|
||||
|
||||
/// @prop - Padding for content in header
|
||||
$datetime-md-header-padding: 20px;
|
||||
|
120
core/src/components/datetime/datetime.native.scss
Normal file
@ -0,0 +1,120 @@
|
||||
@use "../../themes/native/native.globals" as globals;
|
||||
@use "./datetime.common";
|
||||
|
||||
// Datetime: Native Styles
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
/**
|
||||
* @prop --background-rgb: The primary background of the datetime component in RGB format.
|
||||
* @prop --title-color: The text color of the title.
|
||||
*
|
||||
* @prop --wheel-highlight-background: The background of the highlight under the selected
|
||||
* item when using a wheel style layout, or in the month/year picker for grid style layouts.
|
||||
* @prop --wheel-highlight-border-radius: The border radius of the highlight under the selected
|
||||
* item when using a wheel style layout, or in the month/year picker for grid style layouts.
|
||||
* @prop --wheel-fade-background-rgb: The color of the gradient covering non-selected items
|
||||
* when using a wheel style layout, or in the month/year picker for grid style layouts. Must
|
||||
* be in RGB format, e.g. `255, 255, 255`.
|
||||
*/
|
||||
}
|
||||
|
||||
:host(.datetime-size-fixed:not(.datetime-prefer-wheel)) {
|
||||
max-width: 350px;
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures that the picker is appropriately
|
||||
* sized and never truncates the text.
|
||||
*/
|
||||
:host(.datetime-size-fixed.datetime-prefer-wheel) {
|
||||
min-width: 350px;
|
||||
max-width: max-content;
|
||||
}
|
||||
|
||||
:host .calendar-action-buttons ion-button {
|
||||
--background: transparent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Center the day text vertically
|
||||
* and horizontally within its grid cell.
|
||||
*/
|
||||
.calendar-day {
|
||||
@include globals.border-radius(50%);
|
||||
|
||||
font-family: globals.$font-family-base;
|
||||
}
|
||||
|
||||
:host .calendar-day[disabled] {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.calendar-day:focus {
|
||||
background: globals.current-color(base, 0.2);
|
||||
|
||||
box-shadow: 0px 0px 0px 4px globals.current-color(base, 0.2);
|
||||
}
|
||||
|
||||
// Time / Header
|
||||
// -----------------------------------
|
||||
|
||||
:host(.datetime-presentation-time) .datetime-time {
|
||||
@include globals.padding(0);
|
||||
}
|
||||
|
||||
:host ion-popover {
|
||||
--height: 200px;
|
||||
}
|
||||
|
||||
:host .time-body {
|
||||
@include globals.border-radius(8px);
|
||||
@include globals.padding(6px, 12px, 6px, 12px);
|
||||
|
||||
background: var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));
|
||||
|
||||
color: globals.$text-color;
|
||||
}
|
||||
|
||||
:host .time-body-active {
|
||||
color: globals.current-color(base);
|
||||
}
|
||||
|
||||
// Year Picker
|
||||
// -----------------------------------
|
||||
|
||||
:host(.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle {
|
||||
color: globals.current-color(base);
|
||||
}
|
||||
|
||||
.calendar-month-year-toggle {
|
||||
&::after {
|
||||
@include globals.button-state();
|
||||
|
||||
transition: opacity 15ms linear, background-color 15ms linear;
|
||||
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
&.ion-focused::after {
|
||||
background: currentColor;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.3;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.calendar-month-year-toggle ion-icon {
|
||||
@include globals.padding(0, 0, 0, 4px);
|
||||
}
|
||||
|
||||
// Picker Custom Variables
|
||||
// -----------------------------------
|
||||
|
||||
ion-picker {
|
||||
--highlight-background: var(--wheel-highlight-background);
|
||||
--highlight-border-radius: var(--wheel-highlight-border-radius);
|
||||
--fade-background-rgb: var(--wheel-fade-background-rgb);
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
import caretDownRegular from '@phosphor-icons/core/assets/regular/caret-down.svg';
|
||||
import caretLeftRegular from '@phosphor-icons/core/assets/regular/caret-left.svg';
|
||||
import caretRightRegular from '@phosphor-icons/core/assets/regular/caret-right.svg';
|
||||
import caretUpRegular from '@phosphor-icons/core/assets/regular/caret-up.svg';
|
||||
import type { ComponentInterface, EventEmitter } from '@stencil/core';
|
||||
import { Component, Element, Event, Host, Method, Prop, State, Watch, h, writeTask } from '@stencil/core';
|
||||
import { startFocusVisible } from '@utils/focus-visible';
|
||||
@ -106,7 +104,7 @@ import { checkForPresentationFormatMismatch, warnIfTimeZoneProvided } from './ut
|
||||
styleUrls: {
|
||||
ios: 'datetime.ios.scss',
|
||||
md: 'datetime.md.scss',
|
||||
ionic: 'datetime.md.scss',
|
||||
ionic: 'datetime.ionic.scss',
|
||||
},
|
||||
shadow: true,
|
||||
})
|
||||
@ -2145,12 +2143,14 @@ export class Datetime implements ComponentInterface {
|
||||
>
|
||||
<span id="toggle-wrapper">
|
||||
{getMonthAndYear(this.locale, this.workingParts)}
|
||||
{theme !== 'ionic' && (
|
||||
<ion-icon
|
||||
aria-hidden="true"
|
||||
icon={this.showMonthAndYear ? datetimeExpandedIcon : datetimeCollapsedIcon}
|
||||
lazy={false}
|
||||
flipRtl={true}
|
||||
></ion-icon>
|
||||
)}
|
||||
</span>
|
||||
{theme === 'md' && <ion-ripple-effect></ion-ripple-effect>}
|
||||
</button>
|
||||
@ -2643,12 +2643,13 @@ export class Datetime implements ComponentInterface {
|
||||
* Otherwise, use the icon set in the config.
|
||||
* If no icon is set in the config, use the default icon.
|
||||
*/
|
||||
get datetimeCollapsedIcon(): string {
|
||||
get datetimeCollapsedIcon(): string | undefined {
|
||||
// Determine the theme and map to default icons
|
||||
const theme = getIonTheme(this);
|
||||
|
||||
const defaultIcons = {
|
||||
ios: chevronForward,
|
||||
ionic: caretDownRegular,
|
||||
ionic: undefined,
|
||||
md: caretDownSharp,
|
||||
};
|
||||
|
||||
@ -2664,12 +2665,13 @@ export class Datetime implements ComponentInterface {
|
||||
* Otherwise, use the icon set in the config.
|
||||
* If no icon is set in the config, use the default icon.
|
||||
*/
|
||||
get datetimeExpandedIcon(): string {
|
||||
get datetimeExpandedIcon(): string | undefined {
|
||||
// Determine the theme and map to default icons
|
||||
const theme = getIonTheme(this);
|
||||
|
||||
const defaultIcons = {
|
||||
ios: chevronDown,
|
||||
ionic: caretUpRegular,
|
||||
ionic: undefined,
|
||||
md: caretUpSharp,
|
||||
};
|
||||
|
||||
|
@ -2,9 +2,38 @@ import { expect } from '@playwright/test';
|
||||
import type { E2EPage } from '@utils/test/playwright';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ modes: ['ios', 'md', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('datetime: basic'), () => {
|
||||
test('should render inline datetime', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<script>
|
||||
const mockToday = '2024-07-16T12:00';
|
||||
Date = class extends Date {
|
||||
constructor(...args) {
|
||||
if (args.length === 0) {
|
||||
super(mockToday)
|
||||
} else {
|
||||
super(...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<ion-datetime value="2024-07-18T12:00"></ion-datetime>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const datetime = page.locator('ion-datetime');
|
||||
|
||||
await expect(datetime).toHaveScreenshot(screenshot(`datetime-basic`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* This behavior does not differ across
|
||||
* modes/directions.
|
||||
* This behavior does not differ across modes/directions.
|
||||
*/
|
||||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('datetime: closing time popover'), () => {
|
||||
@ -41,8 +70,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
||||
});
|
||||
|
||||
/**
|
||||
* This behavior does not differ across
|
||||
* modes/directions.
|
||||
* This behavior does not differ across modes/directions.
|
||||
*/
|
||||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('datetime: selecting a day'), () => {
|
||||
@ -125,8 +153,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
||||
});
|
||||
|
||||
/**
|
||||
* This behavior does not differ across
|
||||
* modes/directions.
|
||||
* This behavior does not differ across modes/directions.
|
||||
*/
|
||||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('datetime: confirm date'), () => {
|
||||
@ -242,8 +269,7 @@ configs().forEach(({ title, screenshot, config }) => {
|
||||
});
|
||||
|
||||
/**
|
||||
* This behavior does not differ across
|
||||
* modes/directions.
|
||||
* This behavior does not differ across modes/directions.
|
||||
*/
|
||||
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('datetime: swiping'), () => {
|
||||
@ -318,8 +344,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
});
|
||||
|
||||
/**
|
||||
* This behavior does not differ across
|
||||
* modes/directions.
|
||||
* This behavior does not differ across modes/directions.
|
||||
*/
|
||||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('datetime: visibility'), () => {
|
||||
@ -363,10 +388,8 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
||||
});
|
||||
|
||||
/**
|
||||
* We are setting RTL on the component
|
||||
* instead, so we don't need to test
|
||||
* both directions. Also, this behavior
|
||||
* does not vary across modes.
|
||||
* We are setting RTL on the component instead, so we don't need to test
|
||||
* both directions. Also, this behavior does not vary across modes.
|
||||
*/
|
||||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('datetime: RTL set on component'), () => {
|
||||
@ -386,8 +409,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
||||
});
|
||||
|
||||
/**
|
||||
* This behavior does not differ across
|
||||
* modes/directions.
|
||||
* This behavior does not differ across modes/directions.
|
||||
*/
|
||||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('datetime: clear button'), () => {
|
||||
@ -420,8 +442,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
||||
});
|
||||
|
||||
/**
|
||||
* This behavior does not differ across
|
||||
* modes/directions.
|
||||
* This behavior does not differ across modes/directions.
|
||||
*/
|
||||
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('datetime: ionChange'), () => {
|
||||
@ -535,8 +556,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
|
||||
});
|
||||
|
||||
/**
|
||||
* This behavior does not differ across
|
||||
* directions.
|
||||
* This behavior does not differ across directions.
|
||||
*/
|
||||
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('datetime: focus'), () => {
|
||||
@ -588,8 +608,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
});
|
||||
|
||||
/**
|
||||
* This behavior does not differ across
|
||||
* directions.
|
||||
* This behavior does not differ across directions.
|
||||
*/
|
||||
configs({ directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('datetime: formatOptions'), () => {
|
||||
@ -622,8 +641,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
});
|
||||
|
||||
/**
|
||||
* This behavior does not differ across
|
||||
* modes/directions.
|
||||
* This behavior does not differ across modes/directions.
|
||||
*/
|
||||
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
||||
test.describe(title('datetime: formatOptions misconfiguration errors'), () => {
|
||||
|
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 15 KiB |