-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(slides): update slides tests with new API and add new one
references #5508
- Loading branch information
1 parent
20feed0
commit 381a650
Showing
5 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {ViewChild} from 'angular2/core'; | ||
import {App, Slides} from 'ionic-angular'; | ||
|
||
|
||
@App({ | ||
templateUrl: 'main.html' | ||
}) | ||
class MyApp { | ||
mySlideOptions: any; | ||
@ViewChild(Slides) slider: Slides; | ||
|
||
constructor() { | ||
console.log("here"); | ||
this.mySlideOptions = { | ||
initialSlide: 1, | ||
autoplay: 1000 | ||
}; | ||
} | ||
|
||
ngAfterViewInit() { | ||
|
||
} | ||
|
||
onSlideChanged() { | ||
console.log("Slide Changed"); | ||
let isEnd = this.slider.isEnd(); | ||
console.log("This is the last slide?", isEnd); | ||
} | ||
|
||
goToPrevSlide() { | ||
this.slider.slidePrev(5000, false); | ||
} | ||
|
||
goToNextSlide() { | ||
this.slider.slideNext(); | ||
} | ||
|
||
goToSlide(index) { | ||
console.log(index); | ||
this.slider.slideTo(index, 500, false); | ||
} | ||
|
||
getIndex() { | ||
let index = this.slider.getActiveIndex(); | ||
console.log("Current Index is", index); | ||
} | ||
|
||
getLength() { | ||
let length = this.slider.length(); | ||
console.log("Current Length is", length); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<ion-slides [options]="mySlideOptions" (didChange)="onSlideChanged()"> | ||
<ion-slide padding> | ||
<p>Slide 1</p> | ||
<button block (click)="goToSlide(3)">Navigate to 3rd Slide</button> | ||
<button block (click)="getLength()">Get Slide Length</button> | ||
</ion-slide> | ||
<ion-slide padding> | ||
<p>Slide 2</p> | ||
<button block (click)="goToPrevSlide()">Navigate Back</button> | ||
<button block (click)="goToNextSlide()">Navigate Forward</button> | ||
</ion-slide> | ||
<ion-slide padding> | ||
<p>Slide 3</p> | ||
<button block (click)="getIndex()">Get Index</button> | ||
</ion-slide> | ||
</ion-slides> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters