diff options
author | Simon Knox <psimyn@gmail.com> | 2017-02-09 01:12:12 +1100 |
---|---|---|
committer | Simon Knox <psimyn@gmail.com> | 2017-02-09 01:12:12 +1100 |
commit | 2084555a08e28b77a333fb5316e0af306e620106 (patch) | |
tree | 596385f80a7d6af782810df57f343d4e4190d309 /spec | |
parent | 4e4639b56eda367a8d5612042fcf1359a8303082 (diff) | |
download | gitlab-ce-2084555a08e28b77a333fb5316e0af306e620106.tar.gz |
update karma test to expect ajax instead of POST
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/notes_spec.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/spec/javascripts/notes_spec.js b/spec/javascripts/notes_spec.js index af495787c54..ac3d285572a 100644 --- a/spec/javascripts/notes_spec.js +++ b/spec/javascripts/notes_spec.js @@ -35,15 +35,13 @@ require('~/lib/utils/text_utility'); expect($('.js-task-list-field').val()).toBe('- [x] Task List Item'); }); - it('submits the form on tasklist:changed', function() { - var submitted = false; - $('form').on('submit', function(e) { - submitted = true; - e.preventDefault(); + it('submits an ajax request on tasklist:changed', function() { + spyOn(jQuery, 'ajax').and.callFake(function(req) { + expect(req.type).toBe('PATCH'); + expect(req.url).toBe('http://test.host/frontend-fixtures/issues-project/notes/1'); + return expect(req.data.note).not.toBe(null); }); - - $('.js-task-list-field').trigger('tasklist:changed'); - expect(submitted).toBe(true); + return $('.js-task-list-field').trigger('tasklist:changed'); }); }); |