@@ -46,14 +46,27 @@ describe('getRole', function () {
4646 expect ( getRole ( { } , node ) ) . to . equal ( 'link' )
4747 } )
4848
49- it ( 'returns link role for <Foo> with polymorphic prop set to "a" and href' , function ( ) {
49+ it ( 'returns link role for <Foo> with polymorphic prop set to "a" and conditional href' , function ( ) {
5050 const node = mockJSXOpeningElement ( 'Foo' , [
5151 mockJSXAttribute ( 'as' , 'a' ) ,
52- [ mockJSXConditionalAttribute ( 'href' , 'getUrl' , '#' , 'https://github.com/' ) ] ,
52+ mockJSXConditionalAttribute ( 'href' , 'getUrl' , '#' , 'https://github.com/' ) ,
5353 ] )
5454 expect ( getRole ( { } , node ) ) . to . equal ( 'link' )
5555 } )
5656
57+ it ( 'returns link role for <Foo> with polymorphic prop set to "a" and literal href' , function ( ) {
58+ const node = mockJSXOpeningElement ( 'Foo' , [
59+ mockJSXAttribute ( 'as' , 'a' ) ,
60+ mockJSXAttribute ( 'href' , 'https://github.com/' ) ,
61+ ] )
62+ expect ( getRole ( { } , node ) ) . to . equal ( 'link' )
63+ } )
64+
65+ it ( 'returns generic role for <Foo> with polymorphic prop set to "a" and no href' , function ( ) {
66+ const node = mockJSXOpeningElement ( 'Foo' , [ mockJSXAttribute ( 'as' , 'a' ) ] )
67+ expect ( getRole ( { } , node ) ) . to . equal ( 'generic' )
68+ } )
69+
5770 it ( 'returns region role for <section> with aria-label' , function ( ) {
5871 const node = mockJSXOpeningElement ( 'section' , [ mockJSXAttribute ( 'aria-label' , 'something' ) ] )
5972 expect ( getRole ( { } , node ) ) . to . equal ( 'region' )
0 commit comments