Skip to content

Commit 0eed01b

Browse files
chore(divider): update tests and snapshots
- apply more code review suggetions
1 parent c1ec78b commit 0eed01b

File tree

64 files changed

+69
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+69
-75
lines changed

core/api.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ ion-datetime-button,prop,theme,"ios" | "md" | "ionic",undefined,false,false
731731
ion-datetime-button,part,native
732732

733733
ion-divider,shadow
734-
ion-divider,prop,inset,boolean | undefined,false,false,false
735-
ion-divider,prop,spacing,"large" | "medium" | "small" | "xlarge" | "xsmall" | "xxlarge" | "xxsmall" | undefined,undefined,false,true
734+
ion-divider,prop,inset,boolean,false,false,false
735+
ion-divider,prop,spacing,"large" | "medium" | "small" | "xlarge" | "xsmall" | "xxlarge" | "xxsmall" | undefined,'xxsmall',false,true
736736
ion-divider,css-prop,--margin-bottom,ionic
737737
ion-divider,css-prop,--margin-bottom,ios
738738
ion-divider,css-prop,--margin-bottom,md

core/src/components.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,9 +1164,9 @@ export namespace Components {
11641164
/**
11651165
* If `true`, the divider will have horizontal margins By default, it's `false`
11661166
*/
1167-
"inset"?: boolean;
1167+
"inset": boolean;
11681168
/**
1169-
* Set to `"xxsmall"` for the smallest spacing. Set to "xsmall" for a very small spacing. Set to `"small"` for a small spacing. Set to "medium" for a medium spacing. Set to "large" for a large spacing. Set to `"xlarge"` for the largest spacing. Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
1169+
* Set to `"xxsmall"` for the smallest spacing. Set to "xsmall" for very small spacing. Set to `"small"` for small spacing. Set to "medium" for medium spacing. Set to "large" for large spacing. Set to `"xlarge"` for the largest spacing. Defaults to `"xxsmall"`.
11701170
*/
11711171
"spacing"?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge';
11721172
}
@@ -6634,7 +6634,7 @@ declare namespace LocalJSX {
66346634
*/
66356635
"inset"?: boolean;
66366636
/**
6637-
* Set to `"xxsmall"` for the smallest spacing. Set to "xsmall" for a very small spacing. Set to `"small"` for a small spacing. Set to "medium" for a medium spacing. Set to "large" for a large spacing. Set to `"xlarge"` for the largest spacing. Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
6637+
* Set to `"xxsmall"` for the smallest spacing. Set to "xsmall" for very small spacing. Set to `"small"` for small spacing. Set to "medium" for medium spacing. Set to "large" for large spacing. Set to `"xlarge"` for the largest spacing. Defaults to `"xxsmall"`.
66386638
*/
66396639
"spacing"?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge';
66406640
}

core/src/components/divider/divider.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
padding-right: calc(var(--padding-start) + var(--ion-safe-area-right, 0px));
2828
padding-left: var(--padding-end);
2929
}
30-
/* stylelint-enable */
30+
/* stylelint-enable */
3131
}
3232

3333
:host hr {
@@ -45,32 +45,32 @@
4545
// Divider Spacing
4646
// --------------------------------------------------
4747

48-
:host(.divider-space-xsmall) {
48+
:host(.divider-spacing-xsmall) {
4949
--margin-top: #{globals.$ion-space-200};
5050
--margin-bottom: #{globals.$ion-space-200};
5151
}
5252

53-
:host(.divider-space-small) {
53+
:host(.divider-spacing-small) {
5454
--margin-top: #{globals.$ion-space-300};
5555
--margin-bottom: #{globals.$ion-space-300};
5656
}
5757

58-
:host(.divider-space-medium) {
58+
:host(.divider-spacing-medium) {
5959
--margin-top: #{globals.$ion-space-400};
6060
--margin-bottom: #{globals.$ion-space-400};
6161
}
6262

63-
:host(.divider-space-large) {
63+
:host(.divider-spacing-large) {
6464
--margin-top: #{globals.$ion-space-600};
6565
--margin-bottom: #{globals.$ion-space-600};
6666
}
6767

68-
:host(.divider-space-xlarge) {
68+
:host(.divider-spacing-xlarge) {
6969
--margin-top: #{globals.$ion-space-800};
7070
--margin-bottom: #{globals.$ion-space-800};
7171
}
7272

73-
:host(.divider-space-xxlarge) {
73+
:host(.divider-spacing-xxlarge) {
7474
--margin-top: #{globals.$ion-space-1000};
7575
--margin-bottom: #{globals.$ion-space-1000};
7676
}

core/src/components/divider/divider.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ export class Divider implements ComponentInterface {
2222
*
2323
* Defaults to `"xxsmall"`.
2424
*/
25-
@Prop({ reflect: true }) spacing?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' = 'xxsmall';
25+
@Prop({ reflect: true }) spacing?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' =
26+
'xxsmall';
2627

2728
/**
2829
* If `true`, the divider will have horizontal margins
2930
* By default, it's `false`
3031
*/
31-
@Prop() inset?: boolean = false;
32-
32+
@Prop() inset: boolean = false;
3333

3434
render() {
3535
const { inset, spacing } = this;
3636
const theme = getIonTheme(this);
37-
37+
3838
return (
3939
<Host
4040
class={{

core/src/components/divider/test/basic/divider.e2e.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,37 @@ import { configs, test } from '@utils/test/playwright';
44
configs().forEach(({ config, screenshot, title }) => {
55
test.describe(title('divider: rendering'), () => {
66
test('should not have visual regressions', async ({ page }) => {
7-
await page.goto('/src/components/divider/test/basic', config);
7+
await page.setContent(
8+
`
9+
<div id="container">
10+
top
11+
<ion-divider></ion-divider>
12+
bottom
13+
</div>
14+
`,
15+
config
16+
);
817

9-
await page.setIonViewport();
18+
const container = page.locator('#container');
1019

11-
await expect(page).toHaveScreenshot(screenshot(`divider-basic`));
20+
await expect(container).toHaveScreenshot(screenshot(`divider-basic-default`));
21+
});
22+
23+
test('should not have visual regressions when inset is enabled', async ({ page }) => {
24+
await page.setContent(
25+
`
26+
<div id="container">
27+
top
28+
<ion-divider inset="true"></ion-divider>
29+
bottom
30+
</div>
31+
`,
32+
config
33+
);
34+
35+
const container = page.locator('#container');
36+
37+
await expect(container).toHaveScreenshot(screenshot(`divider-basic-inset`));
1238
});
1339
});
1440
});
1.62 KB
2.12 KB
1.85 KB
1.6 KB
2.07 KB

0 commit comments

Comments
 (0)