Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
feat(filter): add placeholder property (#854)
Browse files Browse the repository at this point in the history
Deprecates `textPlaceholder`.
  • Loading branch information
jcfranco authored Feb 27, 2020
1 parent c0d3a7e commit dec10b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/calcite-filter/calcite-filter.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("calcite-filter", () => {
it("should update the filter placeholder when a string is provided", async () => {
const page = await newE2EPage();
const placeholderText = "hide em";
await page.setContent(`<calcite-filter text-placeholder="${placeholderText}"></calcite-filter>`);
await page.setContent(`<calcite-filter placeholder="${placeholderText}"></calcite-filter>`);

const input = await page.find(`calcite-filter >>> input`);
expect(await input.getProperty("placeholder")).toBe(placeholderText);
Expand Down
11 changes: 9 additions & 2 deletions src/components/calcite-filter/calcite-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export class CalciteFilter {
*/
@Prop() intlLabel?: string;

/**
* Placeholder text for the input element's placeholder attribute
*/
@Prop() placeholder?: string;

/**
* A text label that will appear next to the input field.
*
Expand All @@ -41,8 +46,10 @@ export class CalciteFilter {

/**
* Placeholder text for the input element's placeholder attribute
*
* @deprecated since 5.4.0 - use "placeholder" instead.
*/
@Prop() textPlaceholder: string;
@Prop() textPlaceholder?: string;

// --------------------------------------------------------------------------
//
Expand Down Expand Up @@ -129,7 +136,7 @@ export class CalciteFilter {
<input
type="text"
value=""
placeholder={this.textPlaceholder}
placeholder={this.placeholder || this.textPlaceholder}
onInput={this.inputHandler}
aria-label={this.intlLabel || this.textLabel || TEXT.filterLabel}
ref={(el) => (this.textInput = el as HTMLInputElement)}
Expand Down

0 comments on commit dec10b1

Please sign in to comment.