summaryrefslogtreecommitdiff
path: root/spec/javascripts/merge_request_spec.js
blob: cbe2634d3a43f6b9b9cf557274939b7610ffe347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* eslint-disable space-before-function-paren, no-return-assign, no-undef, padded-blocks */

/*= require merge_request */

(function() {
  describe('MergeRequest', function() {
    return describe('task lists', function() {
      fixture.preload('merge_requests_show.html');
      beforeEach(function() {
        fixture.load('merge_requests_show.html');
        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);