diff --git a/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.spec.ts b/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.spec.ts index c7461d1d..eca0b211 100644 --- a/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.spec.ts +++ b/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.spec.ts @@ -473,7 +473,7 @@ describe('AutocompleteTextareaComponent', () => { it('should set initial height of the textarea based on value received', () => { const textarea = queryTextarea(); - textarea!.value = 'This is my \n multiline message'; + component.value = 'This is my \n multiline message'; component.ngAfterViewInit(); fixture.detectChanges(); diff --git a/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.ts b/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.ts index d8de3651..62c7df91 100644 --- a/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.ts +++ b/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.ts @@ -208,7 +208,7 @@ export class AutocompleteTextareaComponent 'info', '[Autocomplete textarea] View inited' ); - if (this.messageInput.nativeElement.scrollHeight > 0) { + if (this.messageInput.nativeElement.scrollHeight > 0 && this.value) { this.adjustTextareaHeight(); } } diff --git a/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.spec.ts b/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.spec.ts index 0fcfd50a..c753e699 100644 --- a/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.spec.ts +++ b/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.spec.ts @@ -163,7 +163,7 @@ describe('TextareaComponent', () => { it('should set initial height of the textarea based on value received', () => { const textarea = queryTextarea(); - textarea!.value = 'This is my \n multiline message'; + component.value = 'This is my \n multiline message'; component.ngAfterViewInit(); fixture.detectChanges(); diff --git a/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.ts b/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.ts index 8243da7b..30e15803 100644 --- a/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.ts +++ b/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.ts @@ -81,7 +81,7 @@ export class TextareaComponent } ngAfterViewInit(): void { - if (this.messageInput.nativeElement.scrollHeight > 0) { + if (this.messageInput.nativeElement.scrollHeight > 0 && this.value) { this.adjustTextareaHeight(); } }