Welcome to mirror list, hosted at ThFree Co, Russian Federation.

issuable_spec.js « javascripts « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5a9112716f43bdc03b8777f3e4ef242c2fadecd7 (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
42
43
44
import IssuableIndex from '~/issuable_index';

describe('Issuable', () => {
  let Issuable;
  describe('initBulkUpdate', () => {
    it('should not set bulkUpdateSidebar', () => {
      Issuable = new IssuableIndex('issue_');
      expect(Issuable.bulkUpdateSidebar).not.toBeDefined();
    });

    it('should set bulkUpdateSidebar', () => {
      const element = document.createElement('div');
      element.classList.add('issues-bulk-update');
      document.body.appendChild(element);

      Issuable = new IssuableIndex('issue_');
      expect(Issuable.bulkUpdateSidebar).toBeDefined();
    });
  });

  describe('resetIncomingEmailToken', () => {
    beforeEach(() => {
      const element = document.createElement('a');
      element.classList.add('incoming-email-token-reset');
      element.setAttribute('href', 'foo');
      document.body.appendChild(element);

      const input = document.createElement('input');
      input.setAttribute('id', 'issuable_email');
      document.body.appendChild(input);

      Issuable = new IssuableIndex('issue_');
    });

    it('should send request to reset email token', () => {
      spyOn(jQuery, 'ajax').and.callThrough();
      document.querySelector('.incoming-email-token-reset').click();

      expect(jQuery.ajax).toHaveBeenCalled();
      expect(jQuery.ajax.calls.argsFor(0)[0].url).toEqual('foo');
    });
  });
});