46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
import './index.js';
|
|
|
|
describe('Item', () => {
|
|
describe('Component vnItemSearchPanel', () => {
|
|
let $element;
|
|
let controller;
|
|
|
|
beforeEach(ngModule('item'));
|
|
|
|
beforeEach(inject($componentController => {
|
|
$element = angular.element(`<div></div>`);
|
|
controller = $componentController('vnItemSearchPanel', {$element});
|
|
}));
|
|
|
|
describe('getSourceTable()', () => {
|
|
it(`should return null if there's no selection`, () => {
|
|
let selection = null;
|
|
let result = controller.getSourceTable(selection);
|
|
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it(`should return null if there's a selection but its isFree property is truthy`, () => {
|
|
let selection = {isFree: true};
|
|
let result = controller.getSourceTable(selection);
|
|
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it(`should return the formated sourceTable concatenated to a path`, () => {
|
|
let selection = {sourceTable: 'hello guy'};
|
|
let result = controller.getSourceTable(selection);
|
|
|
|
expect(result).toEqual('Hello guys');
|
|
});
|
|
|
|
it(`should return a path if there's no sourceTable and the selection has an id`, () => {
|
|
let selection = {id: 99};
|
|
let result = controller.getSourceTable(selection);
|
|
|
|
expect(result).toEqual(`ItemTags/filterItemTags/${selection.id}`);
|
|
});
|
|
});
|
|
});
|
|
});
|