diff --git a/spec/frontend/super_sidebar/components/super_sidebar_spec.js b/spec/frontend/super_sidebar/components/super_sidebar_spec.js index 316c55420d639f132374755ac264acdf9db20502..75b0c5d63d40b836d340773befcf978345b7986a 100644 --- a/spec/frontend/super_sidebar/components/super_sidebar_spec.js +++ b/spec/frontend/super_sidebar/components/super_sidebar_spec.js @@ -126,7 +126,7 @@ describe('SuperSidebar component', () => { it('adds inert attribute when collapsed', () => { createWrapper({ sidebarState: { isCollapsed: true } }); - expect(findSidebar().attributes('inert')).toBe('inert'); + expect(findSidebar().attributes('inert')).toBeDefined(); }); it('does not add inert attribute when expanded', () => { @@ -271,7 +271,7 @@ describe('SuperSidebar component', () => { it(`initially makes sidebar inert and peekable (${STATE_CLOSED})`, () => { createWrapper({ sidebarState: { isCollapsed: true, isPeekable: true } }); - expect(findSidebar().attributes('inert')).toBe('inert'); + expect(findSidebar().attributes('inert')).toBeDefined(); expect(findSidebar().classes()).not.toContain(peekHintClass); expect(findSidebar().classes()).not.toContain(hasPeekedClass); expect(findSidebar().classes()).not.toContain(peekClass); @@ -283,7 +283,7 @@ describe('SuperSidebar component', () => { findPeekBehavior().vm.$emit('change', STATE_WILL_OPEN); await nextTick(); - expect(findSidebar().attributes('inert')).toBe('inert'); + expect(findSidebar().attributes('inert')).toBeDefined(); expect(findSidebar().classes()).toContain(peekHintClass); expect(findSidebar().classes()).toContain(hasPeekedClass); expect(findSidebar().classes()).not.toContain(peekClass); @@ -414,6 +414,7 @@ describe('SuperSidebar component', () => { wrapper.vm.sidebarState.isCollapsed = false; await nextTick(); + await nextTick(); expect(focusSpy).toHaveBeenCalledTimes(1); }); @@ -432,6 +433,7 @@ describe('SuperSidebar component', () => { wrapper.vm.sidebarState.isCollapsed = false; await nextTick(); + await nextTick(); expect(focusSpy).toHaveBeenCalledTimes(1); @@ -448,9 +450,10 @@ describe('SuperSidebar component', () => { }); const ESC_KEY = 27; - it('collapses sidebar when sidebar is in overlay mode', () => { + it('collapses sidebar when sidebar is in overlay mode', async () => { jest.spyOn(bp, 'windowWidth').mockReturnValue(lg); - findSidebar().trigger('keydown', { keyCode: ESC_KEY }); + await findSidebar().trigger('keydown.esc', { keyCode: ESC_KEY }); + expect(toggleSuperSidebarCollapsed).toHaveBeenCalled(); });