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

OZG-6302 OZG-6402; OZG-6302 OZG-6403

parent dc006716
No related branches found
No related tags found
No related merge requests found
Showing
with 129 additions and 3 deletions
<form [formGroup]="formService.form">
<ods-text-editor
label="Titel"
[formControlName]="formServiceClass.FIELD_TITLE"
[isRequired]="true"
></ods-text-editor>
<ods-textarea-editor
label="Nachricht"
[formControlName]="formServiceClass.FIELD_NACHRICHT"
[isRequired]="true"
></ods-textarea-editor>
</form>
import { Mock, mock } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { TextEditorComponent, TextareaEditorComponent } from '@ods/component';
import { MockComponent } from 'ng-mocks';
import { CollaborationRequestFormComponent } from './collaboration-request-form.component';
import { CollaborationRequestFormService } from './collaboration.request.formservice';
describe('CollaborationRequestFormComponent', () => {
let component: CollaborationRequestFormComponent;
let fixture: ComponentFixture<CollaborationRequestFormComponent>;
const formService: Mock<CollaborationRequestFormService> = mock(CollaborationRequestFormService);
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ReactiveFormsModule],
declarations: [
CollaborationRequestFormComponent,
MockComponent(TextEditorComponent),
MockComponent(TextareaEditorComponent),
],
providers: [
{
provide: CollaborationRequestFormService,
useValue: formService,
},
],
}).compileComponents();
fixture = TestBed.createComponent(CollaborationRequestFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import { CollaborationRequestFormService } from './collaboration.request.formservice';
@Component({
selector: 'alfa-collaboration-request-form',
templateUrl: './collaboration-request-form.component.html',
providers: [CollaborationRequestFormService],
})
export class CollaborationRequestFormComponent {
constructor(readonly formService: CollaborationRequestFormService) {}
public readonly formServiceClass = CollaborationRequestFormService;
}
import { UntypedFormBuilder } from '@angular/forms';
import { CollaborationRequestFormService } from './collaboration.request.formservice';
describe('CollaborationRequestFormService', () => {
let formService: CollaborationRequestFormService;
const formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
beforeEach(() => {
formService = new CollaborationRequestFormService(formBuilder);
});
it('should create', () => {
expect(formService).toBeTruthy();
});
});
import { CommandResource } from '@alfa-client/command-shared';
import { AbstractFormService, EMPTY_STRING, StateResource } from '@alfa-client/tech-shared';
import { Injectable } from '@angular/core';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
import { Observable, of } from 'rxjs';
@Injectable()
export class CollaborationRequestFormService extends AbstractFormService {
public static readonly FIELD_TITLE = 'titel';
public static readonly FIELD_NACHRICHT = 'nachricht';
constructor(formBuilder: UntypedFormBuilder) {
super(formBuilder);
}
protected initForm(): UntypedFormGroup {
return this.formBuilder.group({
[CollaborationRequestFormService.FIELD_TITLE]: new UntypedFormControl(null),
[CollaborationRequestFormService.FIELD_NACHRICHT]: new UntypedFormControl(null),
});
}
protected doSubmit(): Observable<StateResource<CommandResource>> {
return of();
}
protected getPathPrefix(): string {
return EMPTY_STRING;
}
}
......@@ -7,6 +7,9 @@ ICON_PLATZHALTER
<ods-save-icon icon class="fill-text"></ods-save-icon>
</ods-button>
<alfa-collaboration-request-form></alfa-collaboration-request-form>
<ods-button text="Zuarbeit anfragen" data-test-id="zuarbeit-anfragen-button"></ods-button>
<ods-button
variant="outline"
text="Abbrechen"
......
......@@ -3,6 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ButtonComponent, CloseIconComponent, SaveIconComponent } from '@ods/system';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks';
import { CollaborationRequestFormComponent } from './collaboration-request-form/collaboration-request-form.component';
import { ZustaendigeStelleContainerComponent } from './zustaendige-stelle-container.component';
describe('ZustaendigeStelleContainerComponent', () => {
......@@ -18,6 +19,7 @@ describe('ZustaendigeStelleContainerComponent', () => {
ZustaendigeStelleContainerComponent,
MockComponent(SaveIconComponent),
MockComponent(CloseIconComponent),
MockComponent(CollaborationRequestFormComponent),
],
}).compileComponents();
......
import { CollaborationSharedModule } from '@alfa-client/collaboration-shared';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TextEditorComponent, TextareaEditorComponent } from '@ods/component';
import {
ButtonComponent,
CloseIconComponent,
......@@ -8,6 +10,7 @@ import {
SaveIconComponent,
} from '@ods/system';
import { CollaborationInVorgangContainerComponent } from './collaboration-in-vorgang-container/collaboration-in-vorgang-container.component';
import { CollaborationRequestFormComponent } from './collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component';
import { ZustaendigeStelleContainerComponent } from './collaboration-in-vorgang-container/zustaendige-stelle-container/zustaendige-stelle-container.component';
@NgModule({
......@@ -18,8 +21,16 @@ import { ZustaendigeStelleContainerComponent } from './collaboration-in-vorgang-
CloseIconComponent,
CollaborationSharedModule,
CollaborationIconComponent,
TextEditorComponent,
TextareaEditorComponent,
FormsModule,
ReactiveFormsModule,
],
declarations: [
CollaborationInVorgangContainerComponent,
ZustaendigeStelleContainerComponent,
CollaborationRequestFormComponent,
],
declarations: [CollaborationInVorgangContainerComponent, ZustaendigeStelleContainerComponent],
exports: [CollaborationInVorgangContainerComponent],
})
export class CollaborationModule {}
......@@ -79,7 +79,6 @@
"@storybook/core-server": "^8.1.4",
"@swc-node/register": "1.9.1",
"@swc/core": "~1.5.7",
"@swc/helpers": "~0.5.2",
"@testing-library/jest-dom": "6.4.5",
"@types/file-saver": "2.0.7",
"@types/jest": "29.4.4",
......@@ -15268,7 +15267,8 @@
"version": "0.5.12",
"resolved": "http://nexus.ozg-sh.de/repository/npm-proxy/@swc/helpers/-/helpers-0.5.12.tgz",
"integrity": "sha512-KMZNXiGibsW9kvZAO1Pam2JPTDBm+KSHMMHWdsyI/1DbIZjT2A6Gy3hblVXUMEDvUAKq+e0vL0X0o54owWji7g==",
"devOptional": true,
"optional": true,
"peer": true,
"dependencies": {
"tslib": "^2.4.0"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment