@@ -1859,6 +1859,48 @@ function declareTests() {
18591859 } ) ) ;
18601860
18611861 } ) ;
1862+
1863+ describe ( 'attributes' , ( ) => {
1864+
1865+ it ( 'should support attributes with namespace' ,
1866+ inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder ,
1867+ async ) => {
1868+ tcb . overrideView ( SomeCmp , new ViewMetadata ( { template : '<svg:use xlink:href="#id" />' } ) )
1869+ . createAsync ( SomeCmp )
1870+ . then ( ( fixture ) => {
1871+ let useEl = DOM . firstChild ( fixture . debugElement . nativeElement ) ;
1872+ expect ( DOM . getAttributeNS ( useEl , 'http://www.w3.org/1999/xlink' , 'href' ) )
1873+ . toEqual ( '#id' ) ;
1874+ async . done ( ) ;
1875+ } ) ;
1876+ } ) ) ;
1877+
1878+ it ( 'should support binding to attributes with namespace' ,
1879+ inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder ,
1880+ async ) => {
1881+ tcb . overrideView ( SomeCmp ,
1882+ new ViewMetadata ( { template : '<svg:use [attr.xlink:href]="value" />' } ) )
1883+ . createAsync ( SomeCmp )
1884+ . then ( ( fixture ) => {
1885+ let cmp = fixture . debugElement . componentInstance ;
1886+ let useEl = DOM . firstChild ( fixture . debugElement . nativeElement ) ;
1887+
1888+ cmp . value = "#id" ;
1889+ fixture . detectChanges ( ) ;
1890+
1891+ expect ( DOM . getAttributeNS ( useEl , 'http://www.w3.org/1999/xlink' , 'href' ) )
1892+ . toEqual ( '#id' ) ;
1893+
1894+ cmp . value = null ;
1895+ fixture . detectChanges ( ) ;
1896+
1897+ expect ( DOM . hasAttributeNS ( useEl , 'http://www.w3.org/1999/xlink' , 'href' ) )
1898+ . toEqual ( false ) ;
1899+
1900+ async . done ( ) ;
1901+ } ) ;
1902+ } ) ) ;
1903+ } ) ;
18621904 }
18631905 } ) ;
18641906}
@@ -2438,3 +2480,8 @@ class DirectiveWithPropDecorators {
24382480
24392481 fireEvent ( msg ) { ObservableWrapper . callEmit ( this . event , msg ) ; }
24402482}
2483+
2484+ @Component ( { selector : 'some-cmp' } )
2485+ class SomeCmp {
2486+ value : any ;
2487+ }
0 commit comments