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