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. -->
This commit is contained in:
Liam DeBeasi
2023-05-03 20:07:12 -04:00
committed by GitHub
parent 82b607d6e3
commit f402d8e052
8 changed files with 36 additions and 29 deletions

View File

@ -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`);
});
});

View 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`));
});
});
});