gitlab-org--gitlab-foss/spec/javascripts/merge_request_spec.js
2017-01-10 12:30:40 -06:00

31 lines
1.1 KiB
JavaScript

/* eslint-disable space-before-function-paren, no-return-assign, padded-blocks */
/* global MergeRequest */
require('./spec_helper');
require('merge_request');
(function() {
describe('MergeRequest', function() {
return describe('task lists', function() {
preloadFixtures('static/merge_requests_show.html.raw');
beforeEach(function() {
loadFixtures('static/merge_requests_show.html.raw');
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);