Skip to content

Commit ae392e2

Browse files
committed
test(slides): update slide tests to use options instead of attributes
references #5189
1 parent d21ae88 commit ae392e2

File tree

7 files changed

+25
-23
lines changed

7 files changed

+25
-23
lines changed

ionic/components/slides/test/basic/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class MyApp {
99
this.app = app;
1010
this.http = http;
1111

12-
this.extraOptions = {
12+
this.mySlideOptions = {
1313
loop: true
1414
};
1515

ionic/components/slides/test/basic/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<ion-slides [options]="extraOptions" id="slider" style="background-color: black" zoom>
1+
<ion-slides [options]="mySlideOptions" id="slider" style="background-color: black">
22
<ion-slide *ngFor="#image of images">
33
<img data-src="{{getImageUrl(image)}}" slide-lazy>
44
</ion-slide>

ionic/components/slides/test/intro/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {App, Page, NavController} from 'ionic/ionic';
55
template: '<ion-nav [root]="rootPage"></ion-nav>'
66
})
77
class MyApp {
8+
rootPage;
9+
810
constructor() {
911
this.rootPage = IntroPage;
1012
}
@@ -15,9 +17,18 @@ class MyApp {
1517
})
1618
class IntroPage {
1719
continueText: string = "Skip";
20+
startingIndex: number = 1;
21+
mySlideOptions;
1822

19-
constructor(public nav: NavController) {
23+
constructor(nav: NavController) {
24+
this.nav = nav;
2025

26+
this.mySlideOptions = {
27+
paginationClickable: true,
28+
lazyLoading: true,
29+
preloadImages: false,
30+
initialSlide: this.startingIndex
31+
};
2132
}
2233

2334
onSlideChanged(slider) {

ionic/components/slides/test/intro/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</ion-navbar>
99

1010
<ion-content>
11-
<ion-slides pager (change)="onSlideChanged($event)" (slideChangeStart)="onSlideChangeStart($event)" (move)="onSlideMove($event)" loop="true">
11+
<ion-slides pager [options]="mySlideOptions" (change)="onSlideChanged($event)" (slideChangeStart)="onSlideChangeStart($event)" (move)="onSlideMove($event)">
1212
<ion-slide>
1313
<h3>Thank you for choosing the Awesome App!</h3>
1414
<div id="logo">

ionic/components/slides/test/loop/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ class MyApp {
2323
];
2424

2525
this.startingIndex = 2;
26+
27+
this.myTopSlideOptions = {
28+
index: this.startingIndex,
29+
loop: true
30+
};
2631
}
2732

2833
onSlideChanged(slider) {

ionic/components/slides/test/loop/main.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="slides-div">
2-
<ion-slides [index]="startingIndex" loop="true" id="loopSlider" (change)="onSlideChanged($event)" pager>
2+
<ion-slides [options]="myTopSlideOptions" id="loopSlider" (change)="onSlideChanged($event)" pager>
33
<ion-slide *ngFor="#slide of slides" [ngClass]="slide.class">
44
Loop {{ slide.name }}
55
</ion-slide>
@@ -8,7 +8,7 @@
88

99

1010
<div class="slides-div">
11-
<ion-slides loop="false" id="loopSlider" (change)="onSlideChanged($event)" pager>
11+
<ion-slides (change)="onSlideChanged($event)" pager>
1212
<ion-slide *ngFor="#slide of slides" [ngClass]="slide.class">
1313
Don't Loop {{ slide.name }}
1414
</ion-slide>

ionic/components/slides/test/scroll/main.html

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
<div style="height: 300px">
88
<ion-slides pager="true">
9-
<ion-slide class="yellow">Slide 1</ion-slide>
10-
<ion-slide class="blue">Slide 2</ion-slide>
11-
<ion-slide class="red">Slide 3</ion-slide>
9+
<ion-slide style="background-color: yellow">Slide 1</ion-slide>
10+
<ion-slide style="background-color: blue">Slide 2</ion-slide>
11+
<ion-slide style="background-color: red">Slide 3</ion-slide>
1212
</ion-slides>
1313
</div>
1414
<ion-list>
@@ -18,17 +18,3 @@
1818
</ion-list>
1919

2020
</ion-content>
21-
22-
<style>
23-
.yellow {
24-
background-color: yellow;
25-
}
26-
27-
.blue {
28-
background-color: blue;
29-
}
30-
31-
.red {
32-
background-color: red;
33-
}
34-
</style>

0 commit comments

Comments
 (0)