Skip to content

Commit

Permalink
feat: reflect validationIcon property (#8583)
Browse files Browse the repository at this point in the history
**Related Issue:** #8057

## Summary

- Reflect the `validationIcon` - brought up in
#8561 (comment)
- Add `validationIcon`, `validationMessage`, and `status` properties to
the reflects and defaults common tests - brought up in
#8561 (comment)
  • Loading branch information
benelan authored Jan 11, 2024
1 parent 4821594 commit b3d38b3
Show file tree
Hide file tree
Showing 18 changed files with 125 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ describe("calcite-combobox", () => {
propertyName: "scale",
defaultValue: "m",
},
{
propertyName: "status",
defaultValue: "idle",
},
{
propertyName: "validationIcon",
defaultValue: undefined,
},
{
propertyName: "validationMessage",
defaultValue: undefined,
},
]);
});

Expand Down Expand Up @@ -101,6 +113,14 @@ describe("calcite-combobox", () => {
propertyName: "selectionMode",
value: "single",
},
{
propertyName: "status",
value: "invalid",
},
{
propertyName: "validationIcon",
value: true,
},
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class Combobox
@Prop() validationMessage: string;

/** Specifies the validation icon to display under the component. */
@Prop() validationIcon: string | boolean;
@Prop({ reflect: true }) validationIcon: string | boolean;

/**
* Specifies the name of the component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ describe("calcite-input-date-picker", () => {
propertyName: "flipPlacements",
defaultValue: undefined,
},
{
propertyName: "status",
defaultValue: "idle",
},
{
propertyName: "validationIcon",
defaultValue: undefined,
},
{
propertyName: "validationMessage",
defaultValue: undefined,
},
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export class InputDatePicker
@Prop() validationMessage: string;

/** Specifies the validation icon to display under the component. */
@Prop() validationIcon: string | boolean;
@Prop({ reflect: true }) validationIcon: string | boolean;

/**
* Specifies the name of the component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ describe("calcite-input-number", () => {
propertyName: "scale",
value: "s",
},
{
propertyName: "validationIcon",
value: true,
},
]);
});

Expand All @@ -85,6 +89,14 @@ describe("calcite-input-number", () => {
propertyName: "value",
defaultValue: "",
},
{
propertyName: "validationIcon",
defaultValue: undefined,
},
{
propertyName: "validationMessage",
defaultValue: undefined,
},
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class InputNumber
@Prop() validationMessage: string;

/** Specifies the validation icon to display under the component. */
@Prop() validationIcon: string | boolean;
@Prop({ reflect: true }) validationIcon: string | boolean;

/**
* Specifies the name of the component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ describe("calcite-input-text", () => {
propertyName: "scale",
value: "s",
},
{
propertyName: "validationIcon",
value: true,
},
]);
});

Expand All @@ -62,6 +66,14 @@ describe("calcite-input-text", () => {
propertyName: "value",
defaultValue: "",
},
{
propertyName: "validationIcon",
defaultValue: undefined,
},
{
propertyName: "validationMessage",
defaultValue: undefined,
},
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class InputText
@Prop() validationMessage: string;

/** Specifies the validation icon to display under the component. */
@Prop() validationIcon: string | boolean;
@Prop({ reflect: true }) validationIcon: string | boolean;

/**
* Specifies the name of the component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ describe("calcite-input-time-picker", () => {
{ propertyName: "scale", defaultValue: "m" },
{ propertyName: "step", defaultValue: 60 },
{ propertyName: "overlayPositioning", defaultValue: "absolute" },
{ propertyName: "status", defaultValue: "idle" },
{ propertyName: "validationIcon", defaultValue: undefined },
{ propertyName: "validationMessage", defaultValue: undefined },
]);
});

Expand All @@ -75,6 +78,8 @@ describe("calcite-input-time-picker", () => {
{ propertyName: "open", value: true },
{ propertyName: "disabled", value: true },
{ propertyName: "scale", value: "m" },
{ propertyName: "status", value: "invalid" },
{ propertyName: "validationIcon", value: true },
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class InputTimePicker
@Prop() validationMessage: string;

/** Specifies the validation icon to display under the component. */
@Prop() validationIcon: string | boolean;
@Prop({ reflect: true }) validationIcon: string | boolean;

/** Specifies the name of the component on form submission. */
@Prop() name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ describe("calcite-input-time-zone", () => {
{ propertyName: "open", value: true },
{ propertyName: "scale", value: "m" },
{ propertyName: "overlayPositioning", value: "absolute" },
{ propertyName: "status", value: "invalid" },
{ propertyName: "validationIcon", value: true },
]);
});

Expand All @@ -94,6 +96,9 @@ describe("calcite-input-time-zone", () => {
{ propertyName: "open", defaultValue: false },
{ propertyName: "overlayPositioning", defaultValue: "absolute" },
{ propertyName: "scale", defaultValue: "m" },
{ propertyName: "status", defaultValue: "idle" },
{ propertyName: "validationIcon", defaultValue: undefined },
{ propertyName: "validationMessage", defaultValue: undefined },
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class InputTimeZone
@Prop() validationMessage: string;

/** Specifies the validation icon to display under the component. */
@Prop() validationIcon: string | boolean;
@Prop({ reflect: true }) validationIcon: string | boolean;

/**
* Specifies the name of the component.
Expand Down
12 changes: 12 additions & 0 deletions packages/calcite-components/src/components/input/input.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ describe("calcite-input", () => {
propertyName: "scale",
value: "s",
},
{
propertyName: "validationIcon",
value: true,
},
]);
});

Expand Down Expand Up @@ -93,6 +97,14 @@ describe("calcite-input", () => {
propertyName: "value",
defaultValue: "",
},
{
propertyName: "validationIcon",
defaultValue: undefined,
},
{
propertyName: "validationMessage",
defaultValue: undefined,
},
]);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/calcite-components/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class Input
@Prop() validationMessage: string;

/** Specifies the validation icon to display under the component. */
@Prop() validationIcon: string | boolean;
@Prop({ reflect: true }) validationIcon: string | boolean;

/**
* Specifies the name of the component.
Expand Down
18 changes: 18 additions & 0 deletions packages/calcite-components/src/components/select/select.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { E2EElement, E2EPage, newE2EPage } from "@stencil/core/testing";
import {
accessible,
disabled,
defaults,
focusable,
formAssociated,
labelable,
Expand Down Expand Up @@ -37,6 +38,15 @@ describe("calcite-select", () => {
focusable(simpleTestMarkup);
});

describe("defaults", () => {
defaults("calcite-select", [
{ propertyName: "scale", defaultValue: "m" },
{ propertyName: "status", defaultValue: "idle" },
{ propertyName: "validationIcon", defaultValue: undefined },
{ propertyName: "validationMessage", defaultValue: undefined },
]);
});

describe("reflects", () => {
reflects(simpleTestMarkup, [
{
Expand All @@ -47,6 +57,14 @@ describe("calcite-select", () => {
propertyName: "scale",
value: "m",
},
{
propertyName: "status",
value: "invalid",
},
{
propertyName: "validationIcon",
value: true,
},
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class Select
@Prop() validationMessage: string;

/** Specifies the validation icon to display under the component. */
@Prop() validationIcon: string | boolean;
@Prop({ reflect: true }) validationIcon: string | boolean;

/**
* Specifies the name of the component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ describe("calcite-text-area", () => {
propertyName: "scale",
defaultValue: "m",
},
{
propertyName: "status",
defaultValue: "idle",
},
{
propertyName: "validationIcon",
defaultValue: undefined,
},
{
propertyName: "validationMessage",
defaultValue: undefined,
},
]);
});

Expand Down Expand Up @@ -58,6 +70,14 @@ describe("calcite-text-area", () => {
propertyName: "scale",
value: "s",
},
{
propertyName: "status",
value: "invalid",
},
{
propertyName: "validationIcon",
value: true,
},
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class TextArea
@Prop() validationMessage: string;

/** Specifies the validation icon to display under the component. */
@Prop() validationIcon: string | boolean;
@Prop({ reflect: true }) validationIcon: string | boolean;

/**
* Specifies the name of the component.
Expand Down

0 comments on commit b3d38b3

Please sign in to comment.