2017-10-26 16:02:57 -04:00
|
|
|
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();
|
2016-12-15 10:07:41 -05:00
|
|
|
});
|
|
|
|
|
2017-10-26 16:02:57 -04:00
|
|
|
it('should set bulkUpdateSidebar', () => {
|
|
|
|
const element = document.createElement('div');
|
|
|
|
element.classList.add('issues-bulk-update');
|
|
|
|
document.body.appendChild(element);
|
2016-12-15 10:07:41 -05:00
|
|
|
|
2017-10-26 16:02:57 -04:00
|
|
|
Issuable = new IssuableIndex('issue_');
|
|
|
|
expect(Issuable.bulkUpdateSidebar).toBeDefined();
|
2016-12-15 10:07:41 -05:00
|
|
|
});
|
2017-10-26 16:02:57 -04:00
|
|
|
});
|
2016-12-15 10:07:41 -05:00
|
|
|
|
2017-10-26 16:02:57 -04:00
|
|
|
describe('resetIncomingEmailToken', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
const element = document.createElement('a');
|
|
|
|
element.classList.add('incoming-email-token-reset');
|
|
|
|
element.setAttribute('href', 'foo');
|
|
|
|
document.body.appendChild(element);
|
2016-12-15 10:07:41 -05:00
|
|
|
|
2017-10-26 16:02:57 -04:00
|
|
|
const input = document.createElement('input');
|
|
|
|
input.setAttribute('id', 'issue_email');
|
|
|
|
document.body.appendChild(input);
|
2016-12-15 10:07:41 -05:00
|
|
|
|
2017-10-26 16:02:57 -04:00
|
|
|
Issuable = new IssuableIndex('issue_');
|
|
|
|
});
|
2016-12-15 10:07:41 -05:00
|
|
|
|
2017-10-26 16:02:57 -04:00
|
|
|
it('should send request to reset email token', () => {
|
|
|
|
spyOn(jQuery, 'ajax').and.callThrough();
|
|
|
|
document.querySelector('.incoming-email-token-reset').click();
|
2016-12-15 10:07:41 -05:00
|
|
|
|
2017-10-26 16:02:57 -04:00
|
|
|
expect(jQuery.ajax).toHaveBeenCalled();
|
|
|
|
expect(jQuery.ajax.calls.argsFor(0)[0].url).toEqual('foo');
|
2016-12-15 10:07:41 -05:00
|
|
|
});
|
|
|
|
});
|
2017-10-26 16:02:57 -04:00
|
|
|
});
|
|
|
|
|