From 14d29e687e59bf587415c9846b49914233c9080c Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Wed, 8 Jun 2016 23:58:03 +0200 Subject: [PATCH] fix(item): sliding item supports dynamic options + tests Closes #5192 --- src/components/item/item-sliding.ts | 4 +- src/components/item/test/sliding/index.ts | 20 ++++--- src/components/item/test/sliding/main.html | 61 +++++++++++----------- 3 files changed, 45 insertions(+), 40 deletions(-) diff --git a/src/components/item/item-sliding.ts b/src/components/item/item-sliding.ts index 44b1e6824f4..4b835a2da71 100644 --- a/src/components/item/item-sliding.ts +++ b/src/components/item/item-sliding.ts @@ -224,9 +224,9 @@ export class ItemSliding { */ startSliding(startX: number) { if (this._openAmount === 0) { - this._optsDirty = true; this._setState(SlidingState.Enabled); } + this._optsDirty = true; this._startX = startX + this._openAmount; this.item.setCssStyle(CSS.transition, 'none'); } @@ -290,9 +290,11 @@ export class ItemSliding { calculateOptsWidth() { if (this._optsDirty) { + this._optsWidthRightSide = 0; if (this._rightOptions) { this._optsWidthRightSide = this._rightOptions.width(); } + this._optsWidthLeftSide = 0; if (this._leftOptions) { this._optsWidthLeftSide = this._leftOptions.width(); } diff --git a/src/components/item/test/sliding/index.ts b/src/components/item/test/sliding/index.ts index df490975e01..b6dcd8863c0 100644 --- a/src/components/item/test/sliding/index.ts +++ b/src/components/item/test/sliding/index.ts @@ -9,10 +9,10 @@ class E2EPage { @ViewChild('myList', {read: List}) list: List; items: number[] = []; - shouldShow: boolean = true; + slidingEnabled: boolean = true; - moreText: string = "Dynamic More"; - archiveText: string = "Dynamic Archive"; + moreText: string = 'Dynamic More'; + archiveText: string = 'Dynamic Archive'; constructor(private app: App, private nav: NavController) { for (let x = 0; x < 5; x++) { @@ -20,13 +20,17 @@ class E2EPage { } } + toggleSliding() { + this.slidingEnabled = !this.slidingEnabled; + } + changeDynamic() { - if (this.moreText.includes("Dynamic")) { - this.moreText = "Changed More"; - this.archiveText = "Changed Archive"; + if (this.moreText.includes('Dynamic')) { + this.moreText = 'Changed More'; + this.archiveText = 'Changed Archive'; } else { - this.moreText = "Dynamic More"; - this.archiveText = "Dynamic Archive"; + this.moreText = 'Dynamic More'; + this.archiveText = 'Dynamic Archive'; } } diff --git a/src/components/item/test/sliding/main.html b/src/components/item/test/sliding/main.html index ee30fa3d61a..c7a73e7b697 100644 --- a/src/components/item/test/sliding/main.html +++ b/src/components/item/test/sliding/main.html @@ -7,17 +7,21 @@ - +
+ + + +
- - - - - + + + @@ -26,25 +30,25 @@

RIGHT side - no icons

LEFT side - no icons

I think I figured out how to get more Mountain Dew

- + - +

RIGHT/LEFT side - icons

I think I figured out how to get more Mountain Dew

- + - + @@ -55,12 +59,12 @@

RIGHT/LEFT side - icons

- +

RIGHT/LEFT side - icons (item-left)

I think I figured out how to get more Mountain Dew

- + @@ -70,7 +74,7 @@

RIGHT/LEFT side - icons (item-left)

-
@@ -83,14 +87,14 @@

RIGHT/LEFT side - icons (item-left)

One Line w/ Icon, div only text -
- + @@ -110,7 +114,7 @@

RIGHT/LEFT side - icons (item-left)

- + One Line, dynamic option @@ -119,14 +123,14 @@

RIGHT/LEFT side - icons (item-left)

{{ moreText }} -
- + One Line, dynamic icon-left option @@ -135,14 +139,14 @@

RIGHT/LEFT side - icons (item-left)

{{ moreText }} -
- + @@ -151,10 +155,10 @@

DOWNLOAD

Paragraph text.

- - @@ -186,22 +190,17 @@

Normal button (no sliding)

- +

ng-for {{data}}

- +
-
- - -
-