Skip to content

Commit

Permalink
Remove unneeded tab, tablist and aria-selected roles from navig…
Browse files Browse the repository at this point in the history
…ation

Signed-off-by: julia.kirschenheuter <[email protected]>
  • Loading branch information
JuliaKirschenheuter committed Jan 16, 2024
1 parent 91c44a3 commit e924548
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
7 changes: 2 additions & 5 deletions src/components/NcAppSettingsDialog/NcAppSettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,13 @@ export default {
<template v-if="hasNavigation" #navigation="{ isCollapsed }">
<ul v-if="!isCollapsed"
:aria-label="settingsNavigationAriaLabel"
class="navigation-list"
role="tablist">
class="navigation-list">
<li v-for="section in sections" :key="section.id">
<a :aria-selected="section.id === selectedSection"
:class="{
<a :class="{
'navigation-list__link': true,
'navigation-list__link--active': section.id === selectedSection,
'navigation-list__link--icon': hasNavigationIcons,
}"
role="tab"
tabindex="0"
@click="handleSettingsNavigationClick(section.id)"
@keydown.enter="handleSettingsNavigationClick(section.id)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ describe('NcAppSettingsDialog: Sections registration', () => {

await nextTick()

expect(wrapper.findAll('[role="tab"]')).toHaveLength(1)
expect(wrapper.find('[role="tab"]').text()).toBe('test_name')
expect(wrapper.findAll('.navigation-list__link')).toHaveLength(1)
expect(wrapper.find('.navigation-list__link').text()).toBe('test_name')
})

it('can register a new section', async () => {
Expand All @@ -70,8 +70,8 @@ describe('NcAppSettingsDialog: Sections registration', () => {

wrapper.vm.registerSection('test_id', 'test_name')
await nextTick()
expect(wrapper.findAll('[role="tab"]')).toHaveLength(1)
expect(wrapper.find('[role="tab"]').text()).toBe('test_name')
expect(wrapper.findAll('.navigation-list__link')).toHaveLength(1)
expect(wrapper.find('.navigation-list__link').text()).toBe('test_name')
})

it('warn on register a already registered section name', async () => {
Expand All @@ -89,13 +89,13 @@ describe('NcAppSettingsDialog: Sections registration', () => {
// First call should be OK
wrapper.vm.registerSection('test_id', 'test_name')
await nextTick()
expect(wrapper.findAll('[role="tab"]')).toHaveLength(1)
expect(wrapper.findAll('.navigation-list__link')).toHaveLength(1)
expect(spy).not.toHaveBeenCalled()

// Second one should unregister first and replace with this one, but show an error
wrapper.vm.registerSection('test_id_2', 'test_name')
await nextTick()
expect(wrapper.findAll('[role="tab"]')).toHaveLength(2)
expect(wrapper.findAll('.navigation-list__link')).toHaveLength(2)
expect(spy).toHaveBeenCalled()
})

Expand All @@ -111,12 +111,12 @@ describe('NcAppSettingsDialog: Sections registration', () => {
// First call should be OK
wrapper.vm.registerSection('test_id', 'test_name')
await nextTick()
expect(wrapper.findAll('[role="tab"]')).toHaveLength(1)
expect(wrapper.findAll('.navigation-list__link')).toHaveLength(1)

// Second one should unregister first and replace with this one, but show an error
expect(() => wrapper.vm.registerSection('test_id', 'test_other_name')).toThrow()
await nextTick()
expect(wrapper.findAll('[role="tab"]')).toHaveLength(1)
expect(wrapper.findAll('.navigation-list__link')).toHaveLength(1)
})

it('can unregister a section', async () => {
Expand All @@ -131,11 +131,11 @@ describe('NcAppSettingsDialog: Sections registration', () => {
wrapper.vm.registerSection('test_id', 'test_name')
wrapper.vm.registerSection('test_id2', 'test_name2')
await nextTick()
expect(wrapper.findAll('[role="tab"]')).toHaveLength(2)
expect(wrapper.findAll('.navigation-list__link')).toHaveLength(2)

wrapper.vm.unregisterSection('test_id')
await nextTick()
expect(wrapper.findAll('[role="tab"]')).toHaveLength(1)
expect(wrapper.find('[role="tab"]').text()).toBe('test_name2')
expect(wrapper.findAll('.navigation-list__link')).toHaveLength(1)
expect(wrapper.find('.navigation-list__link').text()).toBe('test_name2')
})
})

0 comments on commit e924548

Please sign in to comment.