Skip to content

Commit f87ef36

Browse files
authored
fix(select): clear placeholder on value select #432 (#433)
1 parent 9e8e51f commit f87ef36

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

tedi/components/form/select/select.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
type="text"
6262
class="tedi-select__search-input"
6363
[class.tedi-select__search-input--hidden]="showSingleSelectedValue()"
64-
[placeholder]="placeholder()"
64+
[placeholder]="showSingleSelectedValue() ? '' : placeholder()"
6565
[value]="searchTerm()"
6666
[disabled]="disabled()"
6767
(input)="onSearchInput($event)"

tedi/components/form/select/select.component.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,20 @@ describe("SelectComponent", () => {
548548
expect(select.searchTerm()).toBe("");
549549
}));
550550

551+
it("should not show placeholder on search input after a value is selected", fakeAsync(() => {
552+
getTrigger().click();
553+
fixture.detectChanges();
554+
tick();
555+
556+
const options = getOptions();
557+
options[0].click();
558+
fixture.detectChanges();
559+
tick();
560+
561+
const input = getSearchInput();
562+
expect(input.getAttribute("placeholder")).toBe("");
563+
}));
564+
551565
it("should open dropdown when typing", fakeAsync(() => {
552566
const input = getSearchInput();
553567
input.value = "O";

0 commit comments

Comments
 (0)