Make tasklist:changed test in merge_request_spec.js async
This commit is contained in:
parent
62943cd796
commit
3f54abb26c
1 changed files with 11 additions and 4 deletions
|
@ -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');
|
||||
|
||||
|
|
Loading…
Reference in a new issue