From d40b080f9ffd2e5ed5b17d1d2d25b53bd99aab8c Mon Sep 17 00:00:00 2001 From: Stanslav Zaytsev Date: Mon, 26 Feb 2024 16:57:44 +0300 Subject: [PATCH] refactor(demo-integrations): optimized using maxLength prop in TestInput --- .../src/tests/component-testing/utils.ts | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/projects/demo-integrations/src/tests/component-testing/utils.ts b/projects/demo-integrations/src/tests/component-testing/utils.ts index 51b05fe8b..f5aedfa3a 100644 --- a/projects/demo-integrations/src/tests/component-testing/utils.ts +++ b/projects/demo-integrations/src/tests/component-testing/utils.ts @@ -1,12 +1,4 @@ -import { - AfterViewInit, - Component, - ElementRef, - EventEmitter, - Input, - Output, - ViewChild, -} from '@angular/core'; +import {Component, EventEmitter, Input, Output} from '@angular/core'; import {MaskitoDirective} from '@maskito/angular'; import {MaskitoOptions} from '@maskito/core'; @@ -16,16 +8,14 @@ import {MaskitoOptions} from '@maskito/core'; template: ` `, }) -export class TestInput implements AfterViewInit { - @ViewChild('inputElemnt') - inputElement!: ElementRef; - +export class TestInput { @Input() initialValue = ''; @@ -36,11 +26,5 @@ export class TestInput implements AfterViewInit { input = new EventEmitter(); @Input() - maxLength?: number; - - ngAfterViewInit(): void { - if (this.maxLength) { - this.inputElement.nativeElement.maxLength = this.maxLength; - } - } + maxLength?: number | null = null; }