salix/modules/item/front/request-search-panel/index.spec.js

49 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-02-23 15:09:29 +00:00
import './index';
describe(' Component vnRequestSearchPanel', () => {
let controller;
beforeEach(ngModule('item'));
beforeEach(inject($componentController => {
controller = $componentController('vnRequestSearchPanel', {$element: null});
controller.$t = () => {};
controller.filter = {};
}));
describe('from() setter', () => {
it('should clear the scope days when setting the from property', () => {
controller.filter.scopeDays = 1;
2023-01-16 14:18:24 +00:00
controller.from = Date.vnNew();
2021-02-23 15:09:29 +00:00
expect(controller.filter.scopeDays).toBeNull();
expect(controller.from).toBeDefined();
});
});
describe('to() setter', () => {
it('should clear the scope days when setting the to property', () => {
controller.filter.scopeDays = 1;
2023-01-16 14:18:24 +00:00
controller.to = Date.vnNew();
2021-02-23 15:09:29 +00:00
expect(controller.filter.scopeDays).toBeNull();
expect(controller.to).toBeDefined();
});
});
describe('scopeDays() setter', () => {
it('should clear the date range when setting the scopeDays property', () => {
2023-01-16 14:18:24 +00:00
controller.filter.from = Date.vnNew();
controller.filter.to = Date.vnNew();
2021-02-23 15:09:29 +00:00
controller.scopeDays = 1;
expect(controller.filter.from).toBeNull();
expect(controller.filter.to).toBeNull();
expect(controller.scopeDays).toBeDefined();
});
});
});