Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions core/src/components/datetime/datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1091,16 +1091,17 @@ export class Datetime implements ComponentInterface {

connectedCallback() {
this.clearFocusVisible = startFocusVisible(this.el).destroy;
this.loadTimeout = setTimeout(() => {
this.ensureReadyIfVisible();
}, 100);
}

disconnectedCallback() {
if (this.clearFocusVisible) {
this.clearFocusVisible();
this.clearFocusVisible = undefined;
}
if (this.loadTimeout) {
clearTimeout(this.loadTimeout);
}
this.loadTimeoutCleanup();
}

/**
Expand Down Expand Up @@ -1151,6 +1152,13 @@ export class Datetime implements ComponentInterface {
});
};

private loadTimeoutCleanup = () => {
if (this.loadTimeout) {
clearTimeout(this.loadTimeout);
this.loadTimeout = undefined;
}
};

componentDidLoad() {
const { el, intersectionTrackerRef } = this;

Expand Down Expand Up @@ -1198,7 +1206,10 @@ export class Datetime implements ComponentInterface {
* we still initialize listeners and mark the component as ready.
*
* We schedule this after everything has had a chance to run.
*
* We also clean up the load timeout to ensure that we don't have multiple timeouts running.
*/
this.loadTimeoutCleanup();
this.loadTimeout = setTimeout(() => {
this.ensureReadyIfVisible();
}, 100);
Expand Down
37 changes: 37 additions & 0 deletions core/src/components/datetime/test/basic/datetime.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,43 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
/**
* This behavior does not differ across modes/directions.
*/

configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
test.describe(title('datetime: month picker selection'), () => {
test('datetime: month picker selection', async ({ page }) => {
await page.setContent(
`
<ion-datetime value="2022-05-03"></ion-datetime>
`,
config
);

await page.locator('.datetime-ready').waitFor();

const nextMonthButton = page.locator('ion-datetime .calendar-next-prev ion-button').nth(1);
const monthYearButton = page.locator('ion-datetime .calendar-month-year');

await expect(monthYearButton).toHaveText(/May 2022/);

await nextMonthButton.click();
await expect(monthYearButton).toHaveText(/June 2022/);

await nextMonthButton.click();
await expect(monthYearButton).toHaveText(/July 2022/);

await monthYearButton.click();
await page.waitForChanges();

const selectedMonthOptions = page.locator('.month-column ion-picker-column-option.option-active');
await expect(selectedMonthOptions).toHaveCount(1);
});
});
});

/**
* This behavior does not differ across
* modes/directions.
*/
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
test.describe(title('datetime: visibility'), () => {
// TODO FW-6015 re-enable on webkit when bug is fixed
Expand Down
6 changes: 2 additions & 4 deletions core/src/components/picker-column/picker-column.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ComponentInterface, EventEmitter } from '@stencil/core';
import { Component, Element, Event, Host, Method, Prop, State, Watch, h } from '@stencil/core';
import { doc } from '@utils/browser';
import { getElementRoot, raf } from '@utils/helpers';
import { raf } from '@utils/helpers';
import { hapticSelectionChanged, hapticSelectionEnd, hapticSelectionStart } from '@utils/native/haptic';
import { isPlatform } from '@utils/platform';
import { createColorClasses } from '@utils/theme';
Expand Down Expand Up @@ -123,9 +123,7 @@ export class PickerColumn implements ComponentInterface {
* Because this initial call to scrollActiveItemIntoView has to fire before
* the scroll listener is set up, we need to manage the active class manually.
*/
const oldActive = getElementRoot(el).querySelector<HTMLIonPickerColumnOptionElement>(
`.${PICKER_ITEM_ACTIVE_CLASS}`
);
const oldActive = el.querySelector<HTMLIonPickerColumnOptionElement>(`.${PICKER_ITEM_ACTIVE_CLASS}`);
if (oldActive) {
this.setPickerItemActiveState(oldActive, false);
}
Expand Down
22 changes: 22 additions & 0 deletions core/src/components/tab-button/test/states/tab-button.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,25 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, c
});
});
});

configs({ palettes: ['dark'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('tab-button: states in dark palette'), () => {
test.describe('focus', () => {
test('should render correct focus state in dark palette', async ({ page }) => {
await page.setContent(
`
<ion-tab-bar style="width: 300px">
<ion-tab-button href="#" class="ion-focused">
<ion-label>Favorites</ion-label>
</ion-tab-button>
</ion-tab-bar>
`,
config
);

const tabBar = page.locator('ion-tab-bar');
await expect(tabBar).toHaveScreenshot(screenshot('tab-button-focus'));
});
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions core/src/css/palettes/dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ $colors: (
--ion-text-color-step-900: #1a1a1a;
--ion-text-color-step-950: #0d0d0d;
--ion-item-background: #000000;
--ion-tab-bar-background-focused: #252525;
--ion-card-background: #1c1c1d;
}

Expand Down Expand Up @@ -192,6 +193,7 @@ $colors: (
--ion-item-background: #1e1e1e;
--ion-toolbar-background: #1f1f1f;
--ion-tab-bar-background: #1f1f1f;
--ion-tab-bar-background-focused: #353535;
--ion-card-background: #1e1e1e;
}
}
2 changes: 2 additions & 0 deletions core/src/css/palettes/high-contrast-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ $lightest-text-color: $text-color;
--ion-text-color-rgb: #{color-to-rgb-list($text-color)};
--ion-item-background: #000000;
--ion-card-background: #1c1c1d;
--ion-tab-bar-background-focused: #252525;

/// Only the item borders should increase in contrast
/// Borders for elements like toolbars should remain the same
Expand Down Expand Up @@ -193,6 +194,7 @@ $lightest-text-color: $text-color;
--ion-item-background: #1e1e1e;
--ion-toolbar-background: #1f1f1f;
--ion-tab-bar-background: #1f1f1f;
--ion-tab-bar-background-focused: #353535;
--ion-card-background: #1e1e1e;

/// Only the item borders should increase in contrast
Expand Down
Loading