mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
test(angular): add tests for ngOnInit
This commit is contained in:
committed by
Manu MA
parent
c8d9685bc9
commit
7698c31790
@@ -1,14 +1,15 @@
|
||||
import { Component, Input, NgZone } from '@angular/core';
|
||||
import { Component, Input, NgZone, OnInit } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-modal-example',
|
||||
templateUrl: './modal-example.component.html',
|
||||
})
|
||||
export class ModalExampleComponent {
|
||||
export class ModalExampleComponent implements OnInit {
|
||||
|
||||
@Input() value: string;
|
||||
|
||||
onInit = 0;
|
||||
willEnter = 0;
|
||||
didEnter = 0;
|
||||
willLeave = 0;
|
||||
@@ -18,6 +19,11 @@ export class ModalExampleComponent {
|
||||
private modalCtrl: ModalController
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
NgZone.assertInAngularZone();
|
||||
this.onInit++;
|
||||
}
|
||||
|
||||
ionViewWillEnter() {
|
||||
NgZone.assertInAngularZone();
|
||||
this.willEnter++;
|
||||
|
||||
Reference in New Issue
Block a user