salix/modules/zone/front/delivery-days/index.spec.js

42 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-02-26 06:02:03 +00:00
import './index.js';
import popover from 'core/mocks/popover';
import crudModel from 'core/mocks/crud-model';
fdescribe('Zone Component vnZoneDeliveryDays', () => {
let $componentController;
let controller;
let $element;
beforeEach(ngModule('zone'));
beforeEach(angular.mock.inject(_$componentController_ => {
$componentController = _$componentController_;
$element = angular.element('<vn-zone-delivery-days></vn-zone-delivery-days');
controller = $componentController('vnZoneDeliveryDays', {$element});
controller.$.zoneEvents = popover;
controller.$.zoneIndex = {
$scope: {
model: crudModel
}
};
}));
describe('onSelection()', () => {
it('should return', () => {
jest.spyOn(controller.$.zoneEvents, 'show');
const $event = new Event('click');
const target = angular.element('<div>My target</div>'); // crear con DOM?
target.dispatchEvent($event);
const $events = [
{zoneFk: 1},
{zoneFk: 2},
{zoneFk: 8}
];
controller.onSelection($event, $events);
expect(controller.$.zoneEvents.show).toHaveBeenCalledWith();
});
});
});