2017-01-10 18:02:20 -05:00
|
|
|
/* eslint-disable space-before-function-paren, no-return-assign */
|
2016-12-14 00:26:26 -05:00
|
|
|
/* global MergeRequest */
|
2016-07-24 16:45:11 -04:00
|
|
|
|
2017-01-09 18:23:54 -05:00
|
|
|
require('~/merge_request');
|
2016-07-24 16:45:11 -04:00
|
|
|
|
|
|
|
(function() {
|
|
|
|
describe('MergeRequest', function() {
|
|
|
|
return describe('task lists', function() {
|
2016-12-30 19:14:33 -05:00
|
|
|
preloadFixtures('static/merge_requests_show.html.raw');
|
2016-07-24 16:45:11 -04:00
|
|
|
beforeEach(function() {
|
2016-12-30 19:14:33 -05:00
|
|
|
loadFixtures('static/merge_requests_show.html.raw');
|
2016-07-24 16:45:11 -04:00
|
|
|
return this.merge = new MergeRequest();
|
|
|
|
});
|
|
|
|
it('modifies the Markdown field', function() {
|
|
|
|
spyOn(jQuery, 'ajax').and.stub();
|
|
|
|
$('input[type=checkbox]').attr('checked', true).trigger('change');
|
|
|
|
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) {
|
|
|
|
expect(req.type).toBe('PATCH');
|
|
|
|
expect(req.url).toBe('/foo');
|
|
|
|
return expect(req.data.merge_request.description).not.toBe(null);
|
|
|
|
});
|
|
|
|
return $('.js-task-list-field').trigger('tasklist:changed');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}).call(this);
|