#3 EVEN MORE TESTS!

Открыто
DavidThornley хочет смерджить 3 коммит(ов) из DavidThornley/ZipFlash:master в master
5 измененных файлов: 1165 добавлений и 1150 удалений
  1. 1145
    1145
      package-lock.json
  2. 2
    1
      src/pages/home/home.html
  3. 6
    3
      src/pages/home/home.ts
  4. 11
    1
      src/providers/flash-cards/flash-cards.ts
  5. 1
    0
      test.txt

+ 1145
- 1145
package-lock.json
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 2
- 1
src/pages/home/home.html Просмотреть файл

10
     <button ion-button color="secondary" (click)='reset();'>Reset</button>
10
     <button ion-button color="secondary" (click)='reset();'>Reset</button>
11
     <button ion-button color="secondary" (click)='next();'>Next >></button>
11
     <button ion-button color="secondary" (click)='next();'>Next >></button>
12
     <button ion-button color="secondary" (click)='randomize();'> Random! </button>
12
     <button ion-button color="secondary" (click)='randomize();'> Random! </button>
13
+
13
   <ion-slides #slides *ngIf="cardSupply && cardSupply.length" (ionSlideDidChange)="slideChanged()" (ionSlideNextEnd)="nextSlide()" (ionSlidePrevEnd)="prevSlide()"
14
   <ion-slides #slides *ngIf="cardSupply && cardSupply.length" (ionSlideDidChange)="slideChanged()" (ionSlideNextEnd)="nextSlide()" (ionSlidePrevEnd)="prevSlide()"
14
     [initialSlide]="0">
15
     [initialSlide]="0">
15
 		<ion-slide *ngFor="let current of cardSupply">
16
 		<ion-slide *ngFor="let current of cardSupply">
16
       <flash-card>
17
       <flash-card>
17
-        <div class="flash-card-front">{{current.front}}</div>
18
+        <div class="flash-card-front">{{currentIndex}} <br/><br/><br/> {{current.front}}</div>
18
         <div class="flash-card-back">{{current.back}}</div>
19
         <div class="flash-card-back">{{current.back}}</div>
19
       </flash-card>
20
       </flash-card>
20
     </ion-slide>
21
     </ion-slide>

+ 6
- 3
src/pages/home/home.ts Просмотреть файл

11
   @ViewChild(Slides) slides: Slides;
11
   @ViewChild(Slides) slides: Slides;
12
 
12
 
13
   currentCard = {
13
   currentCard = {
14
-    front: "Hello0",
14
+    front: "Hello",
15
     back: "World!"
15
     back: "World!"
16
   };
16
   };
17
   cardSupply: any;
17
   cardSupply: any;
18
   prov: any;
18
   prov: any;
19
-  currentIndex = 0;
20
-
19
+  currentIndex = 1;
21
   constructor(public navCtrl: NavController, supply: FlashCardsProvider) {
20
   constructor(public navCtrl: NavController, supply: FlashCardsProvider) {
22
     this.prov = supply;
21
     this.prov = supply;
23
     this.cardSupply = supply.allCards();
22
     this.cardSupply = supply.allCards();
32
 
31
 
33
   nextSlide() {
32
   nextSlide() {
34
     // ready for more functionality
33
     // ready for more functionality
34
+    this.currentIndex = this.slides.getActiveIndex() + 1;
35
   }
35
   }
36
 
36
 
37
   prevSlide() {
37
   prevSlide() {
38
     // ready for more functionality
38
     // ready for more functionality
39
+    this.currentIndex = this.slides.getActiveIndex() + 1;
39
   }
40
   }
40
 
41
 
41
   reset() {
42
   reset() {
42
     this.navCtrl.setRoot(this.navCtrl.getActive().component);
43
     this.navCtrl.setRoot(this.navCtrl.getActive().component);
44
+    this.currentIndex = 1;
43
   }
45
   }
44
   next() {
46
   next() {
45
     let idx = this.slides.getActiveIndex() + 1;
47
     let idx = this.slides.getActiveIndex() + 1;
48
+    this.currentIndex= idx;
46
     this.slides.slideTo(idx, 500);
49
     this.slides.slideTo(idx, 500);
47
   }
50
   }
48
 
51
 

+ 11
- 1
src/providers/flash-cards/flash-cards.ts Просмотреть файл

32
       }
32
       }
33
       });
33
       });
34
   }
34
   }
35
-
35
+  startsWith(letter:string){
36
+    var cardIndex = 0;
37
+    for (let index = 0; index < this.defaultCards.length; index++) {
38
+      const element = this.defaultCards[index];
39
+      if(element.startsWith(letter)){
40
+        cardIndex = index;
41
+        break;
42
+      }
43
+      return this.defaultCards[cardIndex];
44
+    }
45
+  }
36
   cardFor(cardindex) {
46
   cardFor(cardindex) {
37
     this.idx = cardindex % this.defaultCards.length;
47
     this.idx = cardindex % this.defaultCards.length;
38
     return this.defaultCards[this.idx];
48
     return this.defaultCards[this.idx];

+ 1
- 0
test.txt Просмотреть файл

1
+fhgjo;kasbfhjuasjkvnfjkhadshvcljbzxclkvbkzjxn