fix(select): inherit white-space in select-text to allow text wrapping (#26973)
fixes #19949 Co-authored-by: Shreyas <telishreyas10@gmail.com>
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
font-family: $font-family-base;
|
font-family: $font-family-base;
|
||||||
|
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
z-index: $z-index-item-input;
|
z-index: $z-index-item-input;
|
||||||
}
|
}
|
||||||
@ -77,7 +79,7 @@ button {
|
|||||||
|
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
white-space: nowrap;
|
white-space: inherit;
|
||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
48
core/src/components/select/test/wrapping/select.e2e.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
test.describe('select: wrapping', () => {
|
||||||
|
test('should not wrap text by default', async ({ page, skip }) => {
|
||||||
|
skip.rtl();
|
||||||
|
|
||||||
|
await page.setContent(`
|
||||||
|
<ion-select value="nowrap" aria-label="Should Not Wrap">
|
||||||
|
<ion-select-option value="nowrap">Should not wrap when no label exists and no class is added to make the text wrap</ion-select-option>
|
||||||
|
</ion-select>
|
||||||
|
`);
|
||||||
|
|
||||||
|
const select = page.locator('ion-select');
|
||||||
|
await expect(select).toHaveScreenshot(`select-nowrap-${page.getSnapshotSettings()}.png`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should wrap text with class', async ({ page, skip }) => {
|
||||||
|
skip.rtl();
|
||||||
|
|
||||||
|
await page.setContent(`
|
||||||
|
<ion-select value="wrap" aria-label="Should Wrap" class="ion-text-wrap">
|
||||||
|
<ion-select-option value="wrap">Should wrap when no label exists and really long text exists to make it wrap the text</ion-select-option>
|
||||||
|
</ion-select>
|
||||||
|
`);
|
||||||
|
|
||||||
|
const select = page.locator('ion-select');
|
||||||
|
await expect(select).toHaveScreenshot(`select-wrap-${page.getSnapshotSettings()}.png`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should not wrap label while wrapping text with class', async ({ page, skip }) => {
|
||||||
|
skip.rtl();
|
||||||
|
|
||||||
|
// TODO(FW-3787) Make label a property of select
|
||||||
|
await page.setContent(`
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>Really long label should not wrap</ion-label>
|
||||||
|
<ion-select value="wrap" aria-label="Should Wrap" class="ion-text-wrap">
|
||||||
|
<ion-select-option value="wrap">Should wrap value only when label exists and really long text exists to make it wrap the text</ion-select-option>
|
||||||
|
</ion-select>
|
||||||
|
</ion-label>
|
||||||
|
</ion-item>
|
||||||
|
`);
|
||||||
|
|
||||||
|
const select = page.locator('ion-item');
|
||||||
|
await expect(select).toHaveScreenshot(`select-wrap-with-label-${page.getSnapshotSettings()}.png`);
|
||||||
|
});
|
||||||
|
});
|
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 8.5 KiB |