summaryrefslogtreecommitdiff
path: root/spec/javascripts/notes_spec.js
blob: 14dc6bfdfdeb865eedb1fb2ebbea00681b5387ef (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
30
31
32
33
34
35
36
37
38
39
40
41

/*= require notes */


/*= require gl_form */

(function() {
  window.gon || (window.gon = {});

  window.disableButtonIfEmptyField = function() {
    return null;
  };

  describe('Notes', function() {
    return describe('task lists', function() {
      fixture.preload('issue_note.html');
      beforeEach(function() {
        fixture.load('issue_note.html');
        $('form').on('submit', function(e) {
          return e.preventDefault();
        });
        return this.notes = new Notes();
      });
      it('modifies the Markdown field', function() {
        $('input[type=checkbox]').attr('checked', true).trigger('change');
        return expect($('.js-task-list-field').val()).toBe('- [x] Task List Item');
      });
      return it('submits the form on tasklist:changed', function() {
        var submitted;
        submitted = false;
        $('form').on('submit', function(e) {
          submitted = true;
          return e.preventDefault();
        });
        $('.js-task-list-field').trigger('tasklist:changed');
        return expect(submitted).toBe(true);
      });
    });
  });

}).call(this);