import './index.js'; describe('Component vnLabelValue', () => { let $element; let controller; let element; beforeEach(ngModule('vnCore')); beforeEach(inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); controller = $element.controller('vnLabelValue'); element = $element[0]; })); afterEach(() => { $element.remove(); }); describe('value() setter', () => { it(`should set the value on the span element`, () => { const value = 'I am the value'; controller.value = value; expect(element.querySelector('span').textContent).toEqual(value); expect(element.querySelector('span').title).toEqual(value); }); it(`should set a dash when no value is provided`, () => { const value = null; controller.value = value; expect(element.querySelector('span').textContent).toEqual('-'); }); }); });