test(text): migrate to generators (#27379)
Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Text tests are using legacy syntax ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Text tests are using modern syntax ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
@ -1,29 +0,0 @@
|
|||||||
import { expect } from '@playwright/test';
|
|
||||||
import { test } from '@utils/test/playwright';
|
|
||||||
|
|
||||||
test.describe('text: basic', () => {
|
|
||||||
test.beforeEach(({ skip }) => {
|
|
||||||
skip.rtl();
|
|
||||||
skip.mode('ios', 'Text does not have per-mode styles');
|
|
||||||
});
|
|
||||||
test('should render default text', async ({ page }) => {
|
|
||||||
await page.setContent(`
|
|
||||||
<ion-text>
|
|
||||||
<strong>The quick brown fox <ion-text><sup>jumps</sup></ion-text> over the <ion-text><sub>lazy dog</sub></ion-text></strong>
|
|
||||||
</ion-text>
|
|
||||||
`);
|
|
||||||
|
|
||||||
const text = page.locator('ion-text');
|
|
||||||
await expect(text.nth(0)).toHaveScreenshot(`text-${page.getSnapshotSettings()}.png`);
|
|
||||||
});
|
|
||||||
test('should render text with color prop', async ({ page }) => {
|
|
||||||
await page.setContent(`
|
|
||||||
<ion-text color="primary">
|
|
||||||
<strong>The quick brown fox <ion-text color="success"><sup>jumps</sup></ion-text> over the <ion-text color="danger"><sub>lazy dog</sub></ion-text></strong>
|
|
||||||
</ion-text>
|
|
||||||
`);
|
|
||||||
|
|
||||||
const text = page.locator('ion-text');
|
|
||||||
await expect(text.nth(0)).toHaveScreenshot(`text-color-${page.getSnapshotSettings()}.png`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
36
core/src/components/text/test/basic/text.e2e.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { configs, test } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text does not have per-mode styles
|
||||||
|
*/
|
||||||
|
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||||
|
test.describe(title('text: basic'), () => {
|
||||||
|
test('should render default text', async ({ page }) => {
|
||||||
|
await page.setContent(
|
||||||
|
`
|
||||||
|
<ion-text>
|
||||||
|
<strong>The quick brown fox <ion-text><sup>jumps</sup></ion-text> over the <ion-text><sub>lazy dog</sub></ion-text></strong>
|
||||||
|
</ion-text>
|
||||||
|
`,
|
||||||
|
config
|
||||||
|
);
|
||||||
|
|
||||||
|
const text = page.locator('ion-text');
|
||||||
|
await expect(text.nth(0)).toHaveScreenshot(screenshot(`text`));
|
||||||
|
});
|
||||||
|
test('should render text with color prop', async ({ page }) => {
|
||||||
|
await page.setContent(
|
||||||
|
`
|
||||||
|
<ion-text color="primary">
|
||||||
|
<strong>The quick brown fox <ion-text color="success"><sup>jumps</sup></ion-text> over the <ion-text color="danger"><sub>lazy dog</sub></ion-text></strong>
|
||||||
|
</ion-text>
|
||||||
|
`,
|
||||||
|
config
|
||||||
|
);
|
||||||
|
|
||||||
|
const text = page.locator('ion-text');
|
||||||
|
await expect(text.nth(0)).toHaveScreenshot(screenshot(`text-color`));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |