@@ -105,6 +105,7 @@ import {
105105 PaginationControls ,
106106 ProvenanceBadge ,
107107 Readme ,
108+ ReadmeTocDropdown ,
108109 SettingsAccentColorPicker ,
109110 SettingsToggle ,
110111 TerminalExecute ,
@@ -1670,6 +1671,54 @@ describe('component accessibility audits', () => {
16701671 } )
16711672 } )
16721673
1674+ describe ( 'ReadmeTocDropdown' , ( ) => {
1675+ const mockToc = [
1676+ { text : 'Installation' , id : 'installation' , depth : 2 } ,
1677+ { text : 'Usage' , id : 'usage' , depth : 2 } ,
1678+ { text : 'Basic Usage' , id : 'basic-usage' , depth : 3 } ,
1679+ { text : 'Advanced Usage' , id : 'advanced-usage' , depth : 3 } ,
1680+ { text : 'API' , id : 'api' , depth : 2 } ,
1681+ ]
1682+
1683+ it ( 'should have no accessibility violations' , async ( ) => {
1684+ const component = await mountSuspended ( ReadmeTocDropdown , {
1685+ props : { toc : mockToc } ,
1686+ } )
1687+ const results = await runAxe ( component )
1688+ expect ( results . violations ) . toEqual ( [ ] )
1689+ } )
1690+
1691+ it ( 'should have no accessibility violations with active item' , async ( ) => {
1692+ const component = await mountSuspended ( ReadmeTocDropdown , {
1693+ props : {
1694+ toc : mockToc ,
1695+ activeId : 'usage' ,
1696+ } ,
1697+ } )
1698+ const results = await runAxe ( component )
1699+ expect ( results . violations ) . toEqual ( [ ] )
1700+ } )
1701+
1702+ it ( 'should have no accessibility violations with nested active item' , async ( ) => {
1703+ const component = await mountSuspended ( ReadmeTocDropdown , {
1704+ props : {
1705+ toc : mockToc ,
1706+ activeId : 'basic-usage' ,
1707+ } ,
1708+ } )
1709+ const results = await runAxe ( component )
1710+ expect ( results . violations ) . toEqual ( [ ] )
1711+ } )
1712+
1713+ it ( 'should have no accessibility violations with empty toc' , async ( ) => {
1714+ const component = await mountSuspended ( ReadmeTocDropdown , {
1715+ props : { toc : [ ] } ,
1716+ } )
1717+ const results = await runAxe ( component )
1718+ expect ( results . violations ) . toEqual ( [ ] )
1719+ } )
1720+ } )
1721+
16731722 describe ( 'HeaderSearchBox' , ( ) => {
16741723 it ( 'should have no accessibility violations' , async ( ) => {
16751724 const component = await mountSuspended ( HeaderSearchBox )
0 commit comments