Skip to content

Commit

Permalink
fix(list): inset lists render correctly (#26586)
Browse files Browse the repository at this point in the history
resolves #20819
  • Loading branch information
liamdebeasi authored Jan 11, 2023
1 parent be0a517 commit 911b1d4
Show file tree
Hide file tree
Showing 34 changed files with 81 additions and 87 deletions.
1 change: 1 addition & 0 deletions core/src/components/item/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
...createColorClasses(this.color, {
item: true,
[mode]: true,
'item-lines-default': lines === undefined,
[`item-lines-${lines}`]: lines !== undefined,
[`item-fill-${fillValue}`]: true,
[`item-shape-${shape}`]: shape !== undefined,
Expand Down
41 changes: 7 additions & 34 deletions core/src/components/list/list.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
@include border-radius($list-inset-ios-border-radius);
}

.list-ios.list-inset ion-item {
--border-width: 0 0 1px 0;
--inner-border-width: 0;
}

.list-ios.list-inset ion-item:last-child {
--border-width: 0;
--inner-border-width: 0;
Expand All @@ -38,49 +33,27 @@
// iOS No Lines List
// --------------------------------------------------

.list-ios-lines-none .item {
--border-width: 0;
--inner-border-width: 0;
.list-ios-lines-none .item-lines-default {
--inner-border-width: 0px;
--border-width: 0px;
}

// iOS Full Lines List
// --------------------------------------------------

.list-ios-lines-full .item,
.list-ios .item-lines-full {
.list-ios-lines-full .item-lines-default {
--inner-border-width: 0px;
--border-width: #{0 0 $list-ios-item-border-bottom-width 0};
}

.list-ios-lines-full .item {
--inner-border-width: 0;
}


// iOS Inset Lines List
// --------------------------------------------------

.list-ios-lines-inset .item,
.list-ios .item-lines-inset {
.list-ios-lines-inset .item-lines-default {
--inner-border-width: #{0 0 $list-ios-item-border-bottom-width 0};
--border-width: 0px;
}

// Remove the border from items in lists
// if they are explicitly styled by the item
// to be different than the list
.list-ios .item-lines-inset {
--border-width: 0;
}

.list-ios .item-lines-full {
--inner-border-width: 0;
}

.list-ios .item-lines-none {
--border-width: 0;
--inner-border-width: 0;
}


// iOS List Inside A Card
// --------------------------------------------------

Expand Down
42 changes: 7 additions & 35 deletions core/src/components/list/list.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@include position-horizontal(0, null);
}


// Material Design Inset List
// --------------------------------------------------

Expand All @@ -34,11 +33,6 @@
--inner-border-width: 0;
}

.list-md.list-inset .item-interactive {
--padding-start: 0;
--padding-end: 0;
}

.list-md.list-inset + ion-list.list-inset {
@include margin(0, null, null, null);
}
Expand All @@ -47,49 +41,27 @@
// Material Design No Lines List
// --------------------------------------------------

.list-md-lines-none .item {
--border-width: 0;
--inner-border-width: 0;
.list-md-lines-none .item-lines-default {
--inner-border-width: 0px;
--border-width: 0px;
}

// Material Design Full Lines List
// --------------------------------------------------

.list-md-lines-full .item,
.list-md .item-lines-full {
.list-md-lines-full .item-lines-default {
--inner-border-width: 0px;
--border-width: #{0 0 $list-md-item-border-bottom-width 0};
}

.list-md-lines-full .item {
--inner-border-width: 0;
}


// Material Design Inset Lines List
// --------------------------------------------------

.list-md-lines-inset .item,
.list-md .item-lines-inset {
.list-md-lines-inset .item-lines-default {
--inner-border-width: #{0 0 $list-md-item-border-bottom-width 0};
--border-width: 0px;
}

// Remove the border from items in lists
// if they are explicitly styled by the item
// to be different than the list
.list-md .item-lines-inset {
--border-width: 0;
}

.list-md .item-lines-full {
--inner-border-width: 0;
}

.list-md .item-lines-none {
--border-width: 0;
--inner-border-width: 0;
}


// Material Design List Inside A Card
// --------------------------------------------------

Expand Down
84 changes: 66 additions & 18 deletions core/src/components/list/test/inset/list.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,73 @@ import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';

test.describe('list: inset', () => {
test.describe('list: rendering', () => {
test('should not have visual regressions', async ({ page }) => {
await page.setContent(`
<ion-content color="primary">
<div class="wrapper" style="display: flex">
<ion-list inset="true" style="width: 100%">
<ion-item>Pokémon Yellow</ion-item>
<ion-item>Super Metroid</ion-item>
<ion-item>Mega Man X</ion-item>
<ion-item>The Legend of Zelda</ion-item>
<ion-item lines="full">Halo</ion-item>
</ion-list>
</div>
</ion-content>
`);
test.beforeEach(({ skip }) => {
skip.rtl();
});
test('should render full lines while allowing for overrides', async ({ page }) => {
await page.setContent(`
<ion-content color="primary">
<div class="wrapper" style="display: flex">
<ion-list inset="true" style="width: 100%" lines="full">
<ion-item>
<ion-input value="Input Text"></ion-input>
</ion-item>
<ion-item>Pokémon Yellow</ion-item>
<ion-item lines="inset">Super Metroid (with Inset Line)</ion-item>
<ion-item lines="none">Mega Man X (with No Line)</ion-item>
<ion-item>The Legend of Zelda</ion-item>
<ion-item lines="full">Halo</ion-item>
</ion-list>
</div>
</ion-content>
`);

const listWrapper = page.locator('.wrapper');

expect(await listWrapper.screenshot()).toMatchSnapshot(`list-inset-full-lines-${page.getSnapshotSettings()}.png`);
});
test('should render inset lines while allowing for overrides', async ({ page }) => {
await page.setContent(`
<ion-content color="primary">
<div class="wrapper" style="display: flex">
<ion-list inset="true" style="width: 100%" lines="inset">
<ion-item>
<ion-input value="Input Text"></ion-input>
</ion-item>
<ion-item>Pokémon Yellow</ion-item>
<ion-item lines="full">Super Metroid (with Full Line)</ion-item>
<ion-item lines="none">Mega Man X (with No Line)</ion-item>
<ion-item>The Legend of Zelda</ion-item>
<ion-item lines="full">Halo</ion-item>
</ion-list>
</div>
</ion-content>
`);

const listWrapper = page.locator('.wrapper');

expect(await listWrapper.screenshot()).toMatchSnapshot(`list-inset-inset-lines-${page.getSnapshotSettings()}.png`);
});
test('should render no lines while allowing for overrides', async ({ page }) => {
await page.setContent(`
<ion-content color="primary">
<div class="wrapper" style="display: flex">
<ion-list inset="true" style="width: 100%" lines="none">
<ion-item>
<ion-input value="Input Text"></ion-input>
</ion-item>
<ion-item>Pokémon Yellow</ion-item>
<ion-item lines="full">Super Metroid (with Full Line)</ion-item>
<ion-item lines="inset">Mega Man X (with Inset Line)</ion-item>
<ion-item>The Legend of Zelda</ion-item>
<ion-item lines="full">Halo</ion-item>
</ion-list>
</div>
</ion-content>
`);

const listWrapper = page.locator('.wrapper');
const listWrapper = page.locator('.wrapper');

expect(await listWrapper.screenshot()).toMatchSnapshot(`list-inset-diff-${page.getSnapshotSettings()}.png`);
});
expect(await listWrapper.screenshot()).toMatchSnapshot(`list-inset-no-lines-${page.getSnapshotSettings()}.png`);
});
});
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 911b1d4

Please sign in to comment.