@@ -27,15 +27,24 @@ export class AndroidSpecificComponent {
27
27
constructor ( public elementRef : ElementRef ) { }
28
28
}
29
29
30
+ @Component ( {
31
+ template : `
32
+ <StackLayout>
33
+ <Label android:text="ANDROID" ios:text="IOS"></Label>
34
+ </StackLayout>`
35
+ } )
36
+ export class PlatformSpecificAttributeComponent {
37
+ constructor ( public elementRef : ElementRef ) { }
38
+ }
30
39
31
- describe ( 'Platofrm filter components ' , ( ) => {
40
+ describe ( 'Platofrm filter directives ' , ( ) => {
32
41
describe ( 'on IOS device' , ( ) => {
33
42
let testApp : TestApp = null ;
34
43
35
44
before ( ( ) => {
36
45
return TestApp . create ( [ provide ( DEVICE , { useValue : createDevice ( platformNames . ios ) } ) ] ) . then ( ( app ) => {
37
46
testApp = app ;
38
- } )
47
+ } ) ;
39
48
} ) ;
40
49
41
50
after ( ( ) => {
@@ -59,15 +68,25 @@ describe('Platofrm filter components', () => {
59
68
dumpView ( componentRoot , true ) ) ;
60
69
} ) ;
61
70
} ) ;
62
- } )
71
+
72
+
73
+ it ( "applies iOS specific attribute" , ( ) => {
74
+ return testApp . loadComponent ( PlatformSpecificAttributeComponent ) . then ( ( componentRef ) => {
75
+ const componentRoot = componentRef . instance . elementRef . nativeElement ;
76
+ assert . equal (
77
+ "(ProxyViewContainer (StackLayout (Label[text=IOS])))" ,
78
+ dumpView ( componentRoot , true ) ) ;
79
+ } ) ;
80
+ } ) ;
81
+ } ) ;
63
82
64
83
describe ( 'on Android device' , ( ) => {
65
84
let testApp : TestApp = null ;
66
85
67
86
before ( ( ) => {
68
87
return TestApp . create ( [ provide ( DEVICE , { useValue : createDevice ( platformNames . android ) } ) ] ) . then ( ( app ) => {
69
88
testApp = app ;
70
- } )
89
+ } ) ;
71
90
} ) ;
72
91
73
92
after ( ( ) => {
@@ -91,5 +110,14 @@ describe('Platofrm filter components', () => {
91
110
dumpView ( componentRoot , true ) ) ;
92
111
} ) ;
93
112
} ) ;
94
- } )
95
- } )
113
+
114
+ it ( "applies Android specific attribute" , ( ) => {
115
+ return testApp . loadComponent ( PlatformSpecificAttributeComponent ) . then ( ( componentRef ) => {
116
+ const componentRoot = componentRef . instance . elementRef . nativeElement ;
117
+ assert . equal (
118
+ "(ProxyViewContainer (StackLayout (Label[text=ANDROID])))" ,
119
+ dumpView ( componentRoot , true ) ) ;
120
+ } ) ;
121
+ } ) ;
122
+ } ) ;
123
+ } ) ;
0 commit comments