salix/modules/travel/front/index/index.spec.js

32 lines
870 B
JavaScript
Raw Normal View History

2019-10-25 11:29:05 +00:00
import './index.js';
describe('Travel Component vnTravelIndex', () => {
let controller;
2020-03-16 17:08:44 +00:00
let travel = {
2019-12-20 06:55:00 +00:00
id: 1,
warehouseInFk: 1,
totalEntries: 3,
isDelivered: false
2020-03-16 17:08:44 +00:00
};
2019-10-25 11:29:05 +00:00
2020-03-16 17:08:44 +00:00
beforeEach(ngModule('travel'));
2019-10-25 11:29:05 +00:00
2020-03-16 17:08:44 +00:00
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
2019-12-20 06:55:00 +00:00
let $scope = $rootScope.$new();
2020-03-16 17:08:44 +00:00
controller = $componentController('vnTravelIndex', {$scope});
2019-12-20 06:55:00 +00:00
controller.$.summary = {show: jasmine.createSpy('show')};
2019-10-25 11:29:05 +00:00
}));
2019-12-20 06:55:00 +00:00
describe('preview()', () => {
it('should show the dialog summary', () => {
let event = new MouseEvent('click', {
bubbles: true,
cancelable: true
});
2020-03-16 17:08:44 +00:00
controller.preview(event, travel);
2019-10-25 11:29:05 +00:00
2019-12-20 06:55:00 +00:00
expect(controller.$.summary.show).toHaveBeenCalledWith();
2019-10-25 11:29:05 +00:00
});
2019-12-20 06:55:00 +00:00
});
2019-10-25 11:29:05 +00:00
});