test(badge): match design screenshots (#29572)

This commit is contained in:
Maria Hutt
2024-05-31 10:27:35 -07:00
committed by GitHub
parent 7d4a704b1c
commit e9fd407e90
26 changed files with 67 additions and 10 deletions

View File

@@ -61,7 +61,7 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens
test('should render small badges', async ({ page }) => {
await page.setContent(
`
<ion-badge size="small">00</ion-badge>
<ion-badge size="small">1</ion-badge>
`,
config
);
@@ -71,10 +71,23 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens
await expect(badge).toHaveScreenshot(screenshot(`badge-size-small`));
});
test('should render small badges with long text', async ({ page }) => {
await page.setContent(
`
<ion-badge size="small">99+</ion-badge>
`,
config
);
const badge = page.locator('ion-badge');
await expect(badge).toHaveScreenshot(screenshot(`badge-size-small-long-text`));
});
test('should render medium badges', async ({ page }) => {
await page.setContent(
`
<ion-badge size="medium">00</ion-badge>
<ion-badge size="medium">1</ion-badge>
`,
config
);
@@ -84,10 +97,23 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens
await expect(badge).toHaveScreenshot(screenshot(`badge-size-medium`));
});
test('should render medium badges with long text', async ({ page }) => {
await page.setContent(
`
<ion-badge size="medium">99+</ion-badge>
`,
config
);
const badge = page.locator('ion-badge');
await expect(badge).toHaveScreenshot(screenshot(`badge-size-medium-long-text`));
});
test('should render large badges', async ({ page }) => {
await page.setContent(
`
<ion-badge size="large">00</ion-badge>
<ion-badge size="large">1</ion-badge>
`,
config
);
@@ -97,10 +123,23 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens
await expect(badge).toHaveScreenshot(screenshot(`badge-size-large`));
});
test('should render large badges with long text', async ({ page }) => {
await page.setContent(
`
<ion-badge size="large">99+</ion-badge>
`,
config
);
const badge = page.locator('ion-badge');
await expect(badge).toHaveScreenshot(screenshot(`badge-size-large-long-text`));
});
test('should render xlarge badges', async ({ page }) => {
await page.setContent(
`
<ion-badge size="xlarge">00</ion-badge>
<ion-badge size="xlarge">1</ion-badge>
`,
config
);
@@ -109,5 +148,18 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens
await expect(badge).toHaveScreenshot(screenshot(`badge-size-xlarge`));
});
test('should render xlarge badges with long text', async ({ page }) => {
await page.setContent(
`
<ion-badge size="xlarge">99+</ion-badge>
`,
config
);
const badge = page.locator('ion-badge');
await expect(badge).toHaveScreenshot(screenshot(`badge-size-xlarge-long-text`));
});
});
});

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 B

After

Width:  |  Height:  |  Size: 294 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 355 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

After

Width:  |  Height:  |  Size: 278 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

After

Width:  |  Height:  |  Size: 270 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 924 B

After

Width:  |  Height:  |  Size: 284 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 473 B

After

Width:  |  Height:  |  Size: 224 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 214 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 536 B

After

Width:  |  Height:  |  Size: 217 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 209 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 300 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 385 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 299 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

View File

@@ -18,7 +18,7 @@
<ion-app>
<ion-header>
<ion-toolbar>
<ion-title>Button - Size</ion-title>
<ion-title>Badge - Size</ion-title>
</ion-toolbar>
</ion-header>
@@ -26,7 +26,8 @@
<ion-list>
<ion-item>
<ion-label>Default</ion-label>
<ion-badge slot="end">00</ion-badge>
<ion-badge slot="end">1</ion-badge>
<ion-badge slot="end">99+</ion-badge>
</ion-item>
<ion-item>
<ion-label>XXSmall</ion-label>
@@ -40,19 +41,23 @@
</ion-item>
<ion-item>
<ion-label>Small</ion-label>
<ion-badge slot="end" size="small">00</ion-badge>
<ion-badge slot="end" size="small">1</ion-badge>
<ion-badge slot="end" size="small">99+</ion-badge>
</ion-item>
<ion-item>
<ion-label>Medium</ion-label>
<ion-badge slot="end" size="medium">00</ion-badge>
<ion-badge slot="end" size="medium">1</ion-badge>
<ion-badge slot="end" size="medium">99+</ion-badge>
</ion-item>
<ion-item>
<ion-label>Large</ion-label>
<ion-badge slot="end" size="large">00</ion-badge>
<ion-badge slot="end" size="large">1</ion-badge>
<ion-badge slot="end" size="large">99+</ion-badge>
</ion-item>
<ion-item>
<ion-label>XLarge</ion-label>
<ion-badge slot="end" size="xlarge">00</ion-badge>
<ion-badge slot="end" size="xlarge">1</ion-badge>
<ion-badge slot="end" size="xlarge">99+</ion-badge>
</ion-item>
</ion-list>
</ion-content>