Skip to content

Commit 040ce41

Browse files
committed
fix: textarea height with multiline placeholder
1 parent cdc4941 commit 040ce41

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ describe('AutocompleteTextareaComponent', () => {
468468

469469
it('should set initial height of the textarea based on value received', () => {
470470
const textarea = queryTextarea();
471-
textarea!.value = 'This is my \n multiline message';
471+
component.value = 'This is my \n multiline message';
472472
component.ngAfterViewInit();
473473
fixture.detectChanges();
474474

projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export class AutocompleteTextareaComponent
229229
'info',
230230
'[Autocomplete textarea] View inited'
231231
);
232-
if (this.messageInput.nativeElement.scrollHeight > 0) {
232+
if (this.messageInput.nativeElement.scrollHeight > 0 && this.value) {
233233
this.adjustTextareaHeight();
234234
}
235235
}

projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ describe('TextareaComponent', () => {
158158

159159
it('should set initial height of the textarea based on value received', () => {
160160
const textarea = queryTextarea();
161-
textarea!.value = 'This is my \n multiline message';
161+
component.value = 'This is my \n multiline message';
162162
component.ngAfterViewInit();
163163
fixture.detectChanges();
164164

projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class TextareaComponent
9494

9595
ngAfterViewInit(): void {
9696
this.isViewInited = true;
97-
if (this.messageInput.nativeElement.scrollHeight > 0) {
97+
if (this.messageInput.nativeElement.scrollHeight > 0 && this.value) {
9898
this.adjustTextareaHeight();
9999
}
100100
}

0 commit comments

Comments
 (0)