39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
import './label-value.js';
|
|
import template from './label-value.html';
|
|
|
|
describe('Component vnInputTime', () => {
|
|
let $element;
|
|
let controller;
|
|
|
|
beforeEach(ngModule('vnCore'));
|
|
|
|
beforeEach(angular.mock.inject($componentController => {
|
|
const $attrs = {};
|
|
$element = angular.element(`${template}`);
|
|
controller = $componentController('vnLabelValue', {$element, $attrs});
|
|
}));
|
|
|
|
describe('applyTextContent()', () => {
|
|
it(`should set the value on the span element as there's no navigation setted`, () => {
|
|
const value = 'I am the value';
|
|
controller.value = value;
|
|
controller.title = value;
|
|
controller.applyTextContent();
|
|
|
|
expect(controller.element.querySelector('span').textContent).toEqual(value);
|
|
expect(controller.element.querySelector('span').title).toEqual(value);
|
|
});
|
|
|
|
it(`should set the value on the anchor element as there's a navigation setted`, () => {
|
|
const value = 'I am the value';
|
|
controller.value = value;
|
|
controller.title = value;
|
|
controller.state = 'some.state.to.go';
|
|
controller.applyTextContent();
|
|
|
|
expect(controller.element.querySelector('a').textContent).toEqual(value);
|
|
expect(controller.element.querySelector('a').title).toEqual(value);
|
|
});
|
|
});
|
|
});
|