diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-09 12:09:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-09 12:09:24 +0000 |
commit | a9ced7da447785c57477b3d8dbccc73a78cface1 (patch) | |
tree | 5179d27ab9d801748ee4ed1c64c985974e799812 /spec/frontend | |
parent | ad0265eead72a624ce7a020847db4f0f0c877e57 (diff) | |
download | gitlab-ce-a9ced7da447785c57477b3d8dbccc73a78cface1.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/boards/board_card_spec.js | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/spec/frontend/boards/board_card_spec.js b/spec/frontend/boards/board_card_spec.js index 2524af21826..959c71d05ca 100644 --- a/spec/frontend/boards/board_card_spec.js +++ b/spec/frontend/boards/board_card_spec.js @@ -9,6 +9,7 @@ import axios from '~/lib/utils/axios_utils'; import waitForPromises from 'helpers/wait_for_promises'; import eventHub from '~/boards/eventhub'; +import sidebarEventHub from '~/sidebar/event_hub'; import '~/boards/models/label'; import '~/boards/models/assignee'; import '~/boards/models/list'; @@ -201,7 +202,8 @@ describe('Board card', () => { it('resets detail issue to empty if already set', () => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); - [boardsStore.detail.issue] = list.issues; + const [issue] = list.issues; + boardsStore.detail.issue = issue; mountComponent(); wrapper.trigger('mousedown'); @@ -210,4 +212,27 @@ describe('Board card', () => { expect(eventHub.$emit).toHaveBeenCalledWith('clearDetailIssue', undefined); }); }); + + describe('sidebarHub events', () => { + it('closes all sidebars before showing an issue if no issues are opened', () => { + jest.spyOn(sidebarEventHub, '$emit').mockImplementation(() => {}); + boardsStore.detail.issue = {}; + mountComponent(); + + wrapper.trigger('mouseup'); + + expect(sidebarEventHub.$emit).toHaveBeenCalledWith('sidebar.closeAll'); + }); + + it('it does not closes all sidebars before showing an issue if an issue is opened', () => { + jest.spyOn(sidebarEventHub, '$emit').mockImplementation(() => {}); + const [issue] = list.issues; + boardsStore.detail.issue = issue; + mountComponent(); + + wrapper.trigger('mousedown'); + + expect(sidebarEventHub.$emit).not.toHaveBeenCalledWith('sidebar.closeAll'); + }); + }); }); |