diff --git a/core/src/components/action-sheet/test/test.utils.ts b/core/src/components/action-sheet/test/test.utils.ts
index 0d8673f8823..6f497bebc7c 100644
--- a/core/src/components/action-sheet/test/test.utils.ts
+++ b/core/src/components/action-sheet/test/test.utils.ts
@@ -19,7 +19,7 @@ export async function testActionSheet(
url: pageUrl
});
- const screenShotCompares = [];
+ const screenshotCompares = [];
const presentBtn = await page.find(selector);
await presentBtn.click();
@@ -27,20 +27,20 @@ export async function testActionSheet(
let actionSheet = await page.find('ion-action-sheet');
await actionSheet.waitForVisible();
- screenShotCompares.push(await page.compareScreenshot(screenshotName));
+ screenshotCompares.push(await page.compareScreenshot(screenshotName));
- await afterScreenshotHook(page, screenshotName, screenShotCompares, actionSheet);
+ await afterScreenshotHook(page, screenshotName, screenshotCompares, actionSheet);
await actionSheet.callMethod('dismiss');
await actionSheet.waitForNotVisible();
- screenShotCompares.push(await page.compareScreenshot(`dismissed ${screenshotName}`));
+ screenshotCompares.push(await page.compareScreenshot(`dismissed ${screenshotName}`));
actionSheet = await page.find('ion-action-sheet');
expect(actionSheet).toBe(null);
- for (const screenShotCompare of screenShotCompares) {
- expect(screenShotCompare).toMatchScreenshot();
+ for (const screenshotCompare of screenshotCompares) {
+ expect(screenshotCompare).toMatchScreenshot();
}
} catch (err) {
@@ -51,7 +51,7 @@ export async function testActionSheet(
export async function testActionSheetBackdrop(
page: any,
screenshotName: string,
- screenShotCompares: any,
+ screenshotCompares: any,
actionSheet: any
) {
try {
@@ -59,7 +59,7 @@ export async function testActionSheetBackdrop(
const backdrop = await page.find('ion-backdrop');
await backdrop.click();
- screenShotCompares.push(await page.compareScreenshot(`dismissed backdrop ${screenshotName}`));
+ screenshotCompares.push(await page.compareScreenshot(`dismissed backdrop ${screenshotName}`));
const isVisible = await actionSheet.isVisible();
expect(isVisible).toBe(true);
@@ -71,7 +71,7 @@ export async function testActionSheetBackdrop(
export async function testActionSheetAlert(
page: any,
screenshotName: string,
- screenShotCompares: any
+ screenshotCompares: any
) {
try {
const openAlertBtn = await page.find({ text: 'Open Alert' });
@@ -81,7 +81,7 @@ export async function testActionSheetAlert(
await alert.waitForVisible();
await page.waitFor(250);
- screenShotCompares.push(await page.compareScreenshot(`alert open ${screenshotName}`));
+ screenshotCompares.push(await page.compareScreenshot(`alert open ${screenshotName}`));
const alertOkayBtn = await page.find({ contains: 'Okay' });
await alertOkayBtn.click();
diff --git a/core/src/components/alert/test/test.utils.ts b/core/src/components/alert/test/test.utils.ts
index e78c40943df..4038d072cf6 100644
--- a/core/src/components/alert/test/test.utils.ts
+++ b/core/src/components/alert/test/test.utils.ts
@@ -18,7 +18,7 @@ export async function testAlert(
url: pageUrl
});
- const screenShotCompares = [];
+ const screenshotCompares = [];
await page.click(selector);
await page.waitForSelector(selector);
@@ -28,18 +28,18 @@ export async function testAlert(
expect(alert).not.toBe(null);
await alert.waitForVisible();
- screenShotCompares.push(await page.compareScreenshot(screenshotName));
+ screenshotCompares.push(await page.compareScreenshot(screenshotName));
await alert.callMethod('dismiss');
await alert.waitForNotVisible();
- screenShotCompares.push(await page.compareScreenshot(`dismiss ${screenshotName}`));
+ screenshotCompares.push(await page.compareScreenshot(`dismiss ${screenshotName}`));
alert = await page.find('ion-alert');
expect(alert).toBe(null);
- for (const screenShotCompare of screenShotCompares) {
- expect(screenShotCompare).toMatchScreenshot();
+ for (const screenshotCompare of screenshotCompares) {
+ expect(screenshotCompare).toMatchScreenshot();
}
} catch (err) {
diff --git a/core/src/components/fab/test/test.utils.ts b/core/src/components/fab/test/test.utils.ts
index 52a599a8cb6..fdfabf24ace 100644
--- a/core/src/components/fab/test/test.utils.ts
+++ b/core/src/components/fab/test/test.utils.ts
@@ -35,8 +35,8 @@ export async function testFab(
screenshotCompares.push(await page.compareScreenshot(`${screenshotName} close`));
- for (const screenShotCompare of screenshotCompares) {
- expect(screenShotCompare).toMatchScreenshot();
+ for (const screenshotCompare of screenshotCompares) {
+ expect(screenshotCompare).toMatchScreenshot();
}
} catch (err) {
throw err;
@@ -69,8 +69,8 @@ export async function testDisabledFab(
screenshotCompares.push(await page.compareScreenshot(`disabled ${screenshotName} attempt open`));
- for (const screenShotCompare of screenshotCompares) {
- expect(screenShotCompare).toMatchScreenshot();
+ for (const screenshotCompare of screenshotCompares) {
+ expect(screenshotCompare).toMatchScreenshot();
}
} catch (err) {
throw err;
diff --git a/core/src/components/item-option/item-option.scss b/core/src/components/item-option/item-option.scss
index aa9a9ed1265..30ba65d8d42 100644
--- a/core/src/components/item-option/item-option.scss
+++ b/core/src/components/item-option/item-option.scss
@@ -38,6 +38,8 @@
@include text-inherit();
@include padding(0, .7em);
+ display: inline-block;
+
position: relative;
width: 100%;
@@ -51,13 +53,14 @@
cursor: pointer;
appearance: none;
+
+ box-sizing: border-box;
}
.button-inner {
display: flex;
- flex-direction: column;
- flex-flow: row nowrap;
+ flex-flow: column nowrap;
flex-shrink: 0;
align-items: center;
justify-content: center;
@@ -66,6 +69,29 @@
height: 100%;
}
+.horizontal-wrapper {
+ display: flex;
+
+ flex-flow: row nowrap;
+ flex-shrink: 0;
+ align-items: center;
+ justify-content: center;
+
+ width: 100%;
+}
+
+::slotted(*) {
+ flex-shrink: 0;
+}
+
+::slotted([slot="start"]) {
+ @include margin(0, 5px, 0, 0);
+}
+
+::slotted([slot="end"]) {
+ @include margin(0, 0, 0, 5px);
+}
+
::slotted([slot="icon-only"]) {
@include padding(0);
@include margin(0, 10px);
diff --git a/core/src/components/item-option/item-option.tsx b/core/src/components/item-option/item-option.tsx
index 6e93fbde4d7..1a231a11088 100644
--- a/core/src/components/item-option/item-option.tsx
+++ b/core/src/components/item-option/item-option.tsx
@@ -80,12 +80,14 @@ export class ItemOption implements ComponentInterface {
href={this.href}
>
-
-
-
-
-
-
+
+
+
+
+
+
+
+
{this.mode === 'md' && }
diff --git a/core/src/components/item-sliding/item-sliding.tsx b/core/src/components/item-sliding/item-sliding.tsx
index f9df7fc2575..c7f1f7f83a5 100644
--- a/core/src/components/item-sliding/item-sliding.tsx
+++ b/core/src/components/item-sliding/item-sliding.tsx
@@ -319,10 +319,10 @@ export class ItemSliding implements ComponentInterface {
function swipeShouldReset(isResetDirection: boolean, isMovingFast: boolean, isOnResetZone: boolean): boolean {
// The logic required to know when the sliding item should close (openAmount=0)
- // depends on three booleans (isCloseDirection, isMovingFast, isOnCloseZone)
+ // depends on three booleans (isResetDirection, isMovingFast, isOnResetZone)
// and it ended up being too complicated to be written manually without errors
// so the truth table is attached below: (0=false, 1=true)
- // isCloseDirection | isMovingFast | isOnCloseZone || shouldClose
+ // isResetDirection | isMovingFast | isOnResetZone || shouldClose
// 0 | 0 | 0 || 0
// 0 | 0 | 1 || 1
// 0 | 1 | 0 || 0
diff --git a/core/src/components/item-sliding/readme.md b/core/src/components/item-sliding/readme.md
index 19bdf38ea9c..b41c1c5455c 100644
--- a/core/src/components/item-sliding/readme.md
+++ b/core/src/components/item-sliding/readme.md
@@ -35,19 +35,145 @@ Options can be expanded to take up the full width of the item if you swipe past
```html
+
-
- Item
-
Favorite
Share
+
+ Item Options
+
+
Unread
+
+
+
+
+
+ Delete
+
+
+
+
+ Expandable Options
+
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ HubStruck Notifications
+ A new message in your network
+ Oceanic Next has joined your network
+
+
+ 10:45 AM
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Sliding Item, Icons Start
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Icons End
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Icons Top
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Icons Bottom
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
```
@@ -56,19 +182,145 @@ Options can be expanded to take up the full width of the item if you swipe past
```html
+
-
- Item
-
Favorite
Share
+
+ Item Options
+
+
Unread
+
+
+
+
+
+ Delete
+
+
+
+
+ Expandable Options
+
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ HubStruck Notifications
+ A new message in your network
+ Oceanic Next has joined your network
+
+
+ 10:45 AM
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Sliding Item, Icons Start
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Icons End
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Icons Top
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Icons Bottom
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
```
@@ -83,17 +335,143 @@ import { IonList, IonItemSliding, IonItem, IonLabel, IonItemOptions, IonItemOpti
const Example: React.SFC<{}> = () => (
+ {/* Sliding item with text options on both sides */}
+
+
+ Favorite
+ Share
+
+
+
+ Item Options
+
+
+
+ Unread
+
+
+
+ {/* Sliding item with expandable options on both sides */}
+
+
+ Delete
+
+
+
- Item
+ Expandable Options
+
+
+
+
+ Archive
+
+
+
+
+ {/* Multi-line sliding item with icon options on both sides */}
+
+
+
+ HubStruck Notifications
+ A new message in your network
+ Oceanic Next has joined your network
+
+
+ 10:45 AM
+
+
- {}}>Favorite
- {}}>Share
+
+
+
- {}}>Unread
+
+
+
+
+
+
+
+
+
+ {/* Sliding item with icon start options on end side */}
+
+
+
+ Sliding Item, Icons Start
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+ {/* Sliding item with icon end options on end side */}
+
+
+
+ Sliding Item, Icons End
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+ {/* Sliding item with icon top options on end side */}
+
+
+
+ Sliding Item, Icons Top
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+ {/* Sliding item with icon bottom options on end side */}
+
+
+
+ Sliding Item, Icons Bottom
+
+
+
+
+
+ More
+
+
+
+ Archive
+
@@ -109,19 +487,145 @@ export default Example;
```html
+
-
- Item
-
Favorite
Share
+
+ Item Options
+
+
Unread
+
+
+
+
+
+ Delete
+
+
+
+
+ Expandable Options
+
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ HubStruck Notifications
+ A new message in your network
+ Oceanic Next has joined your network
+
+
+ 10:45 AM
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Sliding Item, Icons Start
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Icons End
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Icons Top
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Icons Bottom
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
```
diff --git a/core/src/components/item-sliding/test/interactive/e2e.ts b/core/src/components/item-sliding/test/interactive/e2e.ts
index 7319b27c7ac..608820f88e0 100644
--- a/core/src/components/item-sliding/test/interactive/e2e.ts
+++ b/core/src/components/item-sliding/test/interactive/e2e.ts
@@ -1,12 +1,14 @@
import { newE2EPage } from '@stencil/core/testing';
+import { openItemSliding } from '../test.utils';
+
test('item-sliding: interactive', async () => {
const page = await newE2EPage({
url: '/src/components/item-sliding/test/interactive?ionic:_testing=true'
});
- const compare = await page.compareScreenshot();
- expect(compare).toMatchScreenshot();
+ const compares = [];
+ compares.push(await page.compareScreenshot());
const items = await page.$$('ion-item-sliding');
expect(items.length).toEqual(3);
@@ -20,30 +22,30 @@ test('item-sliding: interactive', async () => {
const itemsAfterSecondSlide = await page.$$('ion-item-sliding');
expect(itemsAfterSecondSlide.length).toEqual(1);
+
+ for (const compare of compares) {
+ expect(compare).toMatchScreenshot();
+ }
});
async function slideAndDelete(item: any, page: any) {
try {
// Get the element's ID
const id = await(await item.getProperty('id')).jsonValue();
-
- // Simulate a drag
- const boundingBox = await item.boundingBox();
- const centerX = parseFloat(boundingBox.x + boundingBox.width / 2);
- const centerY = parseFloat(boundingBox.y + boundingBox.height / 2);
-
- await page.mouse.move(centerX, centerY);
- await page.mouse.down();
- await page.mouse.move(0, centerY);
- await page.mouse.up();
-
- // Click the "delete" option
- const options = await item.$$('ion-item-option');
- await options[0].click();
-
- // Wait for element to be removed from DOM
- await page.waitForSelector(id, { hidden: true });
+ await openItemSliding(`#${id}`, page);
+ await deleteItemSliding(item, page, id);
} catch (err) {
throw err;
}
}
+
+async function deleteItemSliding(item: any, page: any, id: string) {
+ // Click the "delete" option
+ const options = await item.$$('ion-item-option');
+ await options[0].click();
+
+ // Wait for element to be removed from DOM
+ await page.waitForSelector(id, { hidden: true });
+
+ await page.waitFor(1000);
+}
diff --git a/core/src/components/item-sliding/test/standalone/e2e.ts b/core/src/components/item-sliding/test/standalone/e2e.ts
index 668574e0273..7b3c7cef70d 100644
--- a/core/src/components/item-sliding/test/standalone/e2e.ts
+++ b/core/src/components/item-sliding/test/standalone/e2e.ts
@@ -1,10 +1,31 @@
import { newE2EPage } from '@stencil/core/testing';
+import { closeItemSliding, openItemSliding } from '../test.utils';
+
test('item-sliding: standalone', async () => {
const page = await newE2EPage({
url: '/src/components/item-sliding/test/standalone?ionic:_testing=true'
});
- const compare = await page.compareScreenshot();
- expect(compare).toMatchScreenshot();
+ const compares = [];
+ compares.push(await page.compareScreenshot());
+
+ // Pass sliding item with start icons in option
+ await openItemSliding('#startItem', page);
+ compares.push(await page.compareScreenshot(`start icons open`));
+ await closeItemSliding(page);
+
+ // Pass sliding item with top icons in option
+ await openItemSliding('#topItem', page);
+ compares.push(await page.compareScreenshot(`top icons open`));
+ await closeItemSliding(page);
+
+ // Pass sliding item with anchor option
+ await openItemSliding('#anchorItem', page);
+ compares.push(await page.compareScreenshot(`anchor option`));
+ await closeItemSliding(page);
+
+ for (const compare of compares) {
+ expect(compare).toMatchScreenshot();
+ }
});
diff --git a/core/src/components/item-sliding/test/standalone/index.html b/core/src/components/item-sliding/test/standalone/index.html
index 1fdf33e00d1..04e945474dc 100644
--- a/core/src/components/item-sliding/test/standalone/index.html
+++ b/core/src/components/item-sliding/test/standalone/index.html
@@ -4,7 +4,8 @@
Item Sliding - Standalone
-
+
@@ -12,38 +13,168 @@
+
+
+ Favorite
+ Share
+
+
+ Item Options
+
+
+
+ Unread
+
+
+
+
+
+
+
+ Delete
+
+
+
+
+ Expandable Options
+
+
+
+
+ Archive
+
+
+
+
+
+
+
- One Line, icon only
+ HubStruck Notifications
+ A new message in your network
+ Oceanic Next has joined your network
+
+ 10:45 AM
+
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+ Sliding Item, Icons Start
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Icons End
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+ Sliding Item, Icons Top
+
+
+
+
+
+ More
+
+
+
+ Archive
+
+
+
+
+
- One Line, icon and text
+ Sliding Item, Icons Bottom
-
- More
+
+ More
+
+
+
+ Archive
+
+
+
+
+
+
+
+
+ Sliding Item, Anchor Icon Option
+
+
+
+
+
-
- Archive
+
+
+
+