BigW Consortium Gitlab

Commit 2084555a by Simon Knox

update karma test to expect ajax instead of POST

parent 4e4639b5
...@@ -35,15 +35,13 @@ require('~/lib/utils/text_utility'); ...@@ -35,15 +35,13 @@ require('~/lib/utils/text_utility');
expect($('.js-task-list-field').val()).toBe('- [x] Task List Item'); expect($('.js-task-list-field').val()).toBe('- [x] Task List Item');
}); });
it('submits the form on tasklist:changed', function() { it('submits an ajax request on tasklist:changed', function() {
var submitted = false; spyOn(jQuery, 'ajax').and.callFake(function(req) {
$('form').on('submit', function(e) { expect(req.type).toBe('PATCH');
submitted = true; expect(req.url).toBe('http://test.host/frontend-fixtures/issues-project/notes/1');
e.preventDefault(); return expect(req.data.note).not.toBe(null);
}); });
return $('.js-task-list-field').trigger('tasklist:changed');
$('.js-task-list-field').trigger('tasklist:changed');
expect(submitted).toBe(true);
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment