49 lines
1.5 KiB
JavaScript
49 lines
1.5 KiB
JavaScript
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;
|
|
|
|
controller.shippedFrom = new Date();
|
|
|
|
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;
|
|
|
|
controller.shippedTo = new Date();
|
|
|
|
expect(controller.filter.scopeDays).toBeNull();
|
|
expect(controller.shippedTo).toBeDefined();
|
|
});
|
|
});
|
|
|
|
describe('scopeDays() setter', () => {
|
|
it('should clear the date range when setting the scopeDays property', () => {
|
|
controller.filter.shippedFrom = new Date();
|
|
controller.filter.shippedTo = new Date();
|
|
|
|
controller.scopeDays = 1;
|
|
|
|
expect(controller.filter.shippedFrom).toBeNull();
|
|
expect(controller.filter.shippedTo).toBeNull();
|
|
expect(controller.scopeDays).toBeDefined();
|
|
});
|
|
});
|
|
});
|