salix/modules/travel/front/search-panel/index.spec.js

49 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-01-29 10:45:35 +00:00
import './index';
describe('Travel Component vnTravelSearchPanel', () => {
let controller;
beforeEach(ngModule('travel'));
beforeEach(inject($componentController => {
controller = $componentController('vnTravelSearchPanel', {$element: null});
controller.$t = () => {};
controller.filter = {};
}));
describe('shippedFrom() 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.shippedFrom = Date.vnNew();
2021-01-29 10:45:35 +00:00
expect(controller.filter.scopeDays).toBeNull();
expect(controller.shippedFrom).toBeDefined();
});
});
describe('shippedTo() 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.shippedTo = Date.vnNew();
2021-01-29 10:45:35 +00:00
expect(controller.filter.scopeDays).toBeNull();
expect(controller.shippedTo).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.shippedFrom = Date.vnNew();
controller.filter.shippedTo = Date.vnNew();
2021-01-29 10:45:35 +00:00
controller.scopeDays = 1;
expect(controller.filter.shippedFrom).toBeNull();
expect(controller.filter.shippedTo).toBeNull();
expect(controller.scopeDays).toBeDefined();
});
});
});