-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
756dd72
commit 85e2def
Showing
17 changed files
with
541 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
frontend/src/app/shared/dialog/alert-dialog/alert-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<section mat-dialog-title> | ||
<app-dialog-header [dialogTitle]="this.data.dialogTitle"></app-dialog-header> | ||
</section> | ||
|
||
<mat-dialog-content> | ||
@if (data.dialogText) { | ||
<div class="mb-3"> | ||
<span class="dialog-text">{{ this.data.dialogText }}</span> | ||
</div> | ||
} | ||
|
||
@if (data.dialogDetails) { | ||
<ul> | ||
@for (item of this.data.dialogDetails; track $index) { | ||
<div class="mb-3"> | ||
<li> | ||
<span class="dialog-text">{{ item }}</span> | ||
</li> | ||
</div> | ||
} | ||
</ul> | ||
} | ||
</mat-dialog-content> | ||
|
||
<mat-dialog-actions class="m-0"> | ||
<button color="primary" [attr.data-testId]="'alertDialog-confirm'" (click)="closeDialog()" mat-flat-button> | ||
Schliessen | ||
</button> | ||
</mat-dialog-actions> |
Empty file.
48 changes: 48 additions & 0 deletions
48
frontend/src/app/shared/dialog/alert-dialog/alert-dialog.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; | ||
import { HarnessLoader } from '@angular/cdk/testing'; | ||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; | ||
import { MatButtonHarness } from '@angular/material/button/testing'; | ||
import { AlertDialogComponent } from './alert-dialog.component'; | ||
|
||
const dialogMock = { | ||
close: jest.fn(), | ||
}; | ||
|
||
describe('AlertDialogComponent', () => { | ||
let component: AlertDialogComponent; | ||
let fixture: ComponentFixture<AlertDialogComponent>; | ||
let loader: HarnessLoader; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [AlertDialogComponent], | ||
imports: [], | ||
providers: [ | ||
{ provide: MAT_DIALOG_DATA, useValue: {} }, | ||
{ provide: MatDialogRef, useValue: dialogMock }, | ||
], | ||
}); | ||
fixture = TestBed.createComponent(AlertDialogComponent); | ||
component = fixture.componentInstance; | ||
loader = TestbedHarnessEnvironment.loader(fixture); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should have only one button', async () => { | ||
let buttons = await loader.getAllHarnesses(MatButtonHarness); | ||
expect(buttons.length).toBe(1); | ||
}); | ||
|
||
it('should call close method with no parameter', async () => { | ||
let buttons = await loader.getAllHarnesses(MatButtonHarness); | ||
const submitButton = buttons[0]; | ||
await submitButton.click(); | ||
|
||
expect(dialogMock.close).toHaveBeenCalledWith(); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
frontend/src/app/shared/dialog/alert-dialog/alert-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Component, Inject } from '@angular/core'; | ||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; | ||
|
||
export type AlertDialogData = { | ||
dialogTitle: string; | ||
dialogText?: string; | ||
dialogDetails?: string[]; | ||
}; | ||
|
||
@Component({ | ||
selector: 'app-alert-dialog', | ||
templateUrl: './alert-dialog.component.html', | ||
styleUrl: './alert-dialog.component.scss', | ||
}) | ||
export class AlertDialogComponent { | ||
constructor( | ||
@Inject(MAT_DIALOG_DATA) public data: AlertDialogData, | ||
private dialogRef: MatDialogRef<AlertDialogComponent>, | ||
) {} | ||
|
||
closeDialog() { | ||
this.dialogRef.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -370,6 +370,21 @@ export const testUser: User = { | |
email: '[email protected]', | ||
}; | ||
|
||
export const testOkrChampionUser: User = { | ||
id: 1, | ||
firstname: 'Hans', | ||
lastname: 'Muster', | ||
isOkrChampion: true, | ||
userTeamList: [ | ||
{ | ||
id: 1, | ||
team: team1, | ||
isTeamAdmin: false, | ||
}, | ||
], | ||
email: '[email protected]', | ||
}; | ||
|
||
export const users: User[] = [ | ||
testUser, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export interface UserOkrData { | ||
keyResults: UserKeyResultData[]; | ||
} | ||
|
||
export interface UserKeyResultData { | ||
keyResultId: number; | ||
keyResultName: string; | ||
objectiveId: number; | ||
objectiveName: string; | ||
} |
14 changes: 14 additions & 0 deletions
14
frontend/src/app/team-management/delete-user/delete-user.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<ng-container> | ||
<button | ||
(click)="deleteUser()" | ||
[attr.data-testId]="'delete-user'" | ||
class="mdc-button px-0 pe-2" | ||
color="primary" | ||
mat-button | ||
> | ||
<span class="d-flex align-items-center fw-bold add-text"> | ||
<img alt="Delete user button" class="add-cross-button" src="/assets/icons/delete-icon.svg" /> | ||
Member löschen | ||
</span> | ||
</button> | ||
</ng-container> |
9 changes: 9 additions & 0 deletions
9
frontend/src/app/team-management/delete-user/delete-user.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.new-team { | ||
display: flex; | ||
|
||
> mat-form-field { | ||
flex: 0 0 calc(35% + 1rem); | ||
padding-right: 1rem; | ||
box-sizing: border-box; | ||
} | ||
} |
Oops, something went wrong.