diff options
author | KrupaNagabhushan <krupa.nagabhushan@est.tech> | 2023-03-07 23:36:41 +0000 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2023-03-10 11:25:21 +0000 |
commit | 86c6a41b4ecf80b9edf554120ddebf572599c679 (patch) | |
tree | 6f47253ea40a68d76eb2f82eaa053ea52496c214 /catalog-ui/src/app/ng2/pages/properties-assignment/declare-input | |
parent | d03be99cba81d17bfb8681c18acf212eec9549ea (diff) |
Provide input name suggestion
Issue-ID: SDC-4427
Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Change-Id: Ib8cebd494f900bd7f338ee4b34c7bc380a6bd07c
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/properties-assignment/declare-input')
3 files changed, 21 insertions, 5 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.html index 19b23598fa..e5793d5d7a 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.html +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.html @@ -18,5 +18,5 @@ --> <div class="declare-input"> - <input id="myText" type="text" (keyup)="setInputName($event)"/> + <input id="myText" type="text" value={{defaultInputName}} (keyup)="setInputName($event)"/> </div> diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.spec.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.spec.ts index c3fa1f506f..96bf9ad2da 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.spec.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.spec.ts @@ -19,25 +19,33 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DeclareInputComponent } from './declare-input.component'; +import {ModalService} from "../../../services/modal.service"; +import {DynamicComponentService} from "../../../services/dynamic-component.service"; describe('DeclareInputComponent', () => { let component: DeclareInputComponent; let fixture: ComponentFixture<DeclareInputComponent>; + let modalService: ModalService; + let dynamicComponentService: DynamicComponentService; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ DeclareInputComponent ] + declarations: [ DeclareInputComponent ], + providers: [ ModalService, DynamicComponentService] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(DeclareInputComponent); + modalService = TestBed.get(ModalService); + dynamicComponentService = TestBed.get(DynamicComponentService); component = fixture.componentInstance; - fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); + expect(modalService).toBeTruthy(); + expect(dynamicComponentService).toBeTruthy(); }); }); diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.ts index d156383f6b..f5acfa400b 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.ts @@ -16,8 +16,9 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -import {Component, Input, OnInit} from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {FormControl, FormGroup} from "@angular/forms"; +import {ModalService} from "../../../services/modal.service"; @Component({ selector: 'declare-input', @@ -29,9 +30,16 @@ export class DeclareInputComponent implements OnInit { 'inputName': this.inputNameForm, }); inputName: string; - constructor() { } + defaultInputName: string; + + constructor(private modalService: ModalService) { + } + ngOnInit() { + this.defaultInputName = this.modalService.currentModal.instance.dynamicContent.instance.input.defaultInputName; + this.inputNameForm.setValue(this.defaultInputName); } + setInputName(event) { this.inputName = event.target.value; this.inputNameForm.setValue(this.inputName); |