@spectrum-web-components/action-menu 0.14.0 → 0.14.1-devmode.0
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 +29 -14
- package/sp-action-menu.dev.js +3 -0
- package/sp-action-menu.dev.js.map +7 -0
- package/sp-action-menu.js +3 -14
- package/sp-action-menu.js.map +7 -1
- package/src/ActionMenu.dev.js +77 -0
- package/src/ActionMenu.dev.js.map +7 -0
- package/src/ActionMenu.js +55 -64
- package/src/ActionMenu.js.map +7 -1
- package/src/action-menu.css.dev.js +18 -0
- package/src/action-menu.css.dev.js.map +7 -0
- package/src/action-menu.css.js +3 -14
- package/src/action-menu.css.js.map +7 -1
- package/src/index.dev.js +2 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -13
- package/src/index.js.map +7 -1
- package/stories/action-menu-sizes.stories.js +10 -10
- package/stories/action-menu-sizes.stories.js.map +7 -1
- package/stories/action-menu.stories.js +54 -61
- package/stories/action-menu.stories.js.map +7 -1
- package/stories/index.js +23 -26
- package/stories/index.js.map +7 -1
- package/sync/sp-action-menu.dev.js +3 -0
- package/sync/sp-action-menu.dev.js.map +7 -0
- package/sync/sp-action-menu.js +3 -14
- package/sync/sp-action-menu.js.map +7 -1
- package/test/action-menu-sizes.test-vrt.js +4 -15
- package/test/action-menu-sizes.test-vrt.js.map +7 -1
- package/test/action-menu-sync.test.js +105 -116
- package/test/action-menu-sync.test.js.map +7 -1
- package/test/action-menu.test-vrt.js +4 -15
- package/test/action-menu.test-vrt.js.map +7 -1
- package/test/action-menu.test.js +105 -116
- package/test/action-menu.test.js.map +7 -1
- package/test/benchmark/test-basic.js +8 -19
- package/test/benchmark/test-basic.js.map +7 -1
|
@@ -1,77 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { html } from '@spectrum-web-components/base';
|
|
13
|
-
import '@spectrum-web-components/menu/sp-menu.js';
|
|
14
|
-
import '@spectrum-web-components/menu/sp-menu-item.js';
|
|
15
|
-
import { ActionMenuMarkup } from './';
|
|
16
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';
|
|
1
|
+
import { html } from "@spectrum-web-components/base";
|
|
2
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
3
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
4
|
+
import { ActionMenuMarkup } from "./";
|
|
5
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
17
6
|
export default {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
open: {
|
|
34
|
-
name: 'open',
|
|
35
|
-
type: { name: 'boolean', required: false },
|
|
36
|
-
description: 'Whether the menu is open or not.',
|
|
37
|
-
table: {
|
|
38
|
-
type: { summary: 'boolean' },
|
|
39
|
-
defaultValue: { summary: false },
|
|
40
|
-
},
|
|
41
|
-
control: 'boolean',
|
|
42
|
-
},
|
|
43
|
-
visibleLabel: {
|
|
44
|
-
name: 'Visible Label',
|
|
45
|
-
description: 'The placeholder content for the picker.',
|
|
46
|
-
type: { name: 'string', required: false },
|
|
47
|
-
table: {
|
|
48
|
-
type: { summary: 'string' },
|
|
49
|
-
defaultValue: { summary: '' },
|
|
50
|
-
},
|
|
51
|
-
control: 'text',
|
|
52
|
-
},
|
|
7
|
+
component: "sp-action-menu",
|
|
8
|
+
title: "Action menu",
|
|
9
|
+
argTypes: {
|
|
10
|
+
disabled: {
|
|
11
|
+
name: "disabled",
|
|
12
|
+
type: { name: "boolean", required: false },
|
|
13
|
+
description: "Disable this control. It will not receive focus or events.",
|
|
14
|
+
table: {
|
|
15
|
+
type: { summary: "boolean" },
|
|
16
|
+
defaultValue: { summary: false }
|
|
17
|
+
},
|
|
18
|
+
control: {
|
|
19
|
+
type: "boolean"
|
|
20
|
+
}
|
|
53
21
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
22
|
+
open: {
|
|
23
|
+
name: "open",
|
|
24
|
+
type: { name: "boolean", required: false },
|
|
25
|
+
description: "Whether the menu is open or not.",
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: "boolean" },
|
|
28
|
+
defaultValue: { summary: false }
|
|
29
|
+
},
|
|
30
|
+
control: "boolean"
|
|
58
31
|
},
|
|
32
|
+
visibleLabel: {
|
|
33
|
+
name: "Visible Label",
|
|
34
|
+
description: "The placeholder content for the picker.",
|
|
35
|
+
type: { name: "string", required: false },
|
|
36
|
+
table: {
|
|
37
|
+
type: { summary: "string" },
|
|
38
|
+
defaultValue: { summary: "" }
|
|
39
|
+
},
|
|
40
|
+
control: "text"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
args: {
|
|
44
|
+
visibleLabel: "More Actions",
|
|
45
|
+
disabled: false,
|
|
46
|
+
open: false
|
|
47
|
+
}
|
|
59
48
|
};
|
|
60
49
|
const Template = (args = {}) => ActionMenuMarkup(args);
|
|
61
50
|
export const Default = (args = {}) => Template(args);
|
|
62
|
-
export const selects = (args = {}) => Template(
|
|
51
|
+
export const selects = (args = {}) => Template({
|
|
52
|
+
...args,
|
|
53
|
+
selects: "single",
|
|
54
|
+
selected: true
|
|
55
|
+
});
|
|
63
56
|
selects.args = {
|
|
64
|
-
|
|
57
|
+
open: true
|
|
65
58
|
};
|
|
66
59
|
export const iconOnly = (args = {}) => Template(args);
|
|
67
60
|
iconOnly.args = {
|
|
68
|
-
|
|
61
|
+
visibleLabel: ""
|
|
69
62
|
};
|
|
70
63
|
export const customIcon = (args) => Template(args);
|
|
71
64
|
customIcon.args = {
|
|
72
|
-
|
|
65
|
+
customIcon: html`
|
|
73
66
|
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
74
67
|
`,
|
|
75
|
-
|
|
68
|
+
visibleLabel: ""
|
|
76
69
|
};
|
|
77
|
-
//# sourceMappingURL=action-menu.stories.js.map
|
|
70
|
+
//# sourceMappingURL=action-menu.stories.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-menu.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';\n\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport { ActionMenuMarkup } from './';\n\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\n\nexport default {\n component: 'sp-action-menu',\n title: 'Action menu',\n argTypes: {\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description:\n 'Disable this control. It will not receive focus or events.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n description: 'Whether the menu is open or not.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: 'boolean',\n },\n visibleLabel: {\n name: 'Visible Label',\n description: 'The placeholder content for the picker.',\n type: { name: 'string', required: false },\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: 'text',\n },\n },\n args: {\n visibleLabel: 'More Actions',\n disabled: false,\n open: false,\n },\n};\n\ninterface StoryArgs {\n visibleLabel?: string;\n disabled?: boolean;\n open?: boolean;\n customIcon?: string | TemplateResult;\n selects?: 'single';\n selected?: boolean;\n}\n\nconst Template = (args: StoryArgs = {}): TemplateResult =>\n ActionMenuMarkup(args);\n\nexport const Default = (args: StoryArgs = {}): TemplateResult => Template(args);\n\nexport const selects = (args: StoryArgs = {}): TemplateResult =>\n Template({\n ...args,\n selects: 'single',\n selected: true,\n });\nselects.args = {\n open: true,\n};\n\nexport const iconOnly = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\niconOnly.args = {\n visibleLabel: '',\n};\n\nexport const customIcon = (args: StoryArgs): TemplateResult => Template(args);\ncustomIcon.args = {\n customIcon: html`\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n `,\n visibleLabel: '',\n};\n"],
|
|
5
|
+
"mappings": "AAWA;AAEA;AACA;AACA;AAEA;AAEA,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,IACN,UAAU;AAAA,MACN,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,WAAW,UAAU,MAAM;AAAA,MACzC,aACI;AAAA,MACJ,OAAO;AAAA,QACH,MAAM,EAAE,SAAS,UAAU;AAAA,QAC3B,cAAc,EAAE,SAAS,MAAM;AAAA,MACnC;AAAA,MACA,SAAS;AAAA,QACL,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,MAAM;AAAA,MACF,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,WAAW,UAAU,MAAM;AAAA,MACzC,aAAa;AAAA,MACb,OAAO;AAAA,QACH,MAAM,EAAE,SAAS,UAAU;AAAA,QAC3B,cAAc,EAAE,SAAS,MAAM;AAAA,MACnC;AAAA,MACA,SAAS;AAAA,IACb;AAAA,IACA,cAAc;AAAA,MACV,MAAM;AAAA,MACN,aAAa;AAAA,MACb,MAAM,EAAE,MAAM,UAAU,UAAU,MAAM;AAAA,MACxC,OAAO;AAAA,QACH,MAAM,EAAE,SAAS,SAAS;AAAA,QAC1B,cAAc,EAAE,SAAS,GAAG;AAAA,MAChC;AAAA,MACA,SAAS;AAAA,IACb;AAAA,EACJ;AAAA,EACA,MAAM;AAAA,IACF,cAAc;AAAA,IACd,UAAU;AAAA,IACV,MAAM;AAAA,EACV;AACJ;AAWA,MAAM,WAAW,CAAC,OAAkB,CAAC,MACjC,iBAAiB,IAAI;AAElB,aAAM,UAAU,CAAC,OAAkB,CAAC,MAAsB,SAAS,IAAI;AAEvE,aAAM,UAAU,CAAC,OAAkB,CAAC,MACvC,SAAS;AAAA,KACF;AAAA,EACH,SAAS;AAAA,EACT,UAAU;AACd,CAAC;AACL,QAAQ,OAAO;AAAA,EACX,MAAM;AACV;AAEO,aAAM,WAAW,CAAC,OAAkB,CAAC,MACxC,SAAS,IAAI;AACjB,SAAS,OAAO;AAAA,EACZ,cAAc;AAClB;AAEO,aAAM,aAAa,CAAC,SAAoC,SAAS,IAAI;AAC5E,WAAW,OAAO;AAAA,EACd,YAAY;AAAA;AAAA;AAAA,EAGZ,cAAc;AAClB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/stories/index.js
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return html `
|
|
1
|
+
import { html } from "@spectrum-web-components/base";
|
|
2
|
+
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
3
|
+
import "@spectrum-web-components/icon/sp-icon.js";
|
|
4
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
5
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
6
|
+
export const ActionMenuMarkup = ({
|
|
7
|
+
ariaLabel = "More Actions",
|
|
8
|
+
changeHandler = () => void 0,
|
|
9
|
+
disabled = false,
|
|
10
|
+
open = false,
|
|
11
|
+
visibleLabel = "",
|
|
12
|
+
customIcon = "",
|
|
13
|
+
size = "m",
|
|
14
|
+
selects = "",
|
|
15
|
+
selected = false
|
|
16
|
+
} = {}) => {
|
|
17
|
+
return html`
|
|
19
18
|
<sp-action-menu
|
|
20
19
|
label=${ariaLabel}
|
|
21
20
|
?disabled=${disabled}
|
|
22
21
|
?open=${open}
|
|
23
22
|
size=${size}
|
|
24
23
|
@change="${changeHandler}"
|
|
25
|
-
.selects=${selects ? selects :
|
|
26
|
-
value=${selected ?
|
|
24
|
+
.selects=${selects ? selects : void 0}
|
|
25
|
+
value=${selected ? "Select Inverse" : ""}
|
|
27
26
|
>
|
|
28
|
-
${customIcon ? customIcon : html
|
|
29
|
-
${visibleLabel
|
|
30
|
-
? html `
|
|
27
|
+
${customIcon ? customIcon : html``}
|
|
28
|
+
${visibleLabel ? html`
|
|
31
29
|
<span slot="label">${visibleLabel}</span>
|
|
32
|
-
`
|
|
33
|
-
: html ``}
|
|
30
|
+
` : html``}
|
|
34
31
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
35
32
|
<sp-menu-item ?selected=${selected}>Select Inverse</sp-menu-item>
|
|
36
33
|
<sp-menu-item>Feather...</sp-menu-item>
|
|
@@ -41,4 +38,4 @@ export const ActionMenuMarkup = ({ ariaLabel = 'More Actions', changeHandler = (
|
|
|
41
38
|
</sp-action-menu>
|
|
42
39
|
`;
|
|
43
40
|
};
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
package/stories/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\n\nexport const ActionMenuMarkup = ({\n ariaLabel = 'More Actions',\n changeHandler = (() => undefined) as (event: Event) => void,\n disabled = false,\n open = false,\n visibleLabel = '',\n customIcon = '' as string | TemplateResult,\n size = 'm' as 'm' | 's' | 'l' | 'xl' | 'xxl',\n selects = '' as 'single',\n selected = false,\n} = {}): TemplateResult => {\n return html`\n <sp-action-menu\n label=${ariaLabel}\n ?disabled=${disabled}\n ?open=${open}\n size=${size}\n @change=\"${changeHandler}\"\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n >\n ${customIcon ? customIcon : html``}\n ${visibleLabel\n ? html`\n <span slot=\"label\">${visibleLabel}</span>\n `\n : html``}\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item ?selected=${selected}>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-action-menu>\n `;\n};\n"],
|
|
5
|
+
"mappings": "AAWA;AAEA;AACA;AACA;AACA;AAEO,aAAM,mBAAmB,CAAC;AAAA,EAC7B,YAAY;AAAA,EACZ,gBAAiB,MAAM;AAAA,EACvB,WAAW;AAAA,EACX,OAAO;AAAA,EACP,eAAe;AAAA,EACf,aAAa;AAAA,EACb,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,IACX,CAAC,MAAsB;AACvB,SAAO;AAAA;AAAA,oBAES;AAAA,wBACI;AAAA,oBACJ;AAAA,mBACD;AAAA,uBACI;AAAA,uBACA,UAAU,UAAU;AAAA,oBACvB,WAAW,mBAAmB;AAAA;AAAA,cAEpC,aAAa,aAAa;AAAA,cAC1B,eACI;AAAA,2CACyB;AAAA,sBAEzB;AAAA;AAAA,sCAEoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQtC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-action-menu.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/picker/sync/index.js';\nimport '../sp-action-menu.dev.js'\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sync/sp-action-menu.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import '@spectrum-web-components/picker/sync/index.js';
|
|
13
|
-
import '../sp-action-menu.js';
|
|
14
|
-
//# sourceMappingURL=sp-action-menu.js.map
|
|
1
|
+
import "@spectrum-web-components/picker/sync/index.js";
|
|
2
|
+
import "../sp-action-menu.js";
|
|
3
|
+
//# sourceMappingURL=sp-action-menu.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-action-menu.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/picker/sync/index.js';\nimport '../sp-action-menu.js';\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import * as stories from '../stories/action-menu-sizes.stories.js';
|
|
13
|
-
import { regressVisuals } from '../../../test/visual/test.js';
|
|
14
|
-
regressVisuals('ActionMenuSizesStories', stories);
|
|
15
|
-
//# sourceMappingURL=action-menu-sizes.test-vrt.js.map
|
|
1
|
+
import * as stories from "../stories/action-menu-sizes.stories.js";
|
|
2
|
+
import { regressVisuals } from "../../../test/visual/test.js";
|
|
3
|
+
regressVisuals("ActionMenuSizesStories", stories);
|
|
4
|
+
//# sourceMappingURL=action-menu-sizes.test-vrt.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-menu-sizes.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-menu-sizes.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionMenuSizesStories', stories);\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;AAEA,eAAe,0BAA0B,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import '@spectrum-web-components/action-menu/sync/sp-action-menu.js';
|
|
13
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';
|
|
14
|
-
import '@spectrum-web-components/menu/sp-menu.js';
|
|
15
|
-
import '@spectrum-web-components/menu/sp-menu-item.js';
|
|
16
|
-
import '@spectrum-web-components/menu/sp-menu-divider.js';
|
|
17
|
-
import { elementUpdated, expect, fixture, html, oneEvent } from '@open-wc/testing';
|
|
18
|
-
const deprecatedActionMenuFixture = async () => await fixture(html `
|
|
1
|
+
import "@spectrum-web-components/action-menu/sync/sp-action-menu.js";
|
|
2
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
3
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
4
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
5
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
6
|
+
import { elementUpdated, expect, fixture, html, oneEvent } from "@open-wc/testing";
|
|
7
|
+
const deprecatedActionMenuFixture = async () => await fixture(html`
|
|
19
8
|
<sp-action-menu label="More Actions">
|
|
20
9
|
<sp-menu>
|
|
21
10
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -28,7 +17,7 @@ const deprecatedActionMenuFixture = async () => await fixture(html `
|
|
|
28
17
|
</sp-menu>
|
|
29
18
|
</sp-action-menu>
|
|
30
19
|
`);
|
|
31
|
-
const actionMenuFixture = async () => await fixture(html
|
|
20
|
+
const actionMenuFixture = async () => await fixture(html`
|
|
32
21
|
<sp-action-menu label="More Actions">
|
|
33
22
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
34
23
|
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
@@ -39,15 +28,15 @@ const actionMenuFixture = async () => await fixture(html `
|
|
|
39
28
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
40
29
|
</sp-action-menu>
|
|
41
30
|
`);
|
|
42
|
-
describe(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
31
|
+
describe("Action menu", () => {
|
|
32
|
+
it("loads", async () => {
|
|
33
|
+
const el = await actionMenuFixture();
|
|
34
|
+
await elementUpdated(el);
|
|
35
|
+
expect(el).to.not.be.undefined;
|
|
36
|
+
await expect(el).to.be.accessible();
|
|
37
|
+
});
|
|
38
|
+
it('loads - [slot="label"]', async () => {
|
|
39
|
+
const el = await fixture(html`
|
|
51
40
|
<sp-action-menu>
|
|
52
41
|
<span slot="label">More Actions</span>
|
|
53
42
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -59,11 +48,11 @@ describe('Action menu', () => {
|
|
|
59
48
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
60
49
|
</sp-action-menu>
|
|
61
50
|
`);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
51
|
+
await elementUpdated(el);
|
|
52
|
+
await expect(el).to.be.accessible();
|
|
53
|
+
});
|
|
54
|
+
it("loads - [custom icon]", async () => {
|
|
55
|
+
const el = await fixture(html`
|
|
67
56
|
<sp-action-menu label="More Actions">
|
|
68
57
|
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
69
58
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -75,87 +64,87 @@ describe('Action menu', () => {
|
|
|
75
64
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
76
65
|
</sp-action-menu>
|
|
77
66
|
`);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
67
|
+
await elementUpdated(el);
|
|
68
|
+
await expect(el).to.be.accessible();
|
|
69
|
+
});
|
|
70
|
+
it("stays `quiet`", async () => {
|
|
71
|
+
const el = await actionMenuFixture();
|
|
72
|
+
await elementUpdated(el);
|
|
73
|
+
expect(el.quiet).to.be.true;
|
|
74
|
+
el.quiet = false;
|
|
75
|
+
await elementUpdated(el);
|
|
76
|
+
expect(el.quiet).to.be.true;
|
|
77
|
+
});
|
|
78
|
+
it("stay `valid`", async () => {
|
|
79
|
+
const el = await actionMenuFixture();
|
|
80
|
+
await elementUpdated(el);
|
|
81
|
+
expect(el.invalid).to.be.false;
|
|
82
|
+
el.invalid = true;
|
|
83
|
+
await elementUpdated(el);
|
|
84
|
+
expect(el.invalid).to.be.false;
|
|
85
|
+
});
|
|
86
|
+
it("focus()", async () => {
|
|
87
|
+
const el = await actionMenuFixture();
|
|
88
|
+
await elementUpdated(el);
|
|
89
|
+
el.focus();
|
|
90
|
+
expect(document.activeElement).to.equal(el);
|
|
91
|
+
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
92
|
+
const opened = oneEvent(el, "sp-opened");
|
|
93
|
+
el.open = true;
|
|
94
|
+
await opened;
|
|
95
|
+
expect(document.activeElement).to.not.equal(el);
|
|
96
|
+
const closed = oneEvent(el, "sp-closed");
|
|
97
|
+
el.open = false;
|
|
98
|
+
await closed;
|
|
99
|
+
expect(document.activeElement).to.equal(el);
|
|
100
|
+
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
101
|
+
});
|
|
102
|
+
it("opens unmeasured", async () => {
|
|
103
|
+
const el = await actionMenuFixture();
|
|
104
|
+
await elementUpdated(el);
|
|
105
|
+
const button = el.button;
|
|
106
|
+
button.click();
|
|
107
|
+
await elementUpdated(el);
|
|
108
|
+
expect(el.open).to.be.true;
|
|
109
|
+
});
|
|
110
|
+
it("opens unmeasured with deprecated syntax", async () => {
|
|
111
|
+
const el = await deprecatedActionMenuFixture();
|
|
112
|
+
await elementUpdated(el);
|
|
113
|
+
const button = el.button;
|
|
114
|
+
button.click();
|
|
115
|
+
await elementUpdated(el);
|
|
116
|
+
expect(el.open).to.be.true;
|
|
117
|
+
});
|
|
118
|
+
it("toggles open/close multiple time", async () => {
|
|
119
|
+
const el = await actionMenuFixture();
|
|
120
|
+
await elementUpdated(el);
|
|
121
|
+
let items = el.querySelectorAll("sp-menu-item");
|
|
122
|
+
const count = items.length;
|
|
123
|
+
expect(items.length).to.equal(count);
|
|
124
|
+
let opened = oneEvent(el, "sp-opened");
|
|
125
|
+
el.open = true;
|
|
126
|
+
await opened;
|
|
127
|
+
expect(el.open).to.be.true;
|
|
128
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
129
|
+
expect(items.length).to.equal(0);
|
|
130
|
+
let closed = oneEvent(el, "sp-closed");
|
|
131
|
+
el.open = false;
|
|
132
|
+
await closed;
|
|
133
|
+
expect(el.open).to.be.false;
|
|
134
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
135
|
+
expect(items.length).to.equal(count);
|
|
136
|
+
opened = oneEvent(el, "sp-opened");
|
|
137
|
+
el.open = true;
|
|
138
|
+
await opened;
|
|
139
|
+
expect(el.open).to.be.true;
|
|
140
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
141
|
+
expect(items.length).to.equal(0);
|
|
142
|
+
closed = oneEvent(el, "sp-closed");
|
|
143
|
+
el.open = false;
|
|
144
|
+
await closed;
|
|
145
|
+
expect(el.open).to.be.false;
|
|
146
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
147
|
+
expect(items.length).to.equal(count);
|
|
148
|
+
});
|
|
160
149
|
});
|
|
161
|
-
//# sourceMappingURL=action-menu-sync.test.js.map
|
|
150
|
+
//# sourceMappingURL=action-menu-sync.test.js.map
|