describe('Component vnButtonMenu', () => { let controller; let $element; beforeEach(ngModule('vnCore')); beforeEach(inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); controller = $element.controller('vnIconMenu'); })); afterEach(() => { $element.remove(); }); describe('onClick(event)', () => { it(`should emit the open event`, () => { spyOn(controller, 'emit'); let event = new MouseEvent('click', { view: controller.element.window, bubbles: true, cancelable: true }); controller.onClick(event); expect(controller.emit).toHaveBeenCalledWith('open'); }); }); describe('onDropDownSelect(value)', () => { it(`should set field to the given value and emit the change event`, () => { spyOn(controller, 'emit'); controller.onDropDownSelect('mariano'); expect(controller.field).toBe('mariano'); expect(controller.emit).toHaveBeenCalledWith('change', {value: 'mariano'}); }); }); });