1
1
//make sure you import mocha-config before @angular/core
2
- import { assert } from "./test-config" ;
3
- import { Component , ElementRef } from "@angular/core" ;
4
- import { ProxyViewContainer } from "ui/proxy-view-container" ;
5
- import { dumpView , createDevice } from "./test-utils" ;
6
- import { TestApp } from "./test-app" ;
7
- import { DEVICE } from "nativescript-angular/platform-providers" ;
8
- import { platformNames } from "platform" ;
2
+ import { assert } from "./test-config" ;
3
+ import { Component , ElementRef } from "@angular/core" ;
4
+ import { dumpView , createDevice } from "./test-utils" ;
5
+ import { TestApp } from "./test-app" ;
6
+ import { DEVICE } from "nativescript-angular/platform-providers" ;
7
+ import { platformNames } from "platform" ;
9
8
10
9
@Component ( {
11
10
template : `
@@ -37,12 +36,12 @@ export class PlatformSpecificAttributeComponent {
37
36
constructor ( public elementRef : ElementRef ) { }
38
37
}
39
38
40
- describe ( 'Platofrm filter directives' , ( ) => {
39
+ describe ( 'Platform filter directives' , ( ) => {
41
40
describe ( 'on IOS device' , ( ) => {
42
41
let testApp : TestApp = null ;
43
42
44
43
before ( ( ) => {
45
- return TestApp . create ( [ { provide : DEVICE , useValue : createDevice ( platformNames . ios ) } ] , [ PlatformSpecificAttributeComponent , AndroidSpecificComponent , IosSpecificComponent ] ) . then ( ( app ) => {
44
+ return TestApp . create ( [ { provide : DEVICE , useValue : createDevice ( platformNames . ios ) } ] , [ PlatformSpecificAttributeComponent , AndroidSpecificComponent , IosSpecificComponent ] ) . then ( ( app ) => {
46
45
testApp = app ;
47
46
} ) ;
48
47
} ) ;
@@ -51,21 +50,17 @@ describe('Platofrm filter directives', () => {
51
50
testApp . dispose ( ) ;
52
51
} ) ;
53
52
54
- it ( "does render ios sepecific conternt " , ( ) => {
53
+ it ( "does render ios specific content " , ( ) => {
55
54
return testApp . loadComponent ( IosSpecificComponent ) . then ( ( componentRef ) => {
56
55
const componentRoot = componentRef . instance . elementRef . nativeElement ;
57
- assert . equal (
58
- "(ProxyViewContainer (StackLayout (ProxyViewContainer (template), (Label[text=IOS]))))" ,
59
- dumpView ( componentRoot , true ) ) ;
56
+ assert . isTrue ( dumpView ( componentRoot , true ) . indexOf ( "(Label[text=IOS])" ) >= 0 ) ;
60
57
} ) ;
61
58
} ) ;
62
59
63
- it ( "does not render android sepecific conternt " , ( ) => {
60
+ it ( "does not render android specific content " , ( ) => {
64
61
return testApp . loadComponent ( AndroidSpecificComponent ) . then ( ( componentRef ) => {
65
62
const componentRoot = componentRef . instance . elementRef . nativeElement ;
66
- assert . equal (
67
- "(ProxyViewContainer (StackLayout (ProxyViewContainer (template))))" ,
68
- dumpView ( componentRoot , true ) ) ;
63
+ assert . isTrue ( dumpView ( componentRoot , true ) . indexOf ( "Label" ) < 0 ) ;
69
64
} ) ;
70
65
} ) ;
71
66
@@ -84,7 +79,7 @@ describe('Platofrm filter directives', () => {
84
79
let testApp : TestApp = null ;
85
80
86
81
before ( ( ) => {
87
- return TestApp . create ( [ { provide : DEVICE , useValue : createDevice ( platformNames . android ) } ] , [ AndroidSpecificComponent , IosSpecificComponent , PlatformSpecificAttributeComponent ] ) . then ( ( app ) => {
82
+ return TestApp . create ( [ { provide : DEVICE , useValue : createDevice ( platformNames . android ) } ] , [ AndroidSpecificComponent , IosSpecificComponent , PlatformSpecificAttributeComponent ] ) . then ( ( app ) => {
88
83
testApp = app ;
89
84
} ) ;
90
85
} ) ;
@@ -93,21 +88,17 @@ describe('Platofrm filter directives', () => {
93
88
testApp . dispose ( ) ;
94
89
} ) ;
95
90
96
- it ( "does render android sepecific conternt " , ( ) => {
91
+ it ( "does render android specific content " , ( ) => {
97
92
return testApp . loadComponent ( AndroidSpecificComponent ) . then ( ( componentRef ) => {
98
93
const componentRoot = componentRef . instance . elementRef . nativeElement ;
99
- assert . equal (
100
- "(ProxyViewContainer (StackLayout (ProxyViewContainer (template), (Label[text=ANDROID]))))" ,
101
- dumpView ( componentRoot , true ) ) ;
94
+ assert . isTrue ( dumpView ( componentRoot , true ) . indexOf ( "(Label[text=ANDROID])" ) >= 0 ) ;
102
95
} ) ;
103
96
} ) ;
104
97
105
- it ( "does not render ios sepecific conternt " , ( ) => {
98
+ it ( "does not render ios specific content " , ( ) => {
106
99
return testApp . loadComponent ( IosSpecificComponent ) . then ( ( componentRef ) => {
107
100
const componentRoot = componentRef . instance . elementRef . nativeElement ;
108
- assert . equal (
109
- "(ProxyViewContainer (StackLayout (ProxyViewContainer (template))))" ,
110
- dumpView ( componentRoot , true ) ) ;
101
+ assert . isTrue ( dumpView ( componentRoot , true ) . indexOf ( "Label" ) < 0 ) ;
111
102
} ) ;
112
103
} ) ;
113
104
0 commit comments