OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
adapt npm test
ulferts59bcd48dd80b
diff --git a/frontend/src/app/components/user/user-link/user-link.component.spec.ts b/frontend/src/app/components/user/user-link/user-link.component.spec.tsindex 2b239dda211..69018051022 100644--- a/frontend/src/app/components/user/user-link/user-link.component.spec.ts+++ b/frontend/src/app/components/user/user-link/user-link.component.spec.ts@@ -42,6 +42,11 @@ describe('UserLinkComponent component test', () => {t: (key:string, args:any) => `Author: ${args.user}`};+ let app:UserLinkComponent;+ let fixture:ComponentFixture<UserLinkComponent>;+ let element:HTMLElement;+ let user:UserResource;+beforeEach(async(() => {// noinspection JSIgnoredPromiseFromCall@@ -54,32 +59,50 @@ describe('UserLinkComponent component test', () => {{ provide: PathHelperService, useValue: PathHelperStub },]}).compileComponents();++ fixture = TestBed.createComponent(UserLinkComponent);+ app = fixture.debugElement.componentInstance;+ element = fixture.elementRef.nativeElement;}));describe('inner element', function() {- let app:UserLinkComponent;- let fixture:ComponentFixture<UserLinkComponent>- let element:HTMLElement;+ describe('with the uer having the showUserPath attribute', function() {+ beforeEach(async(() => {+ user = {+ name: 'First Last',+ showUserPath: '/users/1'+ } as UserResource;++ app.user = user;+ fixture.detectChanges();+ }));- let user = {- name: 'First Last',- href: '/api/v3/users/1',- idFromLink: '1',- } as UserResource;+ it('should render an inner link with specified classes', function () {+ const link = element.querySelector('a')!;++ expect(link.textContent).toEqual('First Last');+ expect(link.getAttribute('title')).toEqual('Author: First Last');+ expect(link.getAttribute('href')).toEqual('/users/1');+ });+ });- it('should render an inner link with specified classes', function() {- fixture = TestBed.createComponent(UserLinkComponent);- app = fixture.debugElement.componentInstance;- element = fixture.elementRef.nativeElement;+ describe('with the user not having the showUserPath attribute', function() {+ beforeEach(async(() => {+ user = {+ name: 'First Last',+ showUserPath: null+ } as UserResource;- app.user = user;- fixture.detectChanges();+ app.user = user;+ fixture.detectChanges();+ }));- const link = element.querySelector('a')!;+ it('renders only the name', function () {+ const link = element.querySelector('a');- expect(link.textContent).toEqual('First Last');- expect(link.getAttribute('title')).toEqual('Author: First Last');- expect(link.getAttribute('href')).toEqual('/users/1');+ expect(link).toBeNull();+ expect(element.textContent).toEqual(' First Last ');+ });});});});diff --git a/frontend/src/app/components/user/user-link/user-link.component.ts b/frontend/src/app/components/user/user-link/user-link.component.tsindex 68612f38a6f..7943e90eb06 100644--- a/frontend/src/app/components/user/user-link/user-link.component.ts+++ b/frontend/src/app/components/user/user-link/user-link.component.ts@@ -48,8 +48,7 @@ import {PathHelperService} from 'core-app/modules/common/path-helper/path-helperexport class UserLinkComponent {@Input() user:UserResource;- constructor(readonly pathHelper:PathHelperService,- readonly I18n:I18nService) {+ constructor(readonly I18n:I18nService) {}public get href() {