Skip to content

Commit

Permalink
fix(NcAppSidebarTabs): Tests
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Oct 18, 2023
1 parent 4d68864 commit 3dc8ba3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/unit/components/NcAppSidebar/NcAppSidebarTabs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,17 @@ describe('NcAppSidebarTabs.vue', () => {
expect(liList.length).toEqual(3)
})
it('emit "update:active" event with the selected tab id when clicking on a tab', () => {
const lastLink = wrapper.find('div[role="tablist"]>.checkbox-radio-switch:last-of-type>label')
const lastLink = wrapper.find('div[role="tablist"]>button.checkbox-radio-switch:last-of-type')
lastLink.trigger('click')
expect(wrapper.emitted('update:active')[0]).toEqual(['last'])
})
it('emit "update:active" event with the first tab id when keydown pageup is pressed', () => {
const lastLink = wrapper.find('div[role="tablist"]>.checkbox-radio-switch:last-of-type>label')
const lastLink = wrapper.find('div[role="tablist"]>button.checkbox-radio-switch:last-of-type')
lastLink.trigger('keydown.pageup')
expect(wrapper.emitted('update:active')[0]).toEqual(['first'])
})
it('emit "update:active" event with the last tab id when keydown pagedown is pressed', () => {
const lastLink = wrapper.find('div[role="tablist"]>.checkbox-radio-switch:last-of-type>label')
const lastLink = wrapper.find('div[role="tablist"]>button.checkbox-radio-switch:last-of-type')
lastLink.trigger('keydown.pagedown')
expect(wrapper.emitted('update:active')[0]).toEqual(['last'])
})
Expand All @@ -141,12 +141,12 @@ describe('NcAppSidebarTabs.vue', () => {
})
it('does not emit "update:active" event when keydown left is pressed', () => {
expect(wrapper.emitted('update:active')).toBeFalsy()
const firstLink = wrapper.find('div[role="tablist"]>.checkbox-radio-switch>label')
const firstLink = wrapper.find('div[role="tablist"]>button.checkbox-radio-switch')
firstLink.trigger('keydown.left')
expect(wrapper.emitted('update:active')).toBeFalsy()
})
it('emit "update:active" event with the next tab id when keydown right is pressed', () => {
const firstLink = wrapper.find('div[role="tablist"]>.checkbox-radio-switch>label')
const firstLink = wrapper.find('div[role="tablist"]>button.checkbox-radio-switch')
firstLink.trigger('keydown.right')
expect(wrapper.emitted('update:active')[0]).toEqual(['second'])
})
Expand All @@ -156,13 +156,13 @@ describe('NcAppSidebarTabs.vue', () => {
wrapper.setData({ activeTab: 'last' })
})
it('emit "update:active" event with the previous tab id when keydown left is pressed', () => {
const lastLink = wrapper.find('div[role="tablist"]>.checkbox-radio-switch:last-of-type>label')
const lastLink = wrapper.find('div[role="tablist"]>button.checkbox-radio-switch:last-of-type')
lastLink.trigger('keydown.left')
expect(wrapper.emitted('update:active')[0]).toEqual(['second'])
})
it('does not emit "update:active" event when keydown right is pressed', () => {
expect(wrapper.emitted('update:active')).toBeFalsy()
const lastLink = wrapper.find('div[role="tablist"]>.checkbox-radio-switch:last-of-type>label')
const lastLink = wrapper.find('div[role="tablist"]>button.checkbox-radio-switch:last-of-type')
lastLink.trigger('keydown.right')
expect(wrapper.emitted('update:active')).toBeFalsy()
})
Expand Down

0 comments on commit 3dc8ba3

Please sign in to comment.