Merge pull request 'Add list of emails from client' (#523) from 2723-Format_emails_for_summaries into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #523
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Joan Sanchez 2021-02-02 10:06:22 +00:00
commit f6af7f14af
3 changed files with 38 additions and 2 deletions

View File

@ -2,7 +2,13 @@ import ngModule from '../../module';
import Section from '../section';
import './style.scss';
export default class Summary extends Section {}
export default class Summary extends Section {
listEmails(email) {
if (!email) return;
const emailList = email.split(',');
return emailList.join(', ');
}
}
ngModule.vnComponent('vnSummary', {
controller: Summary

View File

@ -0,0 +1,30 @@
import './index.js';
describe('Salix', () => {
describe('Component vnSummary', () => {
let controller;
beforeEach(ngModule('salix'));
beforeEach(inject($componentController => {
const $element = angular.element('<vn-summary></vn-summary>');
controller = $componentController('vnSummary', {$element});
}));
describe('listEmails()', () => {
it('should do nothing when receives no arguments', () => {
const emailList = controller.listEmails();
expect(emailList).toBeUndefined();
});
it('should format the receives emails to be separated with comma', () => {
const expectedResult = 'captainmarvel@marvel.com, ironman@marvel.com';
const emailList = controller.listEmails('captainmarvel@marvel.com,ironman@marvel.com');
expect(emailList).toEqual(expectedResult);
});
});
});
});

View File

@ -40,7 +40,7 @@
value="{{$ctrl.summary.mobile}}">
</vn-label-value>
<vn-label-value label="Email" no-ellipsize
value="{{$ctrl.summary.email}}">
value="{{$ctrl.listEmails($ctrl.summary.email)}}">
</vn-label-value>
<vn-label-value label="Sales person">
<span