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 = Date.vnNew(); 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 = Date.vnNew(); 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 = Date.vnNew(); controller.filter.shippedTo = Date.vnNew(); controller.scopeDays = 1; expect(controller.filter.shippedFrom).toBeNull(); expect(controller.filter.shippedTo).toBeNull(); expect(controller.scopeDays).toBeDefined(); }); }); });