@spectrum-web-components/action-button 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/package.json +8 -7
- package/stories/action-button-black-quiet.stories.js +41 -0
- package/stories/action-button-black-quiet.stories.js.map +7 -0
- package/stories/action-button-black.stories.js +35 -0
- package/stories/action-button-black.stories.js.map +7 -0
- package/stories/action-button-emphasized-quiet.stories.js +39 -0
- package/stories/action-button-emphasized-quiet.stories.js.map +7 -0
- package/stories/action-button-emphasized.stories.js +33 -0
- package/stories/action-button-emphasized.stories.js.map +7 -0
- package/stories/action-button-quiet.stories.js +33 -0
- package/stories/action-button-quiet.stories.js.map +7 -0
- package/stories/action-button-standard.stories.js +27 -0
- package/stories/action-button-standard.stories.js.map +7 -0
- package/stories/action-button-white-quiet.stories.js +41 -0
- package/stories/action-button-white-quiet.stories.js.map +7 -0
- package/stories/action-button-white.stories.js +35 -0
- package/stories/action-button-white.stories.js.map +7 -0
- package/stories/action-button.stories.js +38 -0
- package/stories/action-button.stories.js.map +7 -0
- package/stories/index.js +86 -0
- package/stories/index.js.map +7 -0
- package/test/action-button-black-quiet.test-vrt.js +5 -0
- package/test/action-button-black-quiet.test-vrt.js.map +7 -0
- package/test/action-button-black.test-vrt.js +5 -0
- package/test/action-button-black.test-vrt.js.map +7 -0
- package/test/action-button-emphasized-quiet.test-vrt.js +5 -0
- package/test/action-button-emphasized-quiet.test-vrt.js.map +7 -0
- package/test/action-button-emphasized.test-vrt.js +5 -0
- package/test/action-button-emphasized.test-vrt.js.map +7 -0
- package/test/action-button-memory.test.js +5 -0
- package/test/action-button-memory.test.js.map +7 -0
- package/test/action-button-quiet.test-vrt.js +5 -0
- package/test/action-button-quiet.test-vrt.js.map +7 -0
- package/test/action-button-standard.test-vrt.js +5 -0
- package/test/action-button-standard.test-vrt.js.map +7 -0
- package/test/action-button-white-quiet.test-vrt.js +5 -0
- package/test/action-button-white-quiet.test-vrt.js.map +7 -0
- package/test/action-button-white.test-vrt.js +5 -0
- package/test/action-button-white.test-vrt.js.map +7 -0
- package/test/action-button.test-vrt.js +5 -0
- package/test/action-button.test-vrt.js.map +7 -0
- package/test/action-button.test.js +273 -0
- package/test/action-button.test.js.map +7 -0
- package/test/benchmark/basic-test.js +19 -0
- package/test/benchmark/basic-test.js.map +7 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import "@spectrum-web-components/action-group/sp-action-group.js";
|
|
4
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js";
|
|
5
|
+
import { renderButton } from "./index.js";
|
|
6
|
+
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
7
|
+
export default {
|
|
8
|
+
component: "sp-action-button",
|
|
9
|
+
title: "Action Button"
|
|
10
|
+
};
|
|
11
|
+
function renderButtonsSelected(args) {
|
|
12
|
+
const disabled = Object.assign({}, args, { disabled: true });
|
|
13
|
+
const selected = Object.assign({}, args, { selected: true });
|
|
14
|
+
return html`
|
|
15
|
+
<sp-action-group
|
|
16
|
+
?emphasized="${!!args.emphasized}"
|
|
17
|
+
?quiet="${!!args.quiet}"
|
|
18
|
+
>
|
|
19
|
+
${renderButton(args)} ${renderButton(selected)}
|
|
20
|
+
${renderButton(disabled)}
|
|
21
|
+
</sp-action-group>
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
export const toggles = (args) => renderButtonsSelected(args);
|
|
25
|
+
toggles.args = {
|
|
26
|
+
toggles: true,
|
|
27
|
+
icon: html`
|
|
28
|
+
<sp-icon-edit hidden slot="icon"></sp-icon-edit>
|
|
29
|
+
`
|
|
30
|
+
};
|
|
31
|
+
export const href = (args) => renderButtonsSelected(args);
|
|
32
|
+
href.args = {
|
|
33
|
+
href: "https://github.com/adobe/spectrum-web-components",
|
|
34
|
+
icon: html`
|
|
35
|
+
<sp-icon-edit hidden slot="icon"></sp-icon-edit>
|
|
36
|
+
`
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=action-button.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button.stories.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';\nimport type { Properties } from './index.js';\nimport { renderButton } from './index.js';\n\nimport '@spectrum-web-components/action-button/sp-action-button.js';\n\nexport default {\n component: 'sp-action-button',\n title: 'Action Button',\n};\n\nfunction renderButtonsSelected(args: Properties): TemplateResult {\n const disabled = Object.assign({}, args, { disabled: true });\n const selected = Object.assign({}, args, { selected: true });\n return html`\n <sp-action-group\n ?emphasized=\"${!!args.emphasized}\"\n ?quiet=\"${!!args.quiet}\"\n >\n ${renderButton(args)} ${renderButton(selected)}\n ${renderButton(disabled)}\n </sp-action-group>\n `;\n}\n\nexport const toggles = (args: Properties): TemplateResult =>\n renderButtonsSelected(args);\ntoggles.args = {\n toggles: true,\n icon: html`\n <sp-icon-edit hidden slot=\"icon\"></sp-icon-edit>\n `,\n};\n\nexport const href = (args: Properties): TemplateResult =>\n renderButtonsSelected(args);\nhref.args = {\n href: 'https://github.com/adobe/spectrum-web-components',\n icon: html`\n <sp-icon-edit hidden slot=\"icon\"></sp-icon-edit>\n `,\n};\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAA4B;AACrC,OAAO;AACP,OAAO;AAEP,SAAS,oBAAoB;AAE7B,OAAO;AAEP,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AACX;AAEA,SAAS,sBAAsB,MAAkC;AAC7D,QAAM,WAAW,OAAO,OAAO,CAAC,GAAG,MAAM,EAAE,UAAU,KAAK,CAAC;AAC3D,QAAM,WAAW,OAAO,OAAO,CAAC,GAAG,MAAM,EAAE,UAAU,KAAK,CAAC;AAC3D,SAAO;AAAA;AAAA,2BAEgB,CAAC,CAAC,KAAK,UAAU;AAAA,sBACtB,CAAC,CAAC,KAAK,KAAK;AAAA;AAAA,cAEpB,aAAa,IAAI,CAAC,IAAI,aAAa,QAAQ,CAAC;AAAA,cAC5C,aAAa,QAAQ,CAAC;AAAA;AAAA;AAGpC;AAEO,aAAM,UAAU,CAAC,SACpB,sBAAsB,IAAI;AAC9B,QAAQ,OAAO;AAAA,EACX,SAAS;AAAA,EACT,MAAM;AAAA;AAAA;AAGV;AAEO,aAAM,OAAO,CAAC,SACjB,sBAAsB,IAAI;AAC9B,KAAK,OAAO;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA;AAAA;AAGV;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/stories/index.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
4
|
+
import "@spectrum-web-components/action-group/sp-action-group.js";
|
|
5
|
+
import "@spectrum-web-components/icon/sp-icon.js";
|
|
6
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js";
|
|
7
|
+
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
8
|
+
export function renderButton(properties) {
|
|
9
|
+
return html`
|
|
10
|
+
<sp-action-button
|
|
11
|
+
href=${ifDefined(properties.href)}
|
|
12
|
+
?quiet="${!!properties.quiet}"
|
|
13
|
+
?emphasized="${!!properties.emphasized}"
|
|
14
|
+
static-color="${ifDefined(properties.staticColor)}"
|
|
15
|
+
?disabled=${!!properties.disabled}
|
|
16
|
+
?selected=${!!properties.selected}
|
|
17
|
+
?toggles=${!!properties.toggles}
|
|
18
|
+
size=${properties.size || "m"}
|
|
19
|
+
?hold-affordance=${!!properties.holdAffordance}
|
|
20
|
+
?active=${!!properties.active}
|
|
21
|
+
>
|
|
22
|
+
${properties.icon}${properties.label}
|
|
23
|
+
</sp-action-button>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
function renderGroup(properties) {
|
|
27
|
+
const label = "Edit";
|
|
28
|
+
const holdAffordance = true;
|
|
29
|
+
const icon = html`
|
|
30
|
+
<sp-icon-edit slot="icon"></sp-icon-edit>
|
|
31
|
+
`;
|
|
32
|
+
return html`
|
|
33
|
+
<sp-action-group
|
|
34
|
+
?quiet="${!!properties.quiet}"
|
|
35
|
+
?emphasized="${!!properties.emphasized}"
|
|
36
|
+
size=${properties.size || "m"}
|
|
37
|
+
static-color="${ifDefined(properties.staticColor)}"
|
|
38
|
+
>
|
|
39
|
+
${renderButton({
|
|
40
|
+
...properties,
|
|
41
|
+
label
|
|
42
|
+
})}
|
|
43
|
+
${renderButton({
|
|
44
|
+
...properties,
|
|
45
|
+
label,
|
|
46
|
+
icon
|
|
47
|
+
})}
|
|
48
|
+
${renderButton({
|
|
49
|
+
...properties,
|
|
50
|
+
icon
|
|
51
|
+
})}
|
|
52
|
+
${renderButton({
|
|
53
|
+
...properties,
|
|
54
|
+
icon,
|
|
55
|
+
holdAffordance
|
|
56
|
+
})}
|
|
57
|
+
</sp-action-group>
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
export function renderButtons(properties) {
|
|
61
|
+
const selected = true;
|
|
62
|
+
const disabled = true;
|
|
63
|
+
return html`
|
|
64
|
+
<div
|
|
65
|
+
style="display: flex; flex-direction: column; gap: calc(var(--spectrum-spacing-100) * var(--swc-scale-factor));"
|
|
66
|
+
>
|
|
67
|
+
${renderGroup({
|
|
68
|
+
...properties
|
|
69
|
+
})}
|
|
70
|
+
${renderGroup({
|
|
71
|
+
...properties,
|
|
72
|
+
selected
|
|
73
|
+
})}
|
|
74
|
+
${renderGroup({
|
|
75
|
+
...properties,
|
|
76
|
+
disabled
|
|
77
|
+
})}
|
|
78
|
+
${renderGroup({
|
|
79
|
+
...properties,
|
|
80
|
+
disabled,
|
|
81
|
+
selected
|
|
82
|
+
})}
|
|
83
|
+
</div>
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';\n\nimport '@spectrum-web-components/action-button/sp-action-button.js';\n\nexport interface Properties {\n active?: boolean;\n quiet?: boolean;\n disabled?: boolean;\n selected?: boolean;\n toggles?: boolean;\n emphasized?: boolean;\n size?: 's' | 'm' | 'l' | 'xl';\n staticColor?: 'white' | 'black';\n holdAffordance?: boolean;\n icon?: TemplateResult;\n label?: string;\n [prop: string]: unknown;\n href: undefined;\n}\n\nexport function renderButton(properties: Properties): TemplateResult {\n return html`\n <sp-action-button\n href=${ifDefined(properties.href)}\n ?quiet=\"${!!properties.quiet}\"\n ?emphasized=\"${!!properties.emphasized}\"\n static-color=\"${ifDefined(properties.staticColor)}\"\n ?disabled=${!!properties.disabled}\n ?selected=${!!properties.selected}\n ?toggles=${!!properties.toggles}\n size=${properties.size || 'm'}\n ?hold-affordance=${!!properties.holdAffordance}\n ?active=${!!properties.active}\n >\n ${properties.icon}${properties.label}\n </sp-action-button>\n `;\n}\n\nfunction renderGroup(properties: Properties): TemplateResult {\n const label = 'Edit';\n const holdAffordance = true;\n const icon = html`\n <sp-icon-edit slot=\"icon\"></sp-icon-edit>\n `;\n return html`\n <sp-action-group\n ?quiet=\"${!!properties.quiet}\"\n ?emphasized=\"${!!properties.emphasized}\"\n size=${properties.size || 'm'}\n static-color=\"${ifDefined(properties.staticColor)}\"\n >\n ${renderButton({\n ...properties,\n label,\n })}\n ${renderButton({\n ...properties,\n label,\n icon,\n })}\n ${renderButton({\n ...properties,\n icon,\n })}\n ${renderButton({\n ...properties,\n icon,\n holdAffordance,\n })}\n </sp-action-group>\n `;\n}\n\nexport function renderButtons(properties: Properties): TemplateResult {\n const selected = true;\n const disabled = true;\n return html`\n <div\n style=\"display: flex; flex-direction: column; gap: calc(var(--spectrum-spacing-100) * var(--swc-scale-factor));\"\n >\n ${renderGroup({\n ...properties,\n })}\n ${renderGroup({\n ...properties,\n selected,\n })}\n ${renderGroup({\n ...properties,\n disabled,\n })}\n ${renderGroup({\n ...properties,\n disabled,\n selected,\n })}\n </div>\n `;\n}\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,YAA4B;AACrC,SAAS,iBAAiB;AAC1B,OAAO;AACP,OAAO;AACP,OAAO;AAEP,OAAO;AAkBA,gBAAS,aAAa,YAAwC;AACjE,SAAO;AAAA;AAAA,mBAEQ,UAAU,WAAW,IAAI,CAAC;AAAA,sBACvB,CAAC,CAAC,WAAW,KAAK;AAAA,2BACb,CAAC,CAAC,WAAW,UAAU;AAAA,4BACtB,UAAU,WAAW,WAAW,CAAC;AAAA,wBACrC,CAAC,CAAC,WAAW,QAAQ;AAAA,wBACrB,CAAC,CAAC,WAAW,QAAQ;AAAA,uBACtB,CAAC,CAAC,WAAW,OAAO;AAAA,mBACxB,WAAW,QAAQ,GAAG;AAAA,+BACV,CAAC,CAAC,WAAW,cAAc;AAAA,sBACpC,CAAC,CAAC,WAAW,MAAM;AAAA;AAAA,cAE3B,WAAW,IAAI,GAAG,WAAW,KAAK;AAAA;AAAA;AAGhD;AAEA,SAAS,YAAY,YAAwC;AACzD,QAAM,QAAQ;AACd,QAAM,iBAAiB;AACvB,QAAM,OAAO;AAAA;AAAA;AAGb,SAAO;AAAA;AAAA,sBAEW,CAAC,CAAC,WAAW,KAAK;AAAA,2BACb,CAAC,CAAC,WAAW,UAAU;AAAA,mBAC/B,WAAW,QAAQ,GAAG;AAAA,4BACb,UAAU,WAAW,WAAW,CAAC;AAAA;AAAA,cAE/C,aAAa;AAAA,IACX,GAAG;AAAA,IACH;AAAA,EACJ,CAAC,CAAC;AAAA,cACA,aAAa;AAAA,IACX,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACJ,CAAC,CAAC;AAAA,cACA,aAAa;AAAA,IACX,GAAG;AAAA,IACH;AAAA,EACJ,CAAC,CAAC;AAAA,cACA,aAAa;AAAA,IACX,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACJ,CAAC,CAAC;AAAA;AAAA;AAGd;AAEO,gBAAS,cAAc,YAAwC;AAClE,QAAM,WAAW;AACjB,QAAM,WAAW;AACjB,SAAO;AAAA;AAAA;AAAA;AAAA,cAIG,YAAY;AAAA,IACV,GAAG;AAAA,EACP,CAAC,CAAC;AAAA,cACA,YAAY;AAAA,IACV,GAAG;AAAA,IACH;AAAA,EACJ,CAAC,CAAC;AAAA,cACA,YAAY;AAAA,IACV,GAAG;AAAA,IACH;AAAA,EACJ,CAAC,CAAC;AAAA,cACA,YAAY;AAAA,IACV,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACJ,CAAC,CAAC;AAAA;AAAA;AAGd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import * as stories from "../stories/action-button-black-quiet.stories.js";
|
|
3
|
+
import { regressVisuals } from "../../../test/visual/test.js";
|
|
4
|
+
regressVisuals("ActionButtonBlackQuietStories", stories);
|
|
5
|
+
//# sourceMappingURL=action-button-black-quiet.test-vrt.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button-black-quiet.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-black-quiet.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonBlackQuietStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,iCAAiC,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button-black.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-black.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonBlackStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,4BAA4B,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import * as stories from "../stories/action-button-emphasized-quiet.stories.js";
|
|
3
|
+
import { regressVisuals } from "../../../test/visual/test.js";
|
|
4
|
+
regressVisuals("ActionButtonEmphasizedQuietStories", stories);
|
|
5
|
+
//# sourceMappingURL=action-button-emphasized-quiet.test-vrt.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button-emphasized-quiet.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-emphasized-quiet.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonEmphasizedQuietStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,sCAAsC,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import * as stories from "../stories/action-button-emphasized.stories.js";
|
|
3
|
+
import { regressVisuals } from "../../../test/visual/test.js";
|
|
4
|
+
regressVisuals("ActionButtonEmphasizedStories", stories);
|
|
5
|
+
//# sourceMappingURL=action-button-emphasized.test-vrt.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button-emphasized.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-emphasized.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonEmphasizedStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,iCAAiC,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { m as BlackActionButton } from "../stories/action-button-black.stories.js";
|
|
3
|
+
import { testForMemoryLeaks } from "../../../test/testing-helpers.js";
|
|
4
|
+
testForMemoryLeaks(BlackActionButton(BlackActionButton.args));
|
|
5
|
+
//# sourceMappingURL=action-button-memory.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button-memory.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { m as BlackActionButton } from '../stories/action-button-black.stories.js';\nimport { testForMemoryLeaks } from '../../../test/testing-helpers.js';\n\ntestForMemoryLeaks(BlackActionButton(BlackActionButton.args));\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,KAAK,yBAAyB;AACvC,SAAS,0BAA0B;AAEnC,mBAAmB,kBAAkB,kBAAkB,IAAI,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button-quiet.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-quiet.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonQuietStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,4BAA4B,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import * as stories from "../stories/action-button-standard.stories.js";
|
|
3
|
+
import { regressVisuals } from "../../../test/visual/test.js";
|
|
4
|
+
regressVisuals("ActionButtonStandardStories", stories);
|
|
5
|
+
//# sourceMappingURL=action-button-standard.test-vrt.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button-standard.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-standard.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonStandardStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,+BAA+B,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import * as stories from "../stories/action-button-white-quiet.stories.js";
|
|
3
|
+
import { regressVisuals } from "../../../test/visual/test.js";
|
|
4
|
+
regressVisuals("ActionButtonWhiteQuietStories", stories);
|
|
5
|
+
//# sourceMappingURL=action-button-white-quiet.test-vrt.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button-white-quiet.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-white-quiet.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonWhiteQuietStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,iCAAiC,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button-white.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-white.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonWhiteStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,4BAA4B,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-button.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,uBAAuB,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
3
|
+
import {
|
|
4
|
+
LONGPRESS_DURATION
|
|
5
|
+
} from "@spectrum-web-components/action-button";
|
|
6
|
+
import {
|
|
7
|
+
aTimeout,
|
|
8
|
+
elementUpdated,
|
|
9
|
+
expect,
|
|
10
|
+
fixture,
|
|
11
|
+
html,
|
|
12
|
+
waitUntil
|
|
13
|
+
} from "@open-wc/testing";
|
|
14
|
+
import { sendKeys } from "@web/test-runner-commands";
|
|
15
|
+
import { spy } from "sinon";
|
|
16
|
+
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
17
|
+
import { m as BlackActionButton } from "../stories/action-button-black.stories.js";
|
|
18
|
+
import { sendMouse } from "../../../test/plugins/browser.js";
|
|
19
|
+
describe("ActionButton", () => {
|
|
20
|
+
testForLitDevWarnings(
|
|
21
|
+
async () => await fixture(
|
|
22
|
+
BlackActionButton(BlackActionButton.args)
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
it("loads default", async () => {
|
|
26
|
+
const el = await fixture(html`
|
|
27
|
+
<sp-action-button>Button</sp-action-button>
|
|
28
|
+
`);
|
|
29
|
+
await elementUpdated(el);
|
|
30
|
+
expect(el).to.not.be.undefined;
|
|
31
|
+
expect(el.textContent).to.include("Button");
|
|
32
|
+
await expect(el).to.be.accessible();
|
|
33
|
+
});
|
|
34
|
+
it('gardens "value" as a property', async () => {
|
|
35
|
+
const el = await fixture(html`
|
|
36
|
+
<sp-action-button>Button</sp-action-button>
|
|
37
|
+
`);
|
|
38
|
+
await elementUpdated(el);
|
|
39
|
+
expect(el.hasAttribute("value")).to.be.false;
|
|
40
|
+
el.value = "Value";
|
|
41
|
+
await elementUpdated(el);
|
|
42
|
+
expect(el.hasAttribute("value")).to.be.true;
|
|
43
|
+
el.value = "";
|
|
44
|
+
await elementUpdated(el);
|
|
45
|
+
expect(el.hasAttribute("value")).to.be.false;
|
|
46
|
+
});
|
|
47
|
+
it("loads [hold-affordance]", async () => {
|
|
48
|
+
const el = await fixture(html`
|
|
49
|
+
<sp-action-button hold-affordance>Button</sp-action-button>
|
|
50
|
+
`);
|
|
51
|
+
await elementUpdated(el);
|
|
52
|
+
expect(el).to.not.be.undefined;
|
|
53
|
+
expect(el.textContent).to.include("Button");
|
|
54
|
+
await expect(el).to.be.accessible();
|
|
55
|
+
});
|
|
56
|
+
it("manages a `tabindex`", async () => {
|
|
57
|
+
const el = await fixture(html`
|
|
58
|
+
<sp-action-button>Button</sp-action-button>
|
|
59
|
+
`);
|
|
60
|
+
expect(el.tabIndex).to.equal(0);
|
|
61
|
+
expect(el.disabled).to.be.false;
|
|
62
|
+
el.setAttribute("tabindex", "-1");
|
|
63
|
+
await elementUpdated(el);
|
|
64
|
+
expect(el.tabIndex).to.equal(-1);
|
|
65
|
+
expect(el.disabled).to.be.false;
|
|
66
|
+
el.disabled = true;
|
|
67
|
+
await elementUpdated(el);
|
|
68
|
+
expect(el.tabIndex).to.equal(-1);
|
|
69
|
+
expect(el.disabled).to.be.true;
|
|
70
|
+
el.disabled = false;
|
|
71
|
+
await elementUpdated(el);
|
|
72
|
+
expect(el.tabIndex).to.equal(-1);
|
|
73
|
+
expect(el.disabled).to.be.false;
|
|
74
|
+
});
|
|
75
|
+
it("manages a `size` attribute", async () => {
|
|
76
|
+
const el = await fixture(html`
|
|
77
|
+
<sp-action-button size="xl">Button</sp-action-button>
|
|
78
|
+
`);
|
|
79
|
+
await elementUpdated(el);
|
|
80
|
+
expect(el.size).to.equal("xl");
|
|
81
|
+
expect(el.getAttribute("size")).to.equal("xl");
|
|
82
|
+
el.removeAttribute("size");
|
|
83
|
+
await elementUpdated(el);
|
|
84
|
+
expect(el.size).to.equal("m");
|
|
85
|
+
expect(el.hasAttribute("size")).to.be.false;
|
|
86
|
+
});
|
|
87
|
+
it("does not apply a default `size` attribute", async () => {
|
|
88
|
+
const el = await fixture(html`
|
|
89
|
+
<sp-action-button>Button</sp-action-button>
|
|
90
|
+
`);
|
|
91
|
+
await elementUpdated(el);
|
|
92
|
+
expect(el.size).to.equal("m");
|
|
93
|
+
expect(el.hasAttribute("size")).to.be.false;
|
|
94
|
+
});
|
|
95
|
+
it("dispatches `longpress` events when [hold-affordance]", async () => {
|
|
96
|
+
const longpressSpy = spy();
|
|
97
|
+
const el = await fixture(html`
|
|
98
|
+
<sp-action-button
|
|
99
|
+
hold-affordance
|
|
100
|
+
@longpress=${() => longpressSpy()}
|
|
101
|
+
>
|
|
102
|
+
Button
|
|
103
|
+
</sp-action-button>
|
|
104
|
+
`);
|
|
105
|
+
await elementUpdated(el);
|
|
106
|
+
el.focus();
|
|
107
|
+
await sendKeys({
|
|
108
|
+
press: "Space"
|
|
109
|
+
});
|
|
110
|
+
expect(longpressSpy.callCount).to.equal(1);
|
|
111
|
+
await sendKeys({
|
|
112
|
+
press: "Alt+ArrowDown"
|
|
113
|
+
});
|
|
114
|
+
expect(longpressSpy.callCount).to.equal(2);
|
|
115
|
+
el.dispatchEvent(new PointerEvent("pointerdown", { button: 0 }));
|
|
116
|
+
el.dispatchEvent(new PointerEvent("pointerup"));
|
|
117
|
+
el.dispatchEvent(new PointerEvent("pointerdown", { button: 0 }));
|
|
118
|
+
await waitUntil(() => longpressSpy.callCount === 3);
|
|
119
|
+
});
|
|
120
|
+
it('does not dispatch `longpress` events when "right click"ed', async () => {
|
|
121
|
+
const longpressSpy = spy();
|
|
122
|
+
const el = await fixture(html`
|
|
123
|
+
<sp-action-button
|
|
124
|
+
hold-affordance
|
|
125
|
+
@longpress=${() => longpressSpy()}
|
|
126
|
+
>
|
|
127
|
+
Button
|
|
128
|
+
</sp-action-button>
|
|
129
|
+
`);
|
|
130
|
+
await elementUpdated(el);
|
|
131
|
+
expect(longpressSpy.callCount).to.equal(0);
|
|
132
|
+
el.focus();
|
|
133
|
+
el.dispatchEvent(new PointerEvent("pointerdown", { button: 1 }));
|
|
134
|
+
await aTimeout(2 * LONGPRESS_DURATION);
|
|
135
|
+
expect(longpressSpy.callCount).to.equal(0);
|
|
136
|
+
});
|
|
137
|
+
it(":not([toggles])", async () => {
|
|
138
|
+
const el = await fixture(html`
|
|
139
|
+
<sp-action-button>Button</sp-action-button>
|
|
140
|
+
`);
|
|
141
|
+
await elementUpdated(el);
|
|
142
|
+
const button = el.focusElement;
|
|
143
|
+
expect(el.toggles).to.be.false;
|
|
144
|
+
expect(el.selected).to.be.false;
|
|
145
|
+
expect(button.hasAttribute("aria-pressed")).to.be.false;
|
|
146
|
+
el.click();
|
|
147
|
+
await elementUpdated(el);
|
|
148
|
+
expect(el.toggles).to.be.false;
|
|
149
|
+
expect(el.selected).to.be.false;
|
|
150
|
+
expect(button.hasAttribute("aria-pressed")).to.be.false;
|
|
151
|
+
});
|
|
152
|
+
it("responds to [selected]", async () => {
|
|
153
|
+
const el = await fixture(html`
|
|
154
|
+
<sp-action-button>Button</sp-action-button>
|
|
155
|
+
`);
|
|
156
|
+
await elementUpdated(el);
|
|
157
|
+
const button = el.focusElement;
|
|
158
|
+
expect(el.toggles).to.be.false;
|
|
159
|
+
expect(el.selected).to.be.false;
|
|
160
|
+
expect(button.hasAttribute("aria-pressed")).to.be.false;
|
|
161
|
+
el.selected = true;
|
|
162
|
+
await elementUpdated(el);
|
|
163
|
+
expect(el.toggles).to.be.false;
|
|
164
|
+
expect(el.selected).to.be.true;
|
|
165
|
+
expect(button.getAttribute("aria-pressed")).to.equal("true");
|
|
166
|
+
el.selected = false;
|
|
167
|
+
await elementUpdated(el);
|
|
168
|
+
expect(el.toggles).to.be.false;
|
|
169
|
+
expect(el.selected).to.be.false;
|
|
170
|
+
expect(button.hasAttribute("aria-pressed")).to.be.false;
|
|
171
|
+
});
|
|
172
|
+
it("toggles", async () => {
|
|
173
|
+
const el = await fixture(html`
|
|
174
|
+
<sp-action-button toggles>Button</sp-action-button>
|
|
175
|
+
`);
|
|
176
|
+
await elementUpdated(el);
|
|
177
|
+
const button = el.focusElement;
|
|
178
|
+
expect(el.toggles).to.be.true;
|
|
179
|
+
expect(el.selected).to.be.false;
|
|
180
|
+
expect(button.getAttribute("aria-pressed")).to.equal("false");
|
|
181
|
+
el.focus();
|
|
182
|
+
await sendKeys({
|
|
183
|
+
press: "Space"
|
|
184
|
+
});
|
|
185
|
+
await elementUpdated(el);
|
|
186
|
+
expect(el.toggles).to.be.true;
|
|
187
|
+
expect(el.selected).to.be.true;
|
|
188
|
+
expect(button.getAttribute("aria-pressed")).to.equal("true");
|
|
189
|
+
el.addEventListener("change", (event) => event.preventDefault());
|
|
190
|
+
el.click();
|
|
191
|
+
await elementUpdated(el);
|
|
192
|
+
expect(el.toggles).to.be.true;
|
|
193
|
+
expect(el.selected).to.be.true;
|
|
194
|
+
expect(button.getAttribute("aria-pressed")).to.equal("true");
|
|
195
|
+
});
|
|
196
|
+
it("toggles [aria-haspopup][aria-expanded]", async () => {
|
|
197
|
+
const el = await fixture(html`
|
|
198
|
+
<sp-action-button
|
|
199
|
+
toggles
|
|
200
|
+
aria-haspopup="true"
|
|
201
|
+
aria-expanded="false"
|
|
202
|
+
>
|
|
203
|
+
Button
|
|
204
|
+
</sp-action-button>
|
|
205
|
+
`);
|
|
206
|
+
await elementUpdated(el);
|
|
207
|
+
const button = el.focusElement;
|
|
208
|
+
expect(el.toggles).to.be.true;
|
|
209
|
+
expect(el.selected).to.be.false;
|
|
210
|
+
expect(button).not.to.have.attribute("aria-pressed");
|
|
211
|
+
expect(button).to.have.attribute("aria-haspopup", "true");
|
|
212
|
+
expect(button).to.have.attribute("aria-expanded", "false");
|
|
213
|
+
el.focus();
|
|
214
|
+
await sendKeys({
|
|
215
|
+
press: "Space"
|
|
216
|
+
});
|
|
217
|
+
await elementUpdated(el);
|
|
218
|
+
expect(el.toggles).to.be.true;
|
|
219
|
+
expect(el.selected).to.be.true;
|
|
220
|
+
expect(button).not.to.have.attribute("aria-pressed");
|
|
221
|
+
expect(button).to.have.attribute("aria-haspopup", "true");
|
|
222
|
+
expect(button).to.have.attribute("aria-expanded", "true");
|
|
223
|
+
el.addEventListener("change", (event) => event.preventDefault());
|
|
224
|
+
el.click();
|
|
225
|
+
await elementUpdated(el);
|
|
226
|
+
expect(el.toggles).to.be.true;
|
|
227
|
+
expect(el.selected).to.be.true;
|
|
228
|
+
expect(button).not.to.have.attribute("aria-pressed");
|
|
229
|
+
expect(button).to.have.attribute("aria-haspopup", "true");
|
|
230
|
+
expect(button).to.have.attribute("aria-expanded", "true");
|
|
231
|
+
});
|
|
232
|
+
it("manages a `static-color` attribute", async () => {
|
|
233
|
+
const el = await fixture(html`
|
|
234
|
+
<sp-action-button static-color="black">Button</sp-action-button>
|
|
235
|
+
`);
|
|
236
|
+
await elementUpdated(el);
|
|
237
|
+
expect(el.staticColor).to.equal("black");
|
|
238
|
+
expect(el.getAttribute("static-color")).to.equal("black");
|
|
239
|
+
el.removeAttribute("static-color");
|
|
240
|
+
await elementUpdated(el);
|
|
241
|
+
expect(el.staticColor).to.be.null;
|
|
242
|
+
expect(el.hasAttribute("static-color")).to.be.false;
|
|
243
|
+
});
|
|
244
|
+
it("allows link click", async () => {
|
|
245
|
+
var _a, _b;
|
|
246
|
+
let clicked = false;
|
|
247
|
+
const el = await fixture(html`
|
|
248
|
+
<sp-action-button href="#top" target="_blank">
|
|
249
|
+
With Target
|
|
250
|
+
</sp-action-button>
|
|
251
|
+
`);
|
|
252
|
+
await elementUpdated(el);
|
|
253
|
+
(_b = (_a = el.shadowRoot) == null ? void 0 : _a.querySelector(".anchor")) == null ? void 0 : _b.addEventListener("click", (event) => {
|
|
254
|
+
event.preventDefault();
|
|
255
|
+
clicked = true;
|
|
256
|
+
});
|
|
257
|
+
const rect = el.getBoundingClientRect();
|
|
258
|
+
await sendMouse({
|
|
259
|
+
steps: [
|
|
260
|
+
{
|
|
261
|
+
position: [
|
|
262
|
+
rect.left + rect.width / 2,
|
|
263
|
+
rect.top + rect.height / 2
|
|
264
|
+
],
|
|
265
|
+
type: "click"
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
});
|
|
269
|
+
await elementUpdated(el);
|
|
270
|
+
expect(clicked).to.be.true;
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
//# sourceMappingURL=action-button.test.js.map
|