Skip to content

Commit

Permalink
test(modal): add provider tests
Browse files Browse the repository at this point in the history
Related #7160
  • Loading branch information
adamdbradley committed Jul 2, 2016
1 parent e4bbcc6 commit da6215c
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions src/components/modal/test/basic/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
import { Component } from '@angular/core';
import { Component, Injectable } from '@angular/core';

import { ActionSheetController, Config, ionicBootstrap, ModalController, NavController, NavParams, PageTransition, Platform, TransitionOptions, ViewController } from '../../../../../src';


@Injectable()
class SomeComponentProvider {
constructor(private config: Config) {
console.log('SomeComponentProvider constructor')
}

getName() {
return 'Jenny';
}
}

@Injectable()
class SomeAppProvider {
constructor(private config: Config) {
console.log('SomeAppProvider constructor')
}

getData() {
return 'Some data';
}
}


@Component({
templateUrl: 'main.html'
})
Expand Down Expand Up @@ -145,16 +169,18 @@ class NavigableModal2 {
</ion-list>
<button full (click)="submit()">Submit</button>
</ion-content>
`
`,
providers: [SomeComponentProvider]
})
class ModalPassData {
data: any;

constructor(params: NavParams, private viewCtrl: ViewController) {
constructor(params: NavParams, private viewCtrl: ViewController, someComponentProvider: SomeComponentProvider, someAppProvider: SomeAppProvider) {
this.data = {
userId: params.get('userId'),
name: 'Jenny'
name: someComponentProvider.getName()
};
console.log('SomeAppProvider Data', someAppProvider.getData());
}

submit() {
Expand Down Expand Up @@ -472,7 +498,7 @@ class E2EApp {
root = E2EPage;
}

ionicBootstrap(E2EApp);
ionicBootstrap(E2EApp, [SomeAppProvider]);


class FadeIn extends PageTransition {
Expand Down

0 comments on commit da6215c

Please sign in to comment.