Skip to content
Snippets Groups Projects
Commit a712f715 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-988 fix createdAt; adjust styling

parent 49bca0ea
No related branches found
No related tags found
No related merge requests found
import { CreateCommand } from "@goofy-client/command-shared"; import { CreateCommand } from '@goofy-client/command-shared';
import { ListResource } from "@goofy-client/tech-shared"; import { ListResource } from '@goofy-client/tech-shared';
import { Resource } from "@ngxp/rest"; import { Resource } from '@ngxp/rest';
export interface Kommentar { export interface Kommentar {
createdByName: string; createdByName: string;
......
import { FormBuilder } from "@angular/forms"; import { FormBuilder } from '@angular/forms';
import { KommentarResource, KommentarService } from "@goofy-client/kommentar-shared"; import { KommentarResource, KommentarService } from '@goofy-client/kommentar-shared';
import { createEmptyStateResource } from "@goofy-client/tech-shared"; import { createEmptyStateResource } from '@goofy-client/tech-shared';
import { Mock, mock, useFromMock } from "@goofy-client/test-utils"; import { Mock, mock, useFromMock } from '@goofy-client/test-utils';
import { createKommentarResource } from "libs/kommentar-shared/test/kommentar"; import { createKommentarResource } from 'libs/kommentar-shared/test/kommentar';
import { of } from "rxjs"; import { of } from 'rxjs';
import { KommentarFormService } from "./kommentar.formservice"; import { KommentarFormService } from './kommentar.formservice';
describe('KommentarFormService', () => { describe('KommentarFormService', () => {
let formService: KommentarFormService; let formService: KommentarFormService;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<span data-test-id="user-profile-in-kommentar-name"> <span data-test-id="user-profile-in-kommentar-name">
{{userProfileStateResource.resource.firstName}} {{userProfileStateResource.resource.lastName}} {{userProfileStateResource.resource.firstName}} {{userProfileStateResource.resource.lastName}}
</span> </span>
<span data-test-id="user-profile-in-kommentar-created-at">{{userProfileStateResource.resource.createdAt | date: 'dd.MM.yy HH:mm' }}</span>
</div> </div>
</ng-container> </ng-container>
<span class="created-at" data-test-id="user-profile-in-kommentar-created-at">{{kommentar.createdAt | date: 'dd.MM.yy HH:mm' }}</span>
\ No newline at end of file
...@@ -9,3 +9,7 @@ goofy-client-user-icon { ...@@ -9,3 +9,7 @@ goofy-client-user-icon {
transform-origin: left center; transform-origin: left center;
margin: -4px -8px -4px 0; margin: -4px -8px -4px 0;
} }
.created-at {
padding: 0 5px;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createStateResource } from '@goofy-client/tech-shared';
import { mock } from '@goofy-client/test-utils'; import { mock } from '@goofy-client/test-utils';
import { UserProfileService } from '@goofy-client/user-profile-shared'; import { UserProfileService } from '@goofy-client/user-profile-shared';
import { createKommentarResource } from 'libs/kommentar-shared/test/kommentar';
import { createUserProfileResource } from 'libs/user-profile-shared/test/user-profile';
import { configureTestSuite } from 'ng-bullet'; import { configureTestSuite } from 'ng-bullet';
import { MockComponent } from 'ng-mocks'; import { MockComponent } from 'ng-mocks';
import { of } from 'rxjs';
import { UserIconComponent } from '../user-icon/user-icon.component'; import { UserIconComponent } from '../user-icon/user-icon.component';
import { UserProfileInKommentarContainerComponent } from './user-profile-in-kommentar-container.component'; import { UserProfileInKommentarContainerComponent } from './user-profile-in-kommentar-container.component';
...@@ -10,7 +14,11 @@ describe('UserProfileInKommentarContainerComponent', () => { ...@@ -10,7 +14,11 @@ describe('UserProfileInKommentarContainerComponent', () => {
let component: UserProfileInKommentarContainerComponent; let component: UserProfileInKommentarContainerComponent;
let fixture: ComponentFixture<UserProfileInKommentarContainerComponent>; let fixture: ComponentFixture<UserProfileInKommentarContainerComponent>;
const userProfileService = mock(UserProfileService); const kommentarCreatedAt: string = '[data-test-id="user-profile-in-kommentar-created-at"]';
const userProfileService = { ...mock(UserProfileService), getAssignedUserProfile: () => of(createStateResource(createUserProfileResource())) };
const createdAt: Date = new Date('2021-06-29T11:50:00');
configureTestSuite(() => { configureTestSuite(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
...@@ -30,10 +38,18 @@ describe('UserProfileInKommentarContainerComponent', () => { ...@@ -30,10 +38,18 @@ describe('UserProfileInKommentarContainerComponent', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(UserProfileInKommentarContainerComponent); fixture = TestBed.createComponent(UserProfileInKommentarContainerComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.kommentar = { ...createKommentarResource(), createdAt };
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
it('should show createdAt from kommentar', () => {
const element = fixture.nativeElement.querySelector(kommentarCreatedAt);
expect(element).toBeInstanceOf(HTMLElement);
expect((<HTMLElement>element).innerHTML).toEqual('29.06.21 11:50');
})
}); });
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment