@@ -12,7 +12,7 @@ import {registerElement} from 'nativescript-angular/element-registry';
12
12
import * as button from 'tns-core-modules/ui/button' ;
13
13
import * as view from 'tns-core-modules/ui/core/view' ;
14
14
import { nTestBedAfterEach , nTestBedBeforeEach , nTestBedRender } from 'nativescript-angular/testing' ;
15
- import { ComponentFixture } from '@angular/core/testing' ;
15
+ import { ComponentFixture , TestBed } from '@angular/core/testing' ;
16
16
17
17
@Component ( {
18
18
template : `<StackLayout><Label text="Layout"></Label></StackLayout>`
@@ -243,7 +243,7 @@ export class NgForLabel {
243
243
}
244
244
}
245
245
246
- xdescribe ( "Renderer E2E" , ( ) => {
246
+ describe ( "Renderer E2E" , ( ) => {
247
247
beforeEach ( nTestBedBeforeEach ( [
248
248
LayoutWithLabel , LabelCmp , LabelContainer ,
249
249
ProjectableCmp , ProjectionContainer ,
@@ -315,7 +315,7 @@ xdescribe("Renderer E2E", () => {
315
315
done ( ) ;
316
316
} ;
317
317
318
- return nTestBedRender ( ZonedRenderer ) . then ( ( fixture : ComponentFixture < ZonedRenderer > ) => {
318
+ nTestBedRender ( ZonedRenderer ) . then ( ( fixture : ComponentFixture < ZonedRenderer > ) => {
319
319
fixture . ngZone . run ( ( ) => {
320
320
fixture . componentInstance . renderer . listen ( view , eventName , callback ) ;
321
321
} ) ;
@@ -338,7 +338,7 @@ xdescribe("Renderer E2E", () => {
338
338
assert . isTrue ( NgZone . isInAngularZone ( ) , "Event should be executed inside NgZone" ) ;
339
339
done ( ) ;
340
340
} ;
341
- return nTestBedRender ( ZonedRenderer ) . then ( ( fixture : ComponentFixture < ZonedRenderer > ) => {
341
+ nTestBedRender ( ZonedRenderer ) . then ( ( fixture : ComponentFixture < ZonedRenderer > ) => {
342
342
fixture . ngZone . runOutsideAngular ( ( ) => {
343
343
fixture . componentInstance . renderer . listen ( view , eventName , callback ) ;
344
344
@@ -609,6 +609,7 @@ describe("Renderer attach/detach", () => {
609
609
} ) ;
610
610
} ) ;
611
611
612
+ // TODO: I'm not sure about this lifecycle test.
612
613
xdescribe ( "Renderer lifecycle" , ( ) => {
613
614
let renderer : Renderer2 = null ;
614
615
beforeEach ( nTestBedBeforeEach ( [ ZonedRenderer , NgControlSettersCount ] ) ) ;
@@ -622,17 +623,17 @@ xdescribe("Renderer lifecycle", () => {
622
623
} ) ;
623
624
624
625
it ( "view native setters are called once on startup" , ( ) => {
625
- return nTestBedRender ( NgControlSettersCount ) . then ( ( fixture ) => {
626
- const componentRef : ComponentRef < NgControlSettersCount > = fixture . componentRef ;
627
- assert . isTrue ( componentRef . instance . isAfterViewInit , "Expected the NgControlSettersCount to have passed its ngAfterViewInit." ) ;
628
- componentRef . instance . buttons . map ( btn => btn . nativeElement ) . forEach ( btn => {
629
- assert . isTrue ( btn . isLoaded , `Expected ${ btn . id } to be allready loaded.` ) ;
630
- assert . isFalse ( btn . isLayoutValid , `Expected ${ btn . id } 's layout to be invalid .` ) ;
631
-
632
- assert . equal ( btn . backgroundInternalSetNativeCount , 1 , `Expected ${ btn . id } backgroundInternalSetNativeCount to be called just once.` ) ;
633
- assert . equal ( btn . fontInternalSetNativeCount , 1 , `Expected ${ btn . id } fontInternalSetNativeCount to be called just once.` ) ;
634
- assert . equal ( btn . nativeBackgroundRedraws , 0 , `Expected ${ btn . id } nativeBackgroundRedraws to be called after its layout pass .` ) ;
635
- } ) ;
626
+ const fixture = TestBed . createComponent ( NgControlSettersCount ) ;
627
+ fixture . detectChanges ( ) ;
628
+ const componentRef : ComponentRef < NgControlSettersCount > = fixture . componentRef ;
629
+ assert . isTrue ( componentRef . instance . isAfterViewInit , "Expected the NgControlSettersCount to have passed its ngAfterViewInit." ) ;
630
+ componentRef . instance . buttons . map ( btn => btn . nativeElement ) . forEach ( btn => {
631
+ assert . isTrue ( btn . isLoaded , `Expected ${ btn . id } to be allready loaded .` ) ;
632
+ assert . isFalse ( btn . isLayoutValid , `Expected ${ btn . id } 's layout to be invalid.` ) ;
633
+
634
+ assert . equal ( btn . backgroundInternalSetNativeCount , 1 , `Expected ${ btn . id } backgroundInternalSetNativeCount to be called just once.` ) ;
635
+ assert . equal ( btn . fontInternalSetNativeCount , 1 , `Expected ${ btn . id } fontInternalSetNativeCount to be called just once .` ) ;
636
+ assert . equal ( btn . nativeBackgroundRedraws , 0 , `Expected ${ btn . id } nativeBackgroundRedraws to be called after its layout pass.` ) ;
636
637
} ) ;
637
638
} ) ;
638
639
} ) ;
0 commit comments