Skip to content

Commit

Permalink
fix: textarea height with multiline placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed Sep 4, 2024
1 parent f1570aa commit 42fcdd6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit 42fcdd6

Please sign in to comment.