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

40 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2022-07-20 11:41:33 +00:00
import './index.js';
describe('Component vnShelvingIndex', () => {
let controller;
let $window;
let shelvings = [{
id: 1,
code: 'AAA'
}, {
id: 2,
code: 'AA1'
}, {
id: 3,
code: 'AA2'
}];
beforeEach(ngModule('shelving'));
beforeEach(inject(($componentController, _$window_) => {
$window = _$window_;
const $element = angular.element('<vn-shelving-index></vn-shelving-index>');
controller = $componentController('vnShelvingIndex', {$element});
}));
describe('preview()', () => {
it('should show the dialog summary', () => {
controller.$.summary = {show: () => {}};
jest.spyOn(controller.$.summary, 'show');
let event = new MouseEvent('click', {
view: $window,
bubbles: true,
cancelable: true
});
controller.preview(event, shelvings[0]);
expect(controller.$.summary.show).toHaveBeenCalledWith();
});
});
});