Skip to content

Commit

Permalink
tests: Fix tests for NcAppSidebarTabs
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Apr 3, 2023
1 parent 9cb2904 commit 6ea6029
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/unit/components/NcAppSidebar/NcAppSidebarTabs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,22 @@ describe('NcAppSidebarTabs.vue', () => {
it('display the nav element', () => {
expect(wrapper.find('nav').exists()).toBe(true)
})
it('display all the 3 elements in li', () => {
const liList = wrapper.findAll('nav>ul>li')
it('display all the 3 elements', () => {
const liList = wrapper.findAll('nav>.checkbox-radio-switch')
expect(liList.length).toEqual(3)
})
it('emit "update:active" event with the selected tab id when clicking on a tab', () => {
const lastLink = wrapper.find('nav>ul>li:last-of-type>a')
const lastLink = wrapper.find('nav>.checkbox-radio-switch:last-of-type>label')
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('nav>ul>li:last-of-type>a')
const lastLink = wrapper.find('nav>.checkbox-radio-switch:last-of-type>label')
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('nav>ul>li:last-of-type>a')
const lastLink = wrapper.find('nav>.checkbox-radio-switch:last-of-type>label')
lastLink.trigger('keydown.pagedown')
expect(wrapper.emitted('update:active')[0]).toEqual(['last'])
})
Expand All @@ -140,12 +140,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('nav>ul>li>a')
const firstLink = wrapper.find('nav>.checkbox-radio-switch>label')
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('nav>ul>li>a')
const firstLink = wrapper.find('nav>.checkbox-radio-switch>label')
firstLink.trigger('keydown.right')
expect(wrapper.emitted('update:active')[0]).toEqual(['second'])
})
Expand All @@ -155,13 +155,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('nav>ul>li:last-of-type>a')
const lastLink = wrapper.find('nav>.checkbox-radio-switch:last-of-type>label')
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('nav>ul>li:last-of-type>a')
const lastLink = wrapper.find('nav>.checkbox-radio-switch:last-of-type>label')
lastLink.trigger('keydown.right')
expect(wrapper.emitted('update:active')).toBeFalsy()
})
Expand Down

0 comments on commit 6ea6029

Please sign in to comment.