diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2018-01-08 20:10:51 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2018-01-08 20:10:51 +0000 |
commit | 8a7bbe1ff3a384a21a837c8db82cc7c9613e3114 (patch) | |
tree | e772b21f0278c99d2ff3b8e8c244a2768184a0db | |
parent | b11054752e7c3341507e3dbbbf5acc0d4f365ecd (diff) | |
parent | 3f54abb26c48885cb022a1a86ac7dc947579869c (diff) | |
download | gitlab-ce-8a7bbe1ff3a384a21a837c8db82cc7c9613e3114.tar.gz |
Merge branch 'winh-fix-merge-request-spec' into 'master'
Make tasklist:changed test in merge_request_spec.js async
Closes #34649
See merge request gitlab-org/gitlab-ce!16097
-rw-r--r-- | spec/javascripts/merge_request_spec.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/javascripts/merge_request_spec.js b/spec/javascripts/merge_request_spec.js index 2f02c11482f..9d6ea3781bc 100644 --- a/spec/javascripts/merge_request_spec.js +++ b/spec/javascripts/merge_request_spec.js @@ -19,17 +19,24 @@ import IssuablesHelper from '~/helpers/issuables_helper'; $('input[type=checkbox]').attr('checked', true)[0].dispatchEvent(changeEvent); return expect($('.js-task-list-field').val()).toBe('- [x] Task List Item'); }); - return it('submits an ajax request on tasklist:changed', function() { - spyOn(jQuery, 'ajax').and.callFake(function(req) { + + it('submits an ajax request on tasklist:changed', (done) => { + spyOn(jQuery, 'ajax').and.callFake((req) => { expect(req.type).toBe('PATCH'); expect(req.url).toBe(`${gl.TEST_HOST}/frontend-fixtures/merge-requests-project/merge_requests/1.json`); - return expect(req.data.merge_request.description).not.toBe(null); + expect(req.data.merge_request.description).not.toBe(null); + done(); }); - return $('.js-task-list-field').trigger('tasklist:changed'); + + $('.js-task-list-field').trigger('tasklist:changed'); }); }); describe('class constructor', () => { + beforeEach(() => { + spyOn(jQuery, 'ajax').and.stub(); + }); + it('calls .initCloseReopenReport', () => { spyOn(IssuablesHelper, 'initCloseReopenReport'); |