Added unit test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
7f63213de0
commit
770b6a30bb
|
@ -60,6 +60,34 @@ describe('Item', () => {
|
|||
expect(controller.$anchorScroll).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('showDescriptor ()', () => {
|
||||
it('should call to the entryDescriptor show() method', () => {
|
||||
controller.$.entryDescriptor = {};
|
||||
controller.$.entryDescriptor.show = jest.fn();
|
||||
|
||||
const $event = new Event('click');
|
||||
const target = document.createElement('div');
|
||||
target.dispatchEvent($event);
|
||||
const data = {id: 1, origin: 1};
|
||||
controller.showDescriptor($event, data);
|
||||
|
||||
expect(controller.$.entryDescriptor.show).toHaveBeenCalledWith($event.target, data.origin);
|
||||
});
|
||||
|
||||
it('should call to the ticketDescriptor show() method', () => {
|
||||
controller.$.ticketDescriptor = {};
|
||||
controller.$.ticketDescriptor.show = jest.fn();
|
||||
|
||||
const $event = new Event('click');
|
||||
const target = document.createElement('div');
|
||||
target.dispatchEvent($event);
|
||||
const data = {id: 1, origin: 1, isTicket: true};
|
||||
controller.showDescriptor($event, data);
|
||||
|
||||
expect(controller.$.ticketDescriptor.show).toHaveBeenCalledWith($event.target, data.origin);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue