diff options
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js | 13 | ||||
-rw-r--r-- | spec/javascripts/sidebar/sidebar_mediator_spec.js | 10 |
2 files changed, 21 insertions, 2 deletions
diff --git a/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js b/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js index 0a3f0d6901f..5296908afe2 100644 --- a/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js +++ b/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js @@ -83,4 +83,17 @@ describe('LockIssueSidebar', () => { done(); }); }); + + it('does not display the edit form when opened from collapsed state if not editable', done => { + expect(vm2.isLockDialogOpen).toBe(false); + + vm2.$el.querySelector('.sidebar-collapsed-icon').click(); + + Vue.nextTick() + .then(() => { + expect(vm2.isLockDialogOpen).toBe(false); + }) + .then(done) + .catch(done.fail); + }); }); diff --git a/spec/javascripts/sidebar/sidebar_mediator_spec.js b/spec/javascripts/sidebar/sidebar_mediator_spec.js index b0412105e3f..2aa30fd1cc6 100644 --- a/spec/javascripts/sidebar/sidebar_mediator_spec.js +++ b/spec/javascripts/sidebar/sidebar_mediator_spec.js @@ -2,7 +2,7 @@ import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; import SidebarMediator from '~/sidebar/sidebar_mediator'; import SidebarStore from '~/sidebar/stores/sidebar_store'; -import SidebarService from '~/sidebar/services/sidebar_service'; +import SidebarService, { gqClient } from '~/sidebar/services/sidebar_service'; import Mock from './mock_data'; const { mediator: mediatorMockData } = Mock; @@ -44,12 +44,18 @@ describe('Sidebar mediator', function() { it('fetches the data', done => { const mockData = Mock.responseMap.GET[mediatorMockData.endpoint]; mock.onGet(mediatorMockData.endpoint).reply(200, mockData); + + const mockGraphQlData = Mock.graphQlResponseData; + spyOn(gqClient, 'query').and.returnValue({ + data: mockGraphQlData, + }); + spyOn(this.mediator, 'processFetchedData').and.callThrough(); this.mediator .fetch() .then(() => { - expect(this.mediator.processFetchedData).toHaveBeenCalledWith(mockData); + expect(this.mediator.processFetchedData).toHaveBeenCalledWith(mockData, mockGraphQlData); }) .then(done) .catch(done.fail); |