@@ -106,4 +106,40 @@ describe('NavItem', function () {
106106 let linkElement = React . findDOMNode ( ReactTestUtils . findRenderedDOMComponentWithTag ( instance , 'a' ) ) ;
107107 assert . equal ( linkElement . outerHTML . match ( 'role="button"' ) , null ) ;
108108 } ) ;
109+
110+ describe ( 'Web Accessibility' , function ( ) {
111+
112+ it ( 'Should pass aria-controls to the link' , function ( ) {
113+ let instance = ReactTestUtils . renderIntoDocument (
114+ < NavItem href = "/path/to/stuff" target = "_blank" aria-controls = 'hi' > Item content</ NavItem >
115+ ) ;
116+
117+ let linkElement = React . findDOMNode ( ReactTestUtils . findRenderedDOMComponentWithTag ( instance , 'a' ) ) ;
118+
119+ assert . ok ( linkElement . hasAttribute ( 'aria-controls' ) ) ;
120+ } ) ;
121+
122+ it ( 'Should add aria-selected to the link' , function ( ) {
123+ let instance = ReactTestUtils . renderIntoDocument (
124+ < NavItem active > Item content</ NavItem >
125+ ) ;
126+
127+ let linkElement = React . findDOMNode (
128+ ReactTestUtils . findRenderedDOMComponentWithTag ( instance , 'a' ) ) ;
129+
130+ assert . equal ( linkElement . getAttribute ( 'aria-selected' ) , 'true' ) ;
131+ } ) ;
132+
133+ it ( 'Should pass role down' , function ( ) {
134+ let instance = ReactTestUtils . renderIntoDocument (
135+ < NavItem role = 'tab' > Item content</ NavItem >
136+ ) ;
137+
138+ let linkElement = React . findDOMNode (
139+ ReactTestUtils . findRenderedDOMComponentWithTag ( instance , 'a' ) ) ;
140+
141+ assert . equal ( linkElement . getAttribute ( 'role' ) , 'tab' ) ;
142+ } ) ;
143+ } ) ;
144+
109145} ) ;
0 commit comments