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 cdc4941 commit 040ce41
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 @@ -468,7 +468,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 @@ -229,7 +229,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 @@ -158,7 +158,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 @@ -94,7 +94,7 @@ export class TextareaComponent

ngAfterViewInit(): void {
this.isViewInited = true;
if (this.messageInput.nativeElement.scrollHeight > 0) {
if (this.messageInput.nativeElement.scrollHeight > 0 && this.value) {
this.adjustTextareaHeight();
}
}
Expand Down

0 comments on commit 040ce41

Please sign in to comment.