@spectrum-web-components/action-button 0.50.0-beta.1 → 0.50.0-beta.10
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/package.json +9 -8
- package/src/ActionButton.d.ts +0 -8
- package/src/ActionButton.dev.js +7 -29
- package/src/ActionButton.dev.js.map +2 -2
- package/src/ActionButton.js +3 -3
- package/src/ActionButton.js.map +3 -3
- package/src/action-button-overrides.css.d.ts +2 -0
- package/src/action-button-overrides.css.dev.js +7 -0
- package/src/action-button-overrides.css.dev.js.map +7 -0
- package/src/action-button-overrides.css.js +4 -0
- package/src/action-button-overrides.css.js.map +7 -0
- package/src/action-button.css.dev.js +1 -1
- package/src/action-button.css.dev.js.map +1 -1
- package/src/action-button.css.js +1 -1
- package/src/action-button.css.js.map +1 -1
- package/src/spectrum-action-button.css.dev.js +1 -1
- package/src/spectrum-action-button.css.dev.js.map +1 -1
- package/src/spectrum-action-button.css.js +3 -3
- package/src/spectrum-action-button.css.js.map +1 -1
- package/src/spectrum-config.js +28 -0
- package/stories/action-button-black-quiet.stories.js +6 -6
- package/stories/action-button-black-quiet.stories.js.map +2 -2
- package/stories/action-button-black.stories.js +6 -6
- package/stories/action-button-black.stories.js.map +2 -2
- package/stories/action-button-white-quiet.stories.js +6 -6
- package/stories/action-button-white-quiet.stories.js.map +2 -2
- package/stories/action-button-white.stories.js +6 -6
- package/stories/action-button-white.stories.js.map +2 -2
- package/stories/action-button.stories.js +0 -18
- package/stories/action-button.stories.js.map +2 -2
- package/stories/index.js +2 -1
- package/stories/index.js.map +2 -2
- package/test/action-button.test.js +12 -64
- package/test/action-button.test.js.map +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-button-white-quiet.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 { TemplateResult } from '@spectrum-web-components/base';\nimport { makeOverBackground } from '../../button/stories/index.js';\nimport type { Properties } from './index.js';\nimport { renderButtons } from './index.js';\n\nexport default {\n component: 'sp-action-button',\n title: 'Action Button/Static White Quiet',\n decorators: [makeOverBackground()],\n};\n\nconst
|
|
5
|
-
"mappings": ";AAYA,SAAS,0BAA0B;AAEnC,SAAS,qBAAqB;AAE9B,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,YAAY,CAAC,mBAAmB,CAAC;AACrC;AAEA,MAAM,
|
|
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 { TemplateResult } from '@spectrum-web-components/base';\nimport { makeOverBackground } from '../../button/stories/index.js';\nimport type { Properties } from './index.js';\nimport { renderButtons } from './index.js';\n\nexport default {\n component: 'sp-action-button',\n title: 'Action Button/Static White Quiet',\n decorators: [makeOverBackground()],\n};\n\nconst staticColor = 'white';\nconst quiet = true;\n\nexport const XS = (args: Properties): TemplateResult => renderButtons(args);\nXS.args = {\n size: 'xs',\n quiet,\n staticColor,\n};\n\nexport const s = (args: Properties): TemplateResult => renderButtons(args);\ns.args = {\n size: 's',\n quiet,\n staticColor,\n};\n\nexport const m = (args: Properties): TemplateResult => renderButtons(args);\nm.args = {\n size: 'm',\n quiet,\n staticColor,\n};\n\nexport const l = (args: Properties): TemplateResult => renderButtons(args);\nl.args = {\n size: 'l',\n quiet,\n staticColor,\n};\n\nexport const XL = (args: Properties): TemplateResult => renderButtons(args);\nXL.args = {\n size: 'xl',\n quiet,\n staticColor,\n};\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,0BAA0B;AAEnC,SAAS,qBAAqB;AAE9B,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,YAAY,CAAC,mBAAmB,CAAC;AACrC;AAEA,MAAM,cAAc;AACpB,MAAM,QAAQ;AAEP,aAAM,KAAK,CAAC,SAAqC,cAAc,IAAI;AAC1E,GAAG,OAAO;AAAA,EACN,MAAM;AAAA,EACN;AAAA,EACA;AACJ;AAEO,aAAM,IAAI,CAAC,SAAqC,cAAc,IAAI;AACzE,EAAE,OAAO;AAAA,EACL,MAAM;AAAA,EACN;AAAA,EACA;AACJ;AAEO,aAAM,IAAI,CAAC,SAAqC,cAAc,IAAI;AACzE,EAAE,OAAO;AAAA,EACL,MAAM;AAAA,EACN;AAAA,EACA;AACJ;AAEO,aAAM,IAAI,CAAC,SAAqC,cAAc,IAAI;AACzE,EAAE,OAAO;AAAA,EACL,MAAM;AAAA,EACN;AAAA,EACA;AACJ;AAEO,aAAM,KAAK,CAAC,SAAqC,cAAc,IAAI;AAC1E,GAAG,OAAO;AAAA,EACN,MAAM;AAAA,EACN;AAAA,EACA;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,30 +6,30 @@ export default {
|
|
|
6
6
|
title: "Action Button/Static White",
|
|
7
7
|
decorators: [makeOverBackground()]
|
|
8
8
|
};
|
|
9
|
-
const
|
|
9
|
+
const staticColor = "white";
|
|
10
10
|
export const XS = (args) => renderButtons(args);
|
|
11
11
|
XS.args = {
|
|
12
12
|
size: "xs",
|
|
13
|
-
|
|
13
|
+
staticColor
|
|
14
14
|
};
|
|
15
15
|
export const s = (args) => renderButtons(args);
|
|
16
16
|
s.args = {
|
|
17
17
|
size: "s",
|
|
18
|
-
|
|
18
|
+
staticColor
|
|
19
19
|
};
|
|
20
20
|
export const m = (args) => renderButtons(args);
|
|
21
21
|
m.args = {
|
|
22
22
|
size: "m",
|
|
23
|
-
|
|
23
|
+
staticColor
|
|
24
24
|
};
|
|
25
25
|
export const l = (args) => renderButtons(args);
|
|
26
26
|
l.args = {
|
|
27
27
|
size: "l",
|
|
28
|
-
|
|
28
|
+
staticColor
|
|
29
29
|
};
|
|
30
30
|
export const XL = (args) => renderButtons(args);
|
|
31
31
|
XL.args = {
|
|
32
32
|
size: "xl",
|
|
33
|
-
|
|
33
|
+
staticColor
|
|
34
34
|
};
|
|
35
35
|
//# sourceMappingURL=action-button-white.stories.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-button-white.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 { TemplateResult } from '@spectrum-web-components/base';\nimport { makeOverBackground } from '../../button/stories/index.js';\nimport type { Properties } from './index.js';\nimport { renderButtons } from './index.js';\n\nexport default {\n component: 'sp-action-button',\n title: 'Action Button/Static White',\n decorators: [makeOverBackground()],\n};\n\nconst
|
|
5
|
-
"mappings": ";AAYA,SAAS,0BAA0B;AAEnC,SAAS,qBAAqB;AAE9B,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,YAAY,CAAC,mBAAmB,CAAC;AACrC;AAEA,MAAM,
|
|
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 { TemplateResult } from '@spectrum-web-components/base';\nimport { makeOverBackground } from '../../button/stories/index.js';\nimport type { Properties } from './index.js';\nimport { renderButtons } from './index.js';\n\nexport default {\n component: 'sp-action-button',\n title: 'Action Button/Static White',\n decorators: [makeOverBackground()],\n};\n\nconst staticColor = 'white';\n\nexport const XS = (args: Properties): TemplateResult => renderButtons(args);\nXS.args = {\n size: 'xs',\n staticColor,\n};\n\nexport const s = (args: Properties): TemplateResult => renderButtons(args);\ns.args = {\n size: 's',\n staticColor,\n};\n\nexport const m = (args: Properties): TemplateResult => renderButtons(args);\nm.args = {\n size: 'm',\n staticColor,\n};\n\nexport const l = (args: Properties): TemplateResult => renderButtons(args);\nl.args = {\n size: 'l',\n staticColor,\n};\n\nexport const XL = (args: Properties): TemplateResult => renderButtons(args);\nXL.args = {\n size: 'xl',\n staticColor,\n};\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,0BAA0B;AAEnC,SAAS,qBAAqB;AAE9B,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,YAAY,CAAC,mBAAmB,CAAC;AACrC;AAEA,MAAM,cAAc;AAEb,aAAM,KAAK,CAAC,SAAqC,cAAc,IAAI;AAC1E,GAAG,OAAO;AAAA,EACN,MAAM;AAAA,EACN;AACJ;AAEO,aAAM,IAAI,CAAC,SAAqC,cAAc,IAAI;AACzE,EAAE,OAAO;AAAA,EACL,MAAM;AAAA,EACN;AACJ;AAEO,aAAM,IAAI,CAAC,SAAqC,cAAc,IAAI;AACzE,EAAE,OAAO;AAAA,EACL,MAAM;AAAA,EACN;AACJ;AAEO,aAAM,IAAI,CAAC,SAAqC,cAAc,IAAI;AACzE,EAAE,OAAO;AAAA,EACL,MAAM;AAAA,EACN;AACJ;AAEO,aAAM,KAAK,CAAC,SAAqC,cAAc,IAAI;AAC1E,GAAG,OAAO;AAAA,EACN,MAAM;AAAA,EACN;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -28,22 +28,4 @@ toggles.args = {
|
|
|
28
28
|
<sp-icon-edit hidden slot="icon"></sp-icon-edit>
|
|
29
29
|
`
|
|
30
30
|
};
|
|
31
|
-
export const iconSizeOverridden = (args) => {
|
|
32
|
-
return html`
|
|
33
|
-
${renderButton(args)}
|
|
34
|
-
<h1>For testing purposes only</h1>
|
|
35
|
-
<p>
|
|
36
|
-
This is a test to ensure that sizing the icon will still work when
|
|
37
|
-
it's in the scope of a parent element. You shouldn't normally do
|
|
38
|
-
this as it deviates from the Spectrum design specification.
|
|
39
|
-
</p>
|
|
40
|
-
`;
|
|
41
|
-
};
|
|
42
|
-
iconSizeOverridden.args = {
|
|
43
|
-
label: "",
|
|
44
|
-
size: "xl",
|
|
45
|
-
icon: html`
|
|
46
|
-
<sp-icon-edit slot="icon" size="s"></sp-icon-edit>
|
|
47
|
-
`
|
|
48
|
-
};
|
|
49
31
|
//# sourceMappingURL=action-button.stories.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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
|
|
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;
|
|
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"],
|
|
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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/stories/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export function renderButton(properties) {
|
|
|
10
10
|
<sp-action-button
|
|
11
11
|
?quiet="${!!properties.quiet}"
|
|
12
12
|
?emphasized="${!!properties.emphasized}"
|
|
13
|
-
static-color="${ifDefined(properties.
|
|
13
|
+
static-color="${ifDefined(properties.staticColor)}"
|
|
14
14
|
?disabled=${!!properties.disabled}
|
|
15
15
|
?selected=${!!properties.selected}
|
|
16
16
|
?toggles=${!!properties.toggles}
|
|
@@ -33,6 +33,7 @@ function renderGroup(properties) {
|
|
|
33
33
|
?quiet="${!!properties.quiet}"
|
|
34
34
|
?emphasized="${!!properties.emphasized}"
|
|
35
35
|
size=${properties.size || "m"}
|
|
36
|
+
static-color="${ifDefined(properties.staticColor)}"
|
|
36
37
|
>
|
|
37
38
|
${renderButton({
|
|
38
39
|
...properties,
|
package/stories/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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
|
|
5
|
-
"mappings": ";AAYA,SAAS,YAA4B;AACrC,SAAS,iBAAiB;AAC1B,OAAO;AACP,OAAO;AACP,OAAO;AAEP,OAAO;AAiBA,gBAAS,aAAa,YAAwC;AACjE,SAAO;AAAA;AAAA,sBAEW,CAAC,CAAC,WAAW,KAAK;AAAA,2BACb,CAAC,CAAC,WAAW,UAAU;AAAA,4BACtB,UAAU,WAAW,
|
|
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}\n\nexport function renderButton(properties: Properties): TemplateResult {\n return html`\n <sp-action-button\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;AAC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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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
waitUntil
|
|
13
13
|
} from "@open-wc/testing";
|
|
14
14
|
import { sendKeys } from "@web/test-runner-commands";
|
|
15
|
-
import { spy
|
|
15
|
+
import { spy } from "sinon";
|
|
16
16
|
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
17
17
|
import { m as BlackActionButton } from "../stories/action-button-black.stories.js";
|
|
18
18
|
describe("ActionButton", () => {
|
|
@@ -228,69 +228,17 @@ describe("ActionButton", () => {
|
|
|
228
228
|
expect(button).to.have.attribute("aria-haspopup", "true");
|
|
229
229
|
expect(button).to.have.attribute("aria-expanded", "true");
|
|
230
230
|
});
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
consoleWarnStub.restore();
|
|
243
|
-
});
|
|
244
|
-
it("warns that `variant` is deprecated", async () => {
|
|
245
|
-
const el = await fixture(html`
|
|
246
|
-
<sp-action-button variant="white">Button</sp-action-button>
|
|
247
|
-
`);
|
|
248
|
-
await elementUpdated(el);
|
|
249
|
-
expect(consoleWarnStub.called).to.be.true;
|
|
250
|
-
const spyCall = consoleWarnStub.getCall(0);
|
|
251
|
-
expect(
|
|
252
|
-
spyCall.args.at(0).includes('"variant"'),
|
|
253
|
-
"confirm variant-centric message"
|
|
254
|
-
).to.be.true;
|
|
255
|
-
expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({
|
|
256
|
-
data: {
|
|
257
|
-
localName: "sp-action-button",
|
|
258
|
-
type: "api",
|
|
259
|
-
level: "deprecation"
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
it("warns that `variant` is deprecated", async () => {
|
|
264
|
-
const el = await fixture(html`
|
|
265
|
-
<sp-action-button static="white">Button</sp-action-button>
|
|
266
|
-
`);
|
|
267
|
-
await elementUpdated(el);
|
|
268
|
-
expect(consoleWarnStub.called).to.be.true;
|
|
269
|
-
const spyCall = consoleWarnStub.getCall(0);
|
|
270
|
-
expect(
|
|
271
|
-
spyCall.args.at(0).includes('"static"'),
|
|
272
|
-
"confirm static-centric message"
|
|
273
|
-
).to.be.true;
|
|
274
|
-
expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({
|
|
275
|
-
data: {
|
|
276
|
-
localName: "sp-action-button",
|
|
277
|
-
type: "api",
|
|
278
|
-
level: "deprecation"
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
});
|
|
282
|
-
it("prefers `staticColor` over `static`", async () => {
|
|
283
|
-
const el = await fixture(html`
|
|
284
|
-
<sp-action-button static="white">Button</sp-action-button>
|
|
285
|
-
`);
|
|
286
|
-
await elementUpdated(el);
|
|
287
|
-
expect(el.staticColor).to.equal("white");
|
|
288
|
-
el.setAttribute("static", "white");
|
|
289
|
-
await elementUpdated(el);
|
|
290
|
-
expect(el.staticColor).to.equal("white");
|
|
291
|
-
expect(el.static).to.equal("white");
|
|
292
|
-
expect(el.getAttribute("static-color")).to.equal("white");
|
|
293
|
-
});
|
|
231
|
+
it("manages a `static-color` attribute", async () => {
|
|
232
|
+
const el = await fixture(html`
|
|
233
|
+
<sp-action-button static-color="black">Button</sp-action-button>
|
|
234
|
+
`);
|
|
235
|
+
await elementUpdated(el);
|
|
236
|
+
expect(el.staticColor).to.equal("black");
|
|
237
|
+
expect(el.getAttribute("static-color")).to.equal("black");
|
|
238
|
+
el.removeAttribute("static-color");
|
|
239
|
+
await elementUpdated(el);
|
|
240
|
+
expect(el.staticColor).to.be.null;
|
|
241
|
+
expect(el.hasAttribute("static-color")).to.be.false;
|
|
294
242
|
});
|
|
295
243
|
});
|
|
296
244
|
//# sourceMappingURL=action-button.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-button.test.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 '@spectrum-web-components/action-button/sp-action-button.js';\nimport {\n ActionButton,\n LONGPRESS_DURATION,\n} from '@spectrum-web-components/action-button';\nimport {\n aTimeout,\n elementUpdated,\n expect,\n fixture,\n html,\n waitUntil,\n} from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { spy, stub } from 'sinon';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\nimport { m as BlackActionButton } from '../stories/action-button-black.stories.js';\n\ndescribe('ActionButton', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<ActionButton>(\n BlackActionButton(BlackActionButton.args)\n )\n );\n it('loads default', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('gardens \"value\" as a property', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el.hasAttribute('value')).to.be.false;\n el.value = 'Value';\n await elementUpdated(el);\n expect(el.hasAttribute('value')).to.be.true;\n el.value = '';\n await elementUpdated(el);\n expect(el.hasAttribute('value')).to.be.false;\n });\n it('loads [hold-affordance]', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button hold-affordance>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('manages a `tabindex`', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n expect(el.tabIndex).to.equal(0);\n expect(el.disabled).to.be.false;\n\n el.setAttribute('tabindex', '-1');\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(-1);\n expect(el.disabled).to.be.false;\n\n el.disabled = true;\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(-1);\n expect(el.disabled).to.be.true;\n\n el.disabled = false;\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(-1);\n expect(el.disabled).to.be.false;\n });\n it('manages a `size` attribute', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button size=\"xl\">Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el.size).to.equal('xl');\n expect(el.getAttribute('size')).to.equal('xl');\n el.removeAttribute('size');\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.hasAttribute('size')).to.be.false;\n });\n it('does not apply a default `size` attribute', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.hasAttribute('size')).to.be.false;\n });\n it('dispatches `longpress` events when [hold-affordance]', async () => {\n const longpressSpy = spy();\n const el = await fixture<ActionButton>(html`\n <sp-action-button\n hold-affordance\n @longpress=${() => longpressSpy()}\n >\n Button\n </sp-action-button>\n `);\n\n await elementUpdated(el);\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n expect(longpressSpy.callCount).to.equal(1);\n await sendKeys({\n press: 'Alt+ArrowDown',\n });\n\n expect(longpressSpy.callCount).to.equal(2);\n el.dispatchEvent(new PointerEvent('pointerdown', { button: 0 }));\n el.dispatchEvent(new PointerEvent('pointerup'));\n el.dispatchEvent(new PointerEvent('pointerdown', { button: 0 }));\n await waitUntil(() => longpressSpy.callCount === 3);\n });\n it('does not dispatch `longpress` events when \"right click\"ed', async () => {\n const longpressSpy = spy();\n const el = await fixture<ActionButton>(html`\n <sp-action-button\n hold-affordance\n @longpress=${() => longpressSpy()}\n >\n Button\n </sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(longpressSpy.callCount).to.equal(0);\n\n el.focus();\n el.dispatchEvent(new PointerEvent('pointerdown', { button: 1 }));\n await aTimeout(2 * LONGPRESS_DURATION);\n expect(longpressSpy.callCount).to.equal(0);\n });\n it(':not([toggles])', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('responds to [selected]', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.selected = true;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.selected = false;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('toggles', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button toggles>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.false;\n expect(button.getAttribute('aria-pressed')).to.equal('false');\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n });\n it('toggles [aria-haspopup][aria-expanded]', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button\n toggles\n aria-haspopup=\"true\"\n aria-expanded=\"false\"\n >\n Button\n </sp-action-button>\n `);\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.false;\n expect(button).not.to.have.attribute('aria-pressed');\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'false');\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button).not.to.have.attribute('aria-pressed');\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'true');\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button).not.to.have.attribute('aria-pressed');\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'true');\n });\n describe('dev mode', () => {\n let consoleWarnStub!: ReturnType<typeof stub>;\n before(() => {\n window.__swc.verbose = true;\n consoleWarnStub = stub(console, 'warn');\n });\n afterEach(() => {\n consoleWarnStub.resetHistory();\n });\n after(() => {\n window.__swc.verbose = false;\n consoleWarnStub.restore();\n });\n\n it('warns that `variant` is deprecated', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button variant=\"white\">Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n expect(\n (spyCall.args.at(0) as string).includes('\"variant\"'),\n 'confirm variant-centric message'\n ).to.be.true;\n expect(spyCall.args.at(-1), 'confirm `data` shape').to.deep.equal({\n data: {\n localName: 'sp-action-button',\n type: 'api',\n level: 'deprecation',\n },\n });\n });\n\n it('warns that `variant` is deprecated', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button static=\"white\">Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n expect(\n (spyCall.args.at(0) as string).includes('\"static\"'),\n 'confirm static-centric message'\n ).to.be.true;\n expect(spyCall.args.at(-1), 'confirm `data` shape').to.deep.equal({\n data: {\n localName: 'sp-action-button',\n type: 'api',\n level: 'deprecation',\n },\n });\n });\n\n it('prefers `staticColor` over `static`', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button static=\"white\">Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el.staticColor).to.equal('white');\n el.setAttribute('static', 'white');\n await elementUpdated(el);\n expect(el.staticColor).to.equal('white');\n expect(el.static).to.equal('white');\n expect(el.getAttribute('static-color')).to.equal('white');\n });\n });\n});\n"],
|
|
5
|
-
"mappings": ";AAYA,OAAO;AACP;AAAA,EAEI;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,gBAAgB;AACzB,SAAS,
|
|
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 '@spectrum-web-components/action-button/sp-action-button.js';\nimport {\n ActionButton,\n LONGPRESS_DURATION,\n} from '@spectrum-web-components/action-button';\nimport {\n aTimeout,\n elementUpdated,\n expect,\n fixture,\n html,\n waitUntil,\n} from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { spy } from 'sinon';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\nimport { m as BlackActionButton } from '../stories/action-button-black.stories.js';\n\ndescribe('ActionButton', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<ActionButton>(\n BlackActionButton(BlackActionButton.args)\n )\n );\n it('loads default', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('gardens \"value\" as a property', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el.hasAttribute('value')).to.be.false;\n el.value = 'Value';\n await elementUpdated(el);\n expect(el.hasAttribute('value')).to.be.true;\n el.value = '';\n await elementUpdated(el);\n expect(el.hasAttribute('value')).to.be.false;\n });\n it('loads [hold-affordance]', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button hold-affordance>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('manages a `tabindex`', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n expect(el.tabIndex).to.equal(0);\n expect(el.disabled).to.be.false;\n\n el.setAttribute('tabindex', '-1');\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(-1);\n expect(el.disabled).to.be.false;\n\n el.disabled = true;\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(-1);\n expect(el.disabled).to.be.true;\n\n el.disabled = false;\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(-1);\n expect(el.disabled).to.be.false;\n });\n it('manages a `size` attribute', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button size=\"xl\">Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el.size).to.equal('xl');\n expect(el.getAttribute('size')).to.equal('xl');\n el.removeAttribute('size');\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.hasAttribute('size')).to.be.false;\n });\n it('does not apply a default `size` attribute', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.hasAttribute('size')).to.be.false;\n });\n it('dispatches `longpress` events when [hold-affordance]', async () => {\n const longpressSpy = spy();\n const el = await fixture<ActionButton>(html`\n <sp-action-button\n hold-affordance\n @longpress=${() => longpressSpy()}\n >\n Button\n </sp-action-button>\n `);\n\n await elementUpdated(el);\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n expect(longpressSpy.callCount).to.equal(1);\n await sendKeys({\n press: 'Alt+ArrowDown',\n });\n\n expect(longpressSpy.callCount).to.equal(2);\n el.dispatchEvent(new PointerEvent('pointerdown', { button: 0 }));\n el.dispatchEvent(new PointerEvent('pointerup'));\n el.dispatchEvent(new PointerEvent('pointerdown', { button: 0 }));\n await waitUntil(() => longpressSpy.callCount === 3);\n });\n it('does not dispatch `longpress` events when \"right click\"ed', async () => {\n const longpressSpy = spy();\n const el = await fixture<ActionButton>(html`\n <sp-action-button\n hold-affordance\n @longpress=${() => longpressSpy()}\n >\n Button\n </sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(longpressSpy.callCount).to.equal(0);\n\n el.focus();\n el.dispatchEvent(new PointerEvent('pointerdown', { button: 1 }));\n await aTimeout(2 * LONGPRESS_DURATION);\n expect(longpressSpy.callCount).to.equal(0);\n });\n it(':not([toggles])', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('responds to [selected]', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.selected = true;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.selected = false;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('toggles', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button toggles>Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.false;\n expect(button.getAttribute('aria-pressed')).to.equal('false');\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n });\n it('toggles [aria-haspopup][aria-expanded]', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button\n toggles\n aria-haspopup=\"true\"\n aria-expanded=\"false\"\n >\n Button\n </sp-action-button>\n `);\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.false;\n expect(button).not.to.have.attribute('aria-pressed');\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'false');\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button).not.to.have.attribute('aria-pressed');\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'true');\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button).not.to.have.attribute('aria-pressed');\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'true');\n });\n it('manages a `static-color` attribute', async () => {\n const el = await fixture<ActionButton>(html`\n <sp-action-button static-color=\"black\">Button</sp-action-button>\n `);\n\n await elementUpdated(el);\n expect(el.staticColor).to.equal('black');\n expect(el.getAttribute('static-color')).to.equal('black');\n el.removeAttribute('static-color');\n await elementUpdated(el);\n expect(el.staticColor).to.be.null;\n expect(el.hasAttribute('static-color')).to.be.false;\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,OAAO;AACP;AAAA,EAEI;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,gBAAgB;AACzB,SAAS,WAAW;AACpB,SAAS,6BAA6B;AACtC,SAAS,KAAK,yBAAyB;AAEvC,SAAS,gBAAgB,MAAM;AAC3B;AAAA,IACI,YACI,MAAM;AAAA,MACF,kBAAkB,kBAAkB,IAAI;AAAA,IAC5C;AAA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