@@ -27,15 +27,24 @@ export class AndroidSpecificComponent {
2727 constructor ( public elementRef : ElementRef ) { }
2828}
2929
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+ }
3039
31- describe ( 'Platofrm filter components ' , ( ) => {
40+ describe ( 'Platofrm filter directives ' , ( ) => {
3241 describe ( 'on IOS device' , ( ) => {
3342 let testApp : TestApp = null ;
3443
3544 before ( ( ) => {
3645 return TestApp . create ( [ provide ( DEVICE , { useValue : createDevice ( platformNames . ios ) } ) ] ) . then ( ( app ) => {
3746 testApp = app ;
38- } )
47+ } ) ;
3948 } ) ;
4049
4150 after ( ( ) => {
@@ -59,15 +68,25 @@ describe('Platofrm filter components', () => {
5968 dumpView ( componentRoot , true ) ) ;
6069 } ) ;
6170 } ) ;
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+ } ) ;
6382
6483 describe ( 'on Android device' , ( ) => {
6584 let testApp : TestApp = null ;
6685
6786 before ( ( ) => {
6887 return TestApp . create ( [ provide ( DEVICE , { useValue : createDevice ( platformNames . android ) } ) ] ) . then ( ( app ) => {
6988 testApp = app ;
70- } )
89+ } ) ;
7190 } ) ;
7291
7392 after ( ( ) => {
@@ -91,5 +110,14 @@ describe('Platofrm filter components', () => {
91110 dumpView ( componentRoot , true ) ) ;
92111 } ) ;
93112 } ) ;
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