@@ -1848,7 +1848,7 @@ function declareTests() {
18481848
18491849 if ( ! IS_DART ) {
18501850 var firstAttribute = DOM . getProperty ( < Element > use , 'attributes' ) [ 0 ] ;
1851- expect ( firstAttribute . name ) . toEqual ( 'xlink: href' ) ;
1851+ expect ( firstAttribute . name ) . toEqual ( 'href' ) ;
18521852 expect ( firstAttribute . namespaceURI ) . toEqual ( 'http://www.w3.org/1999/xlink' ) ;
18531853 } else {
18541854 // For Dart where '_Attr' has no instance getter 'namespaceURI'
@@ -1860,6 +1860,48 @@ function declareTests() {
18601860 } ) ) ;
18611861
18621862 } ) ;
1863+
1864+ describe ( 'attributes' , ( ) => {
1865+
1866+ it ( 'should support attributes with namespace' ,
1867+ inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder ,
1868+ async ) => {
1869+ tcb . overrideView ( SomeCmp , new ViewMetadata ( { template : '<svg:use xlink:href="#id" />' } ) )
1870+ . createAsync ( SomeCmp )
1871+ . then ( ( fixture ) => {
1872+ let useEl = DOM . firstChild ( fixture . debugElement . nativeElement ) ;
1873+ expect ( DOM . getAttributeNS ( useEl , 'http://www.w3.org/1999/xlink' , 'href' ) )
1874+ . toEqual ( '#id' ) ;
1875+ async . done ( ) ;
1876+ } ) ;
1877+ } ) ) ;
1878+
1879+ it ( 'should support binding to attributes with namespace' ,
1880+ inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder ,
1881+ async ) => {
1882+ tcb . overrideView ( SomeCmp ,
1883+ new ViewMetadata ( { template : '<svg:use [attr.xlink:href]="value" />' } ) )
1884+ . createAsync ( SomeCmp )
1885+ . then ( ( fixture ) => {
1886+ let cmp = fixture . debugElement . componentInstance ;
1887+ let useEl = DOM . firstChild ( fixture . debugElement . nativeElement ) ;
1888+
1889+ cmp . value = "#id" ;
1890+ fixture . detectChanges ( ) ;
1891+
1892+ expect ( DOM . getAttributeNS ( useEl , 'http://www.w3.org/1999/xlink' , 'href' ) )
1893+ . toEqual ( '#id' ) ;
1894+
1895+ cmp . value = null ;
1896+ fixture . detectChanges ( ) ;
1897+
1898+ expect ( DOM . hasAttributeNS ( useEl , 'http://www.w3.org/1999/xlink' , 'href' ) )
1899+ . toEqual ( false ) ;
1900+
1901+ async . done ( ) ;
1902+ } ) ;
1903+ } ) ) ;
1904+ } ) ;
18631905 }
18641906 } ) ;
18651907}
@@ -2439,3 +2481,8 @@ class DirectiveWithPropDecorators {
24392481
24402482 fireEvent ( msg ) { ObservableWrapper . callEmit ( this . event , msg ) ; }
24412483}
2484+
2485+ @Component ( { selector : 'some-cmp' } )
2486+ class SomeCmp {
2487+ value : any ;
2488+ }
0 commit comments