Skip to content

Commit

Permalink
test(text-area): add component token E2E tests (#9729)
Browse files Browse the repository at this point in the history
✨🧪✨
  • Loading branch information
jcfranco authored Jul 5, 2024
1 parent b9c6733 commit 94fb823
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export const CSS = {
readOnly: "readonly",
textAreaInvalid: "text-area--invalid",
footerSlotted: "footer--slotted",
borderColor: "border--color",
hide: "hide",
blockSizeFull: "block-size--full",
footerEndSlotOnly: "footer--end-only",
textArea: "text-area",
textAreaOnly: "text-area--only",
};

export const SLOTS = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
reflects,
renders,
t9n,
themed,
} from "../../tests/commonTests";
import { html } from "../../../support/formatting";
import { CSS } from "./resources";
Expand Down Expand Up @@ -201,4 +202,65 @@ describe("calcite-text-area", () => {
describe("translation support", () => {
t9n("calcite-text-area");
});

describe("theme", () => {
describe("default", () => {
themed(html`<calcite-text-area placeholder="hello"></calcite-text-area>`, {
"--calcite-text-area-background-color": [
{
shadowSelector: `.${CSS.textArea}`,
targetProp: "backgroundColor",
},
{
shadowSelector: `.${CSS.footer}`,
targetProp: "backgroundColor",
},
],
"--calcite-text-area-border-color": {
shadowSelector: `.${CSS.textArea}`,
targetProp: "borderColor",
},
"--calcite-text-area-text-color": {
shadowSelector: `.${CSS.textArea}`,
targetProp: "color",
},
"--calcite-text-area-placeholder-text-color": {
shadowSelector: `.${CSS.textArea}::placeholder`,
targetProp: "color",
},
});
});

describe("max-chars", () => {
themed(html`<calcite-text-area max-length="10"></calcite-text-area>`, {
"--calcite-text-area-divider-color": {
shadowSelector: `.${CSS.textArea}`,
targetProp: "borderBlockEndColor",
},
"--calcite-text-area-footer-border-color": [
{
shadowSelector: `.${CSS.footer}`,
targetProp: "borderBottomColor",
},
{
shadowSelector: `.${CSS.footer}`,
targetProp: "borderLeftColor",
},
{
shadowSelector: `.${CSS.footer}`,
targetProp: "borderRightColor",
},
],
});
});

describe("over limit", () => {
themed(html`<calcite-text-area max-length="4" value="12345"></calcite-text-area>`, {
"--calcite-text-area-character-limit-text-color": {
shadowSelector: `.${CSS.characterLimit}`,
targetProp: "color",
},
});
});
});
});
Loading

0 comments on commit 94fb823

Please sign in to comment.