diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js index 52608cde3..988914978 100644 --- a/modules/item/front/diary/index.spec.js +++ b/modules/item/front/diary/index.spec.js @@ -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); + }); + }); }); });