Skip to content
Snippets Groups Projects
Commit 834b11fc authored by Martin Küster's avatar Martin Küster
Browse files

Merge branch 'OZG-7593-ButtonErneutVesuchenBug' into 'main'

Ozg 7593 button erneut vesuchen bug

See merge request !65
parents 87dd6c2f 36309731
Branches
Tags
1 merge request!65Ozg 7593 button erneut vesuchen bug
Showing
with 69 additions and 28 deletions
......@@ -23,7 +23,7 @@
unter der Lizenz sind dem Lizenztext zu entnehmen.
-->
<a routerLink="postfach">
<a [routerLink]="onPage ? null : 'postfach'" data-test-class="incoming-mail-routing">
<div class="mail-head">
<div class="subject" data-test-id="mail-subject">
<mat-icon data-test-id="reply-icon">reply</mat-icon>
......
......@@ -29,10 +29,6 @@
a {
text-decoration: none;
color: inherit;
:host-context(.postfach-links-disabled) {
pointer-events: none;
}
}
.subject {
......
......@@ -23,11 +23,13 @@
*/
import { ON_PAGE, PostfachMailLinkRel } from '@alfa-client/postfach-shared';
import { FormatDateWithTimePipe, HasLinkPipe } from '@alfa-client/tech-shared';
import { getElementFromFixture } from '@alfa-client/test-utils';
import { getDebugElementFromFixtureByCss, getElementFromFixture } from '@alfa-client/test-utils';
import { registerLocaleData } from '@angular/common';
import localeDe from '@angular/common/locales/de';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatIcon } from '@angular/material/icon';
import { provideRouter, RouterLinkWithHref, RouterModule } from '@angular/router';
import { getDataTestClassOf, getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks';
import { createPostfachMailResource } from '../../../../../../../postfach-shared/test/postfach';
import { PostfachMailDateComponent } from '../postfach-mail-date/postfach-mail-date.component';
......@@ -39,7 +41,8 @@ describe('IncommingMailComponent', () => {
let component: IncommingMailComponent;
let fixture: ComponentFixture<IncommingMailComponent>;
const attachmentIcon: string = '[data-test-id="postfach-nachricht-attachment-icon"]';
const attachmentIcon: string = getDataTestIdOf('postfach-nachricht-attachment-icon');
const routing: string = getDataTestClassOf('incoming-mail-routing');
beforeEach(async () => {
await TestBed.configureTestingModule({
......@@ -51,7 +54,9 @@ describe('IncommingMailComponent', () => {
HasLinkPipe,
MatIcon,
],
imports: [RouterModule],
providers: [
provideRouter([]),
{
provide: ON_PAGE,
useValue: undefined,
......@@ -82,4 +87,26 @@ describe('IncommingMailComponent', () => {
expect(element).toBeInstanceOf(HTMLElement);
});
});
describe('routing should be', () => {
it('null on page site', () => {
component.onPage = false;
fixture.detectChanges();
const routerElement = getDebugElementFromFixtureByCss(fixture, routing);
const routerLinkInstance: RouterLinkWithHref = (<any>routerElement).injector.get(RouterLinkWithHref);
expect((<any>routerLinkInstance).routerLinkInput[0]).toEqual('postfach');
});
it('"postfach" on detail site', () => {
component.onPage = true;
fixture.detectChanges();
const routerElement = getDebugElementFromFixtureByCss(fixture, routing);
const routerLinkInstance: RouterLinkWithHref = (<any>routerElement).injector.get(RouterLinkWithHref);
expect((<any>routerLinkInstance).routerLinkInput).toBeNull();
});
});
});
......@@ -25,7 +25,8 @@
-->
<a
[ngClass]="{ error: postfachMail | hasLink: postfachNachrichtLinkRel.RESEND_POSTFACH_MAIL }"
routerLink="postfach"
[routerLink]="onPage ? null : 'postfach'"
data-test-class="outgoing-mail-routing"
>
<div class="mail-head">
<alfa-user-profile-in-postfach-mail-container
......@@ -53,9 +54,7 @@
>
</a>
<alfa-outgoing-mail-error-container
[postfachMailResource]="postfachMail"
></alfa-outgoing-mail-error-container>
<alfa-outgoing-mail-error-container [postfachMailResource]="postfachMail"></alfa-outgoing-mail-error-container>
<alfa-postfach-nachricht-edit-button-container
*ngIf="(postfachMail | hasLink: postfachNachrichtLinkRel.EDIT) && !onPage"
data-test-id="postfach-nachricht-edit-button-container"
......
......@@ -25,10 +25,6 @@ a {
text-decoration: none;
color: inherit;
:host-context(.postfach-links-disabled) {
pointer-events: none;
}
.message {
margin-bottom: 0.25rem;
}
......
......@@ -21,19 +21,21 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatIcon } from '@angular/material/icon';
import { ON_PAGE, PostfachMailLinkRel, PostfachMailResource } from '@alfa-client/postfach-shared';
import { HasLinkPipe, StateResource, createStateResource } from '@alfa-client/tech-shared';
import { createStateResource, HasLinkPipe, StateResource } from '@alfa-client/tech-shared';
import {
existsAsHtmlElement,
getDebugElementFromFixtureByCss,
getElementFromFixture,
getMockComponent,
notExistsAsHtmlElement,
} from '@alfa-client/test-utils';
import { UserProfileInPostfachMailContainerComponent } from '@alfa-client/user-profile';
import { VorgangWithEingangResource } from '@alfa-client/vorgang-shared';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatIcon } from '@angular/material/icon';
import { provideRouter, RouterLinkWithHref, RouterModule } from '@angular/router';
import { getDataTestClassOf, getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang';
import { MockComponent } from 'ng-mocks';
import { createPostfachMailResource } from '../../../../../../../postfach-shared/test/postfach';
......@@ -50,6 +52,8 @@ describe('OutgoingMailComponent', () => {
const postfachEditButton: string = getDataTestIdOf('postfach-nachricht-edit-button-container');
const postfachOutgoingNachrichtDate: string = getDataTestIdOf('postfach-outgoing-nachricht-date');
const routing: string = getDataTestClassOf('outgoing-mail-routing');
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
......@@ -62,7 +66,9 @@ describe('OutgoingMailComponent', () => {
MockComponent(PostfachMailDateComponent),
MockComponent(PostfachNachrichtEditButtonContainerComponent),
],
imports: [RouterModule],
providers: [
provideRouter([]),
{
provide: ON_PAGE,
useValue: undefined,
......@@ -95,9 +101,7 @@ describe('OutgoingMailComponent', () => {
});
describe('edit button container component', () => {
const postfachNachricht: PostfachMailResource = createPostfachMailResource([
PostfachMailLinkRel.EDIT,
]);
const postfachNachricht: PostfachMailResource = createPostfachMailResource([PostfachMailLinkRel.EDIT]);
describe('on existing edit link', () => {
beforeEach(() => {
......@@ -151,9 +155,7 @@ describe('OutgoingMailComponent', () => {
});
describe('in detail context', () => {
const postfachNachricht: PostfachMailResource = createPostfachMailResource([
PostfachMailLinkRel.EDIT,
]);
const postfachNachricht: PostfachMailResource = createPostfachMailResource([PostfachMailLinkRel.EDIT]);
beforeEach(() => {
component.onPage = true;
......@@ -185,4 +187,26 @@ describe('OutgoingMailComponent', () => {
notExistsAsHtmlElement(fixture, postfachOutgoingNachrichtDate);
});
});
describe('routing should be', () => {
it('null on page site', () => {
component.onPage = false;
fixture.detectChanges();
const routerElement = getDebugElementFromFixtureByCss(fixture, routing);
const routerLinkInstance: RouterLinkWithHref = routerElement.injector.get(RouterLinkWithHref);
expect((<any>routerLinkInstance).routerLinkInput[0]).toEqual('postfach');
});
it('"postfach" on detail site', () => {
component.onPage = true;
fixture.detectChanges();
const routerElement = getDebugElementFromFixtureByCss(fixture, routing);
const routerLinkInstance: RouterLinkWithHref = routerElement.injector.get(RouterLinkWithHref);
expect((<any>routerLinkInstance).routerLinkInput).toBeNull();
});
});
});
......@@ -26,11 +26,10 @@
<ozgcloud-spinner *ngIf="postfachMailListStateResource">
<alfa-postfach-mail
*ngFor="
let postfachMail of postfachMailListStateResource.resource
| toEmbeddedResources: postfachMailListLinkRel.POSTFACH_MAIL_LIST
let postfachMail of postfachMailListStateResource.resource | toEmbeddedResources: postfachMailListLinkRel.POSTFACH_MAIL_LIST
"
[attr.data-test-id]="(postfachMail.subject | convertForDataTest) + '-item'"
class="postfach postfach-links-disabled w-full lg:w-1/2"
class="postfach w-full lg:w-1/2"
[postfachMail]="postfachMail"
>
</alfa-postfach-mail>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment