diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-05-15 16:55:07 +0100 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-05-15 16:55:07 +0100 |
commit | 3593b83a0279bab40f8ba97dc339b32c56f6e0df (patch) | |
tree | a7fd75dd081e5b30795892582a3065ce3af0aac5 /spec/javascripts/pipelines/stage_spec.js | |
parent | bf806712835869046c819f84ee515caa8829c10d (diff) | |
download | gitlab-ce-3593b83a0279bab40f8ba97dc339b32c56f6e0df.tar.gz |
Handles action icons requests in a contained way and shows a loading icon to the user
Diffstat (limited to 'spec/javascripts/pipelines/stage_spec.js')
-rw-r--r-- | spec/javascripts/pipelines/stage_spec.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/javascripts/pipelines/stage_spec.js b/spec/javascripts/pipelines/stage_spec.js index 75156e7bdfd..2ba5ecf92e7 100644 --- a/spec/javascripts/pipelines/stage_spec.js +++ b/spec/javascripts/pipelines/stage_spec.js @@ -102,4 +102,53 @@ describe('Pipelines stage component', () => { }); }); }); + + describe('pipelineActionRequestComplete', () => { + beforeEach(() => { + mock.onGet('path.json').reply(200, stageReply); + + mock.onPost(`${stageReply.latest_statuses[0].status.action.path}.json`).reply(200); + }); + + describe('within pipeline table', () => { + it('emits `clickedDropdown` event when `pipelineActionRequestComplete` is triggered', done => { + spyOn(eventHub, '$emit'); + + component.type = 'PIPELINES_TABLE'; + component.$el.querySelector('button').click(); + + setTimeout(() => { + component.$el.querySelector('.js-ci-action').click(); + component.$nextTick() + .then(() => { + expect(eventHub.$emit).toHaveBeenCalledWith('clickedDropdown'); + + expect(eventHub.$emit).toHaveBeenCalledTimes(2); + }) + .then(done) + .catch(done.fail); + }, 0); + }); + }); + + describe('without a type', () => { + it('fetches dropdown content again', done => { + spyOn(component, 'fetchJobs').and.callThrough(); + + component.$el.querySelector('button').click(); + + expect(component.fetchJobs).toHaveBeenCalledTimes(1); + + setTimeout(() => { + component.$el.querySelector('.js-ci-action').click(); + component.$nextTick() + .then(() => { + expect(component.fetchJobs).toHaveBeenCalledTimes(2); + }) + .then(done) + .catch(done.fail); + }, 0); + }); + }); + }); }); |