Skip to content

Commit e96a032

Browse files
committed
feat(progress-bar): add shape constant
1 parent bf2d8a4 commit e96a032

3 files changed

Lines changed: 15 additions & 35 deletions

File tree

core/src/components/progress-bar/progress-bar.interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,5 @@ export type IonProgressBarConfig = {
103103
shape?: IonProgressBarShape;
104104
};
105105

106-
export type IonProgressBarShape = 'round' | 'rectangular';
106+
export const ION_PROGRESS_BAR_SHAPES = ['round', 'rectangular'] as const;
107+
export type IonProgressBarShape = (typeof ION_PROGRESS_BAR_SHAPES)[number];

core/src/components/progress-bar/progress-bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { IonProgressBarShape } from './progress-bar.interfaces';
1010

1111
/**
1212
* * @virtualProp {"ios" | "md"} mode - The mode determines the platform behaviors of the component.
13-
*
13+
*
1414
* @part progress - The progress bar that shows the current value when `type` is `"determinate"` and slides back and forth when `type` is `"indeterminate"`.
1515
* @part stream - The animated circles that appear while buffering. This only shows when `buffer` is set and `type` is `"determinate"`.
1616
* @part track - The track bar behind the progress bar. If the `buffer` property is set and `type` is `"determinate"` the track will be the
Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,17 @@
11
import { expect } from '@playwright/test';
22
import { configs, test } from '@utils/test/playwright';
33

4+
import { ION_PROGRESS_BAR_SHAPES } from '../../progress-bar.interfaces';
5+
46
/**
57
* This behavior does not vary across directions
68
*/
79
configs({ directions: ['ltr'], modes: ['ios', 'md', 'ionic-md'] }).forEach(({ title, screenshot, config }) => {
810
test.describe(title('progress-bar: shape'), () => {
9-
test('round - should not have visual regressions', async ({ page }) => {
10-
await page.setContent(
11-
`
12-
<style>
13-
.ionic {
14-
--ion-background-color: #ccc7c7;
15-
}
16-
17-
.container {
18-
padding: 10px;
19-
}
20-
</style>
21-
22-
<div class="container">
23-
<ion-progress-bar value="0.50" shape="round"></ion-progress-bar>
24-
</div>
25-
`,
26-
config
27-
);
28-
29-
const container = page.locator('.container');
30-
31-
await expect(container).toHaveScreenshot(screenshot(`progress-bar-shape-round`));
32-
});
33-
34-
test('rectangular - should not have visual regressions', async ({ page }) => {
35-
await page.setContent(
36-
`
11+
ION_PROGRESS_BAR_SHAPES.forEach((shape) => {
12+
test(`${shape} - should not have visual regressions`, async ({ page }) => {
13+
await page.setContent(
14+
`
3715
<style>
3816
.ionic {
3917
--ion-background-color: #ccc7c7;
@@ -45,15 +23,16 @@ configs({ directions: ['ltr'], modes: ['ios', 'md', 'ionic-md'] }).forEach(({ ti
4523
</style>
4624
4725
<div class="container">
48-
<ion-progress-bar value="0.50" shape="rectangular"></ion-progress-bar>
26+
<ion-progress-bar value="0.50" shape="${shape}"></ion-progress-bar>
4927
</div>
5028
`,
51-
config
52-
);
29+
config
30+
);
5331

54-
const container = page.locator('.container');
32+
const container = page.locator('.container');
5533

56-
await expect(container).toHaveScreenshot(screenshot(`progress-bar-shape-rectangular`));
34+
await expect(container).toHaveScreenshot(screenshot(`progress-bar-shape-${shape}`));
35+
});
5736
});
5837
});
5938
});

0 commit comments

Comments
 (0)