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
12 changes: 9 additions & 3 deletions core/src/components/datetime-button/datetime-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
align-items: center;

justify-content: center;

min-width: 0;
}

:host button {
Expand All @@ -27,13 +29,17 @@
color: $text-color;

font-family: inherit;
font-size: inherit;
font-size: 1rem;

cursor: pointer;
text-overflow: ellipsis;

appearance: none;
white-space: nowrap;

cursor: pointer;

overflow: hidden;

appearance: none;
}

:host(.time-active) #time-button,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

/**
* The tested behavior does not vary across directions/modes
*/
configs({ directions: ['ltr'], modes: ['ios'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('datetime-button: font scaling'), () => {
test('should scale text on larger font sizes', async ({ page }) => {
await page.setContent(
`
<style>
html {
font-size: 28px;
}
</style>
<ion-datetime-button locale="en-US" datetime="datetime"></ion-datetime-button>
<ion-datetime id="datetime" value="2022-01-01T06:30:00" presentation="date-time"></ion-datetime>
`,
config
);

const datetimeButton = page.locator('ion-datetime-button');

await expect(datetimeButton).toHaveScreenshot(screenshot(`datetime-button-scale`));
});

test('should truncate text on larger font sizes', async ({ page }) => {
await page.setContent(
`
<style>
html {
font-size: 48px;
}
</style>
<ion-datetime-button locale="en-US" datetime="datetime"></ion-datetime-button>
<ion-datetime id="datetime" value="2022-01-01T06:30:00" presentation="date-time"></ion-datetime>
`,
config
);

const datetimeButton = page.locator('ion-datetime-button');

await expect(datetimeButton).toHaveScreenshot(screenshot(`datetime-button-scale-truncate`));
});

test('should truncate text on larger font sizes inside of an item', async ({ page }) => {
await page.setContent(
`
<style>
html {
font-size: 48px;
}
</style>
<ion-item>
<ion-label>Start Date</ion-label>
<ion-datetime-button locale="en-US" datetime="datetime"></ion-datetime-button>
</ion-item>
<ion-datetime id="datetime" value="2022-01-01T06:30:00" presentation="date-time"></ion-datetime>
`,
config
);

const datetimeButton = page.locator('ion-datetime-button');

await expect(datetimeButton).toHaveScreenshot(screenshot(`datetime-button-scale-truncate-item`));
});
});
});
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.
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.