From 156c9ec3ab0b65bfa3f0ea172e337fcb1961359a Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 26 Sep 2019 09:05:54 +0200 Subject: [PATCH] =?UTF-8?q?#1716=20ticket.summary=20a=C3=B1adir=20link=20a?= =?UTF-8?q?=20la=20Ruta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/label-value/label-value.html | 10 ++++- .../components/label-value/label-value.js | 29 +++++++++++--- .../label-value/label-value.spec.js | 40 +++++++++++++++++++ modules/ticket/front/summary/index.html | 4 +- 4 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 front/core/components/label-value/label-value.spec.js diff --git a/front/core/components/label-value/label-value.html b/front/core/components/label-value/label-value.html index 714c0f278..138e593c2 100644 --- a/front/core/components/label-value/label-value.html +++ b/front/core/components/label-value/label-value.html @@ -1,6 +1,12 @@
- - + + + + + { + let $element; + let controller; + + beforeEach(angular.mock.module('vnCore', $translateProvider => { + $translateProvider.translations('en', {}); + })); + + 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); + }); + }); +}); diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 7105e0515..383d02ec9 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -36,7 +36,9 @@ value="{{$ctrl.summary.landed | dateTime: 'dd/MM/yyyy'}}"> + value="{{$ctrl.summary.routeFk}}" + state="route.card.summary" + state-params="{id: $ctrl.summary.routeFk}">