|
1 | 1 | import { newE2EPage } from "@arcgis/lumina-compiler/puppeteerTesting";
|
2 | 2 | import { describe, expect, it } from "vitest";
|
3 |
| -import { focusable, renders, hidden, disabled } from "../../tests/commonTests"; |
| 3 | +import { focusable, renders, hidden, disabled, themed } from "../../tests/commonTests"; |
| 4 | +import { ComponentTestTokens } from "../../tests/commonTests/themed"; |
| 5 | +import { CSS } from "./resources"; |
4 | 6 |
|
5 | 7 | describe("calcite-dropdown-item", () => {
|
6 | 8 | describe("renders", () => {
|
@@ -50,4 +52,95 @@ describe("calcite-dropdown-item", () => {
|
50 | 52 |
|
51 | 53 | expect(itemChangeSpy).toHaveReceivedEventTimes(3);
|
52 | 54 | });
|
| 55 | + |
| 56 | + describe("theme", () => { |
| 57 | + describe("default", () => { |
| 58 | + const tokens: ComponentTestTokens = { |
| 59 | + "--calcite-dropdown-item-text-color": { |
| 60 | + targetProp: "color", |
| 61 | + shadowSelector: `.${CSS.container}`, |
| 62 | + selector: `calcite-dropdown-item`, |
| 63 | + }, |
| 64 | + "--calcite-dropdown-item-background-color-hover": { |
| 65 | + targetProp: "backgroundColor", |
| 66 | + shadowSelector: `.${CSS.container}`, |
| 67 | + state: "hover", |
| 68 | + selector: `calcite-dropdown-item`, |
| 69 | + }, |
| 70 | + "--calcite-dropdown-item-background-color-press": { |
| 71 | + targetProp: "backgroundColor", |
| 72 | + shadowSelector: `.${CSS.container}`, |
| 73 | + state: { press: `calcite-dropdown-item >>> .${CSS.container}` }, |
| 74 | + selector: `calcite-dropdown-item`, |
| 75 | + }, |
| 76 | + "--calcite-dropdown-item-icon-color-hover": { |
| 77 | + targetProp: "color", |
| 78 | + shadowSelector: `.${CSS.icon}`, |
| 79 | + state: "hover", |
| 80 | + selector: "calcite-dropdown-item", |
| 81 | + }, |
| 82 | + "--calcite-dropdown-item-text-color-press": [ |
| 83 | + { |
| 84 | + targetProp: "color", |
| 85 | + shadowSelector: `.${CSS.container}`, |
| 86 | + selector: "calcite-dropdown-item", |
| 87 | + state: "focus", |
| 88 | + }, |
| 89 | + { |
| 90 | + targetProp: "color", |
| 91 | + shadowSelector: `.${CSS.container}`, |
| 92 | + selector: "calcite-dropdown-item", |
| 93 | + state: "hover", |
| 94 | + }, |
| 95 | + { |
| 96 | + targetProp: "color", |
| 97 | + shadowSelector: `.${CSS.link}`, |
| 98 | + selector: "calcite-dropdown-item", |
| 99 | + state: "hover", |
| 100 | + }, |
| 101 | + { |
| 102 | + targetProp: "color", |
| 103 | + shadowSelector: `.${CSS.container}`, |
| 104 | + selector: "calcite-dropdown-item", |
| 105 | + state: { press: `calcite-dropdown-item >>> .${CSS.container}` }, |
| 106 | + }, |
| 107 | + { |
| 108 | + targetProp: "color", |
| 109 | + shadowSelector: `.${CSS.link}`, |
| 110 | + selector: "calcite-dropdown-item", |
| 111 | + state: { press: `calcite-dropdown-item >>> .${CSS.container}` }, |
| 112 | + }, |
| 113 | + ], |
| 114 | + }; |
| 115 | + themed( |
| 116 | + `<calcite-dropdown open> |
| 117 | + <calcite-dropdown-item href="esri.com">1</calcite-dropdown-item> |
| 118 | + <calcite-dropdown-item>2</calcite-dropdown-item> |
| 119 | + </calcite-dropdown>`, |
| 120 | + tokens, |
| 121 | + ); |
| 122 | + }); |
| 123 | + describe("selected", () => { |
| 124 | + const tokens: ComponentTestTokens = { |
| 125 | + "--calcite-dropdown-item-icon-color-press": { |
| 126 | + targetProp: "color", |
| 127 | + shadowSelector: `calcite-icon`, |
| 128 | + selector: `calcite-dropdown-item`, |
| 129 | + }, |
| 130 | + "--calcite-dropdown-item-text-color-press": { |
| 131 | + targetProp: "color", |
| 132 | + shadowSelector: `.${CSS.container}`, |
| 133 | + selector: `calcite-dropdown-item`, |
| 134 | + }, |
| 135 | + }; |
| 136 | + themed( |
| 137 | + `<calcite-dropdown selectionMode="multiple" open> |
| 138 | + <calcite-dropdown-item href="esri.com" selected icon-start="home">1</calcite-dropdown-item> |
| 139 | + <calcite-dropdown-item href="esri.com" selected>2</calcite-dropdown-item> |
| 140 | + <calcite-dropdown-item selected class="selected">3</calcite-dropdown-item> |
| 141 | + </calcite-dropdown>`, |
| 142 | + tokens, |
| 143 | + ); |
| 144 | + }); |
| 145 | + }); |
53 | 146 | });
|
0 commit comments