Skip to content

Commit 442e3e9

Browse files
fix(toast): keep icon on the same line as long message in stacked layout (#30923)
Issue number: resolves #30908 --------- ## What is the current behavior? Toast with an icon and long message using a stacked layout will wrap the message below the icon. ## What is the new behavior? - Apply `flex: 1` to `.toast-content` regardless of layout, which makes sure the content does not get wrapped under the icon - Adds an e2e test for a stacked toast with a long message to `toast/test/layout` ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information - Dev build: `8.7.18-dev.11768592717.14a59d2f` - Preview: [Layout](https://ionic-framework-git-fw-7035-ionic1.vercel.app/src/components/toast/test/layout/) --------- Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
1 parent 62d880d commit 442e3e9

15 files changed

+29
-2
lines changed

core/src/components/toast/test/layout/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
<ion-content class="ion-padding">
3030
<button id="baseline" onclick="openToast(baselineConfig)">Open Baseline Layout Toast</button>
3131
<button id="stacked" onclick="openToast(stackedConfig)">Open Stacked Layout Toast</button>
32+
<button id="stacked-long-message" onclick="openToast(stackedLongMessageConfig)">
33+
Open Stacked Layout Toast with Long Message
34+
</button>
3235
</ion-content>
3336

3437
<script>
@@ -52,6 +55,13 @@
5255
message: 'This is a stacked layout toast.',
5356
layout: 'stacked',
5457
};
58+
59+
const stackedLongMessageConfig = {
60+
...baselineConfig,
61+
message:
62+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum in elit varius, maximus sem in, bibendum justo.',
63+
layout: 'stacked',
64+
};
5565
</script>
5666
</ion-app>
5767
</body>

core/src/components/toast/test/layout/toast.e2e.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { configs, test } from '@utils/test/playwright';
33

44
configs().forEach(({ title, screenshot, config }) => {
55
test.describe(title('toast: stacked layout'), () => {
6-
test('should render stacked buttons', async ({ page }) => {
6+
test('should render stacked toast', async ({ page }) => {
77
await page.goto('/src/components/toast/test/layout', config);
88
const ionToastDidPresent = await page.spyOnEvent('ionToastDidPresent');
99

@@ -13,5 +13,21 @@ configs().forEach(({ title, screenshot, config }) => {
1313
const toastWrapper = page.locator('ion-toast .toast-wrapper');
1414
await expect(toastWrapper).toHaveScreenshot(screenshot(`toast-stacked`));
1515
});
16+
17+
test('should render stacked toast with long message', async ({ page }, testInfo) => {
18+
testInfo.annotations.push({
19+
type: 'issue',
20+
description: 'https://github.com/ionic-team/ionic-framework/issues/30908',
21+
});
22+
23+
await page.goto('/src/components/toast/test/layout', config);
24+
const ionToastDidPresent = await page.spyOnEvent('ionToastDidPresent');
25+
26+
await page.click('#stacked-long-message');
27+
await ionToastDidPresent.next();
28+
29+
const toastWrapper = page.locator('ion-toast .toast-wrapper');
30+
await expect(toastWrapper).toHaveScreenshot(screenshot(`toast-stacked-long-message`));
31+
});
1632
});
1733
});
10.7 KB
Loading
16.3 KB
Loading
17.1 KB
Loading
10.6 KB
Loading
16.2 KB
Loading
16.6 KB
Loading
10.6 KB
Loading
15.5 KB
Loading

0 commit comments

Comments
 (0)