@spectrum-web-components/action-menu 0.13.5 → 0.13.8-express.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/action-menu",
3
- "version": "0.13.5",
3
+ "version": "0.13.8-express.9+abfee7409",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -46,17 +46,17 @@
46
46
  "lit-html"
47
47
  ],
48
48
  "dependencies": {
49
- "@spectrum-web-components/action-button": "^0.7.3",
50
- "@spectrum-web-components/base": "^0.5.1",
51
- "@spectrum-web-components/icon": "^0.11.2",
52
- "@spectrum-web-components/icons-workflow": "^0.8.2",
53
- "@spectrum-web-components/menu": "^0.12.0",
54
- "@spectrum-web-components/picker": "^0.10.0",
55
- "@spectrum-web-components/shared": "^0.13.3",
49
+ "@spectrum-web-components/action-button": "^0.7.5-express.9+abfee7409",
50
+ "@spectrum-web-components/base": "^0.5.2",
51
+ "@spectrum-web-components/icon": "^0.11.4-express.9+abfee7409",
52
+ "@spectrum-web-components/icons-workflow": "^0.8.4-express.9+abfee7409",
53
+ "@spectrum-web-components/menu": "^0.12.2-express.9+abfee7409",
54
+ "@spectrum-web-components/picker": "^0.10.3-express.9+abfee7409",
55
+ "@spectrum-web-components/shared": "^0.13.4",
56
56
  "tslib": "^2.0.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@spectrum-css/actionmenu": "^3.0.13"
59
+ "@spectrum-css/actionmenu": "^3.0.17"
60
60
  },
61
61
  "types": "./src/index.d.ts",
62
62
  "customElements": "custom-elements.json",
@@ -64,5 +64,5 @@
64
64
  "./sp-*.js",
65
65
  "./sync/sp-*.js"
66
66
  ],
67
- "gitHead": "f23b15ec952d7450272a8275524c905e028b4ddc"
67
+ "gitHead": "abfee740957976448a3e4cf90df17d6165f857d6"
68
68
  }
@@ -0,0 +1,15 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
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 * 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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-menu-sizes.test-vrt.js","sourceRoot":"","sources":["action-menu-sizes.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC","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"]}
@@ -0,0 +1,161 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
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/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 `
19
+ <sp-action-menu label="More Actions">
20
+ <sp-menu>
21
+ <sp-menu-item>Deselect</sp-menu-item>
22
+ <sp-menu-item>Select Inverse</sp-menu-item>
23
+ <sp-menu-item>Feather...</sp-menu-item>
24
+ <sp-menu-item>Select and Mask...</sp-menu-item>
25
+ <sp-menu-divider></sp-menu-divider>
26
+ <sp-menu-item>Save Selection</sp-menu-item>
27
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
28
+ </sp-menu>
29
+ </sp-action-menu>
30
+ `);
31
+ const actionMenuFixture = async () => await fixture(html `
32
+ <sp-action-menu label="More Actions">
33
+ <sp-menu-item>Deselect</sp-menu-item>
34
+ <sp-menu-item>Select Inverse</sp-menu-item>
35
+ <sp-menu-item>Feather...</sp-menu-item>
36
+ <sp-menu-item>Select and Mask...</sp-menu-item>
37
+ <sp-menu-divider></sp-menu-divider>
38
+ <sp-menu-item>Save Selection</sp-menu-item>
39
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
40
+ </sp-action-menu>
41
+ `);
42
+ describe('Action menu', () => {
43
+ it('loads', async () => {
44
+ const el = await actionMenuFixture();
45
+ await elementUpdated(el);
46
+ expect(el).to.not.be.undefined;
47
+ await expect(el).to.be.accessible();
48
+ });
49
+ it('loads - [slot="label"]', async () => {
50
+ const el = await fixture(html `
51
+ <sp-action-menu>
52
+ <span slot="label">More Actions</span>
53
+ <sp-menu-item>Deselect</sp-menu-item>
54
+ <sp-menu-item>Select Inverse</sp-menu-item>
55
+ <sp-menu-item>Feather...</sp-menu-item>
56
+ <sp-menu-item>Select and Mask...</sp-menu-item>
57
+ <sp-menu-divider></sp-menu-divider>
58
+ <sp-menu-item>Save Selection</sp-menu-item>
59
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
60
+ </sp-action-menu>
61
+ `);
62
+ await elementUpdated(el);
63
+ await expect(el).to.be.accessible();
64
+ });
65
+ it('loads - [custom icon]', async () => {
66
+ const el = await fixture(html `
67
+ <sp-action-menu label="More Actions">
68
+ <sp-icon-settings slot="icon"></sp-icon-settings>
69
+ <sp-menu-item>Deselect</sp-menu-item>
70
+ <sp-menu-item>Select Inverse</sp-menu-item>
71
+ <sp-menu-item>Feather...</sp-menu-item>
72
+ <sp-menu-item>Select and Mask...</sp-menu-item>
73
+ <sp-menu-divider></sp-menu-divider>
74
+ <sp-menu-item>Save Selection</sp-menu-item>
75
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
76
+ </sp-action-menu>
77
+ `);
78
+ await elementUpdated(el);
79
+ await expect(el).to.be.accessible();
80
+ });
81
+ it('stays `quiet`', async () => {
82
+ const el = await actionMenuFixture();
83
+ await elementUpdated(el);
84
+ expect(el.quiet).to.be.true;
85
+ el.quiet = false;
86
+ await elementUpdated(el);
87
+ expect(el.quiet).to.be.true;
88
+ });
89
+ it('stay `valid`', async () => {
90
+ const el = await actionMenuFixture();
91
+ await elementUpdated(el);
92
+ expect(el.invalid).to.be.false;
93
+ el.invalid = true;
94
+ await elementUpdated(el);
95
+ expect(el.invalid).to.be.false;
96
+ });
97
+ it('focus()', async () => {
98
+ const el = await actionMenuFixture();
99
+ await elementUpdated(el);
100
+ el.focus();
101
+ expect(document.activeElement).to.equal(el);
102
+ expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
103
+ const opened = oneEvent(el, 'sp-opened');
104
+ el.open = true;
105
+ await opened;
106
+ expect(document.activeElement).to.not.equal(el);
107
+ const closed = oneEvent(el, 'sp-closed');
108
+ el.open = false;
109
+ await closed;
110
+ expect(document.activeElement).to.equal(el);
111
+ expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
112
+ });
113
+ it('opens unmeasured', async () => {
114
+ const el = await actionMenuFixture();
115
+ await elementUpdated(el);
116
+ const button = el.button;
117
+ button.click();
118
+ await elementUpdated(el);
119
+ expect(el.open).to.be.true;
120
+ });
121
+ it('opens unmeasured with deprecated syntax', async () => {
122
+ const el = await deprecatedActionMenuFixture();
123
+ await elementUpdated(el);
124
+ const button = el.button;
125
+ button.click();
126
+ await elementUpdated(el);
127
+ expect(el.open).to.be.true;
128
+ });
129
+ it('toggles open/close multiple time', async () => {
130
+ const el = await actionMenuFixture();
131
+ await elementUpdated(el);
132
+ let items = el.querySelectorAll('sp-menu-item');
133
+ const count = items.length;
134
+ expect(items.length).to.equal(count);
135
+ let opened = oneEvent(el, 'sp-opened');
136
+ el.open = true;
137
+ await opened;
138
+ expect(el.open).to.be.true;
139
+ items = el.querySelectorAll('sp-menu-item');
140
+ expect(items.length).to.equal(0);
141
+ let closed = oneEvent(el, 'sp-closed');
142
+ el.open = false;
143
+ await closed;
144
+ expect(el.open).to.be.false;
145
+ items = el.querySelectorAll('sp-menu-item');
146
+ expect(items.length).to.equal(count);
147
+ opened = oneEvent(el, 'sp-opened');
148
+ el.open = true;
149
+ await opened;
150
+ expect(el.open).to.be.true;
151
+ items = el.querySelectorAll('sp-menu-item');
152
+ expect(items.length).to.equal(0);
153
+ closed = oneEvent(el, 'sp-closed');
154
+ el.open = false;
155
+ await closed;
156
+ expect(el.open).to.be.false;
157
+ items = el.querySelectorAll('sp-menu-item');
158
+ expect(items.length).to.equal(count);
159
+ });
160
+ });
161
+ //# sourceMappingURL=action-menu-sync.test.js.map
@@ -0,0 +1 @@
1
+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ChB,MAAM,MAAM,CAAC;QAEb,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QAC5B,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAErC,MAAM,GAAG,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACnC,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC;QACf,MAAM,MAAM,CAAC;QAEb,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAC3B,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEjC,MAAM,GAAG,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACnC,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC;QAChB,MAAM,MAAM,CAAC;QAEb,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QAC5B,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","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-menu/sync/sp-action-menu.js';\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport { elementUpdated, expect, fixture, html, oneEvent } from '@open-wc/testing';\n\nconst deprecatedActionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-menu>\n </sp-action-menu>\n `\n );\n\nconst actionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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\ndescribe('Action menu', () => {\n it('loads', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('loads - [slot=\"label\"]', async () => {\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu>\n <span slot=\"label\">More Actions</span>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads - [custom icon]', async () => {\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('stays `quiet`', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n\n el.quiet = false;\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n });\n it('stay `valid`', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n\n expect(el.invalid).to.be.false;\n\n el.invalid = true;\n await elementUpdated(el);\n\n expect(el.invalid).to.be.false;\n });\n it('focus()', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n\n el.focus();\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(document.activeElement).to.not.equal(el);\n\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n });\n it('opens unmeasured', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n const button = el.button as HTMLButtonElement;\n\n button.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n });\n it('opens unmeasured with deprecated syntax', async () => {\n const el = await deprecatedActionMenuFixture();\n\n await elementUpdated(el);\n const button = el.button as HTMLButtonElement;\n\n button.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n });\n it('toggles open/close multiple time', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n let items = el.querySelectorAll('sp-menu-item');\n const count = items.length;\n expect(items.length).to.equal(count);\n\n let opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(0);\n\n let closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(count);\n\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(0);\n\n closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(count);\n });\n});\n"]}
@@ -0,0 +1,15 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
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 * as stories from '../stories/action-menu.stories.js';
13
+ import { regressVisuals } from '../../../test/visual/test.js';
14
+ regressVisuals('ActionMenuStories', stories);
15
+ //# sourceMappingURL=action-menu.test-vrt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-menu.test-vrt.js","sourceRoot":"","sources":["action-menu.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC","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.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionMenuStories', stories);\n"]}
@@ -0,0 +1,161 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
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/action-menu/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 `
19
+ <sp-action-menu label="More Actions">
20
+ <sp-menu>
21
+ <sp-menu-item>Deselect</sp-menu-item>
22
+ <sp-menu-item>Select Inverse</sp-menu-item>
23
+ <sp-menu-item>Feather...</sp-menu-item>
24
+ <sp-menu-item>Select and Mask...</sp-menu-item>
25
+ <sp-menu-divider></sp-menu-divider>
26
+ <sp-menu-item>Save Selection</sp-menu-item>
27
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
28
+ </sp-menu>
29
+ </sp-action-menu>
30
+ `);
31
+ const actionMenuFixture = async () => await fixture(html `
32
+ <sp-action-menu label="More Actions">
33
+ <sp-menu-item>Deselect</sp-menu-item>
34
+ <sp-menu-item>Select Inverse</sp-menu-item>
35
+ <sp-menu-item>Feather...</sp-menu-item>
36
+ <sp-menu-item>Select and Mask...</sp-menu-item>
37
+ <sp-menu-divider></sp-menu-divider>
38
+ <sp-menu-item>Save Selection</sp-menu-item>
39
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
40
+ </sp-action-menu>
41
+ `);
42
+ describe('Action menu', () => {
43
+ it('loads', async () => {
44
+ const el = await actionMenuFixture();
45
+ await elementUpdated(el);
46
+ expect(el).to.not.be.undefined;
47
+ await expect(el).to.be.accessible();
48
+ });
49
+ it('loads - [slot="label"]', async () => {
50
+ const el = await fixture(html `
51
+ <sp-action-menu>
52
+ <span slot="label">More Actions</span>
53
+ <sp-menu-item>Deselect</sp-menu-item>
54
+ <sp-menu-item>Select Inverse</sp-menu-item>
55
+ <sp-menu-item>Feather...</sp-menu-item>
56
+ <sp-menu-item>Select and Mask...</sp-menu-item>
57
+ <sp-menu-divider></sp-menu-divider>
58
+ <sp-menu-item>Save Selection</sp-menu-item>
59
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
60
+ </sp-action-menu>
61
+ `);
62
+ await elementUpdated(el);
63
+ await expect(el).to.be.accessible();
64
+ });
65
+ it('loads - [custom icon]', async () => {
66
+ const el = await fixture(html `
67
+ <sp-action-menu label="More Actions">
68
+ <sp-icon-settings slot="icon"></sp-icon-settings>
69
+ <sp-menu-item>Deselect</sp-menu-item>
70
+ <sp-menu-item>Select Inverse</sp-menu-item>
71
+ <sp-menu-item>Feather...</sp-menu-item>
72
+ <sp-menu-item>Select and Mask...</sp-menu-item>
73
+ <sp-menu-divider></sp-menu-divider>
74
+ <sp-menu-item>Save Selection</sp-menu-item>
75
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
76
+ </sp-action-menu>
77
+ `);
78
+ await elementUpdated(el);
79
+ await expect(el).to.be.accessible();
80
+ });
81
+ it('stays `quiet`', async () => {
82
+ const el = await actionMenuFixture();
83
+ await elementUpdated(el);
84
+ expect(el.quiet).to.be.true;
85
+ el.quiet = false;
86
+ await elementUpdated(el);
87
+ expect(el.quiet).to.be.true;
88
+ });
89
+ it('stay `valid`', async () => {
90
+ const el = await actionMenuFixture();
91
+ await elementUpdated(el);
92
+ expect(el.invalid).to.be.false;
93
+ el.invalid = true;
94
+ await elementUpdated(el);
95
+ expect(el.invalid).to.be.false;
96
+ });
97
+ it('focus()', async () => {
98
+ const el = await actionMenuFixture();
99
+ await elementUpdated(el);
100
+ el.focus();
101
+ expect(document.activeElement).to.equal(el);
102
+ expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
103
+ const opened = oneEvent(el, 'sp-opened');
104
+ el.open = true;
105
+ await opened;
106
+ expect(document.activeElement).to.not.equal(el);
107
+ const closed = oneEvent(el, 'sp-closed');
108
+ el.open = false;
109
+ await closed;
110
+ expect(document.activeElement).to.equal(el);
111
+ expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
112
+ });
113
+ it('opens unmeasured', async () => {
114
+ const el = await actionMenuFixture();
115
+ await elementUpdated(el);
116
+ const button = el.button;
117
+ button.click();
118
+ await elementUpdated(el);
119
+ expect(el.open).to.be.true;
120
+ });
121
+ it('opens unmeasured with deprecated syntax', async () => {
122
+ const el = await deprecatedActionMenuFixture();
123
+ await elementUpdated(el);
124
+ const button = el.button;
125
+ button.click();
126
+ await elementUpdated(el);
127
+ expect(el.open).to.be.true;
128
+ });
129
+ it('toggles open/close multiple time', async () => {
130
+ const el = await actionMenuFixture();
131
+ await elementUpdated(el);
132
+ let items = el.querySelectorAll('sp-menu-item');
133
+ const count = items.length;
134
+ expect(items.length).to.equal(count);
135
+ let opened = oneEvent(el, 'sp-opened');
136
+ el.open = true;
137
+ await opened;
138
+ expect(el.open).to.be.true;
139
+ items = el.querySelectorAll('sp-menu-item');
140
+ expect(items.length).to.equal(0);
141
+ let closed = oneEvent(el, 'sp-closed');
142
+ el.open = false;
143
+ await closed;
144
+ expect(el.open).to.be.false;
145
+ items = el.querySelectorAll('sp-menu-item');
146
+ expect(items.length).to.equal(count);
147
+ opened = oneEvent(el, 'sp-opened');
148
+ el.open = true;
149
+ await opened;
150
+ expect(el.open).to.be.true;
151
+ items = el.querySelectorAll('sp-menu-item');
152
+ expect(items.length).to.equal(0);
153
+ closed = oneEvent(el, 'sp-closed');
154
+ el.open = false;
155
+ await closed;
156
+ expect(el.open).to.be.false;
157
+ items = el.querySelectorAll('sp-menu-item');
158
+ expect(items.length).to.equal(count);
159
+ });
160
+ });
161
+ //# sourceMappingURL=action-menu.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-menu.test.js","sourceRoot":"","sources":["action-menu.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,wDAAwD,CAAC;AAEhE,OAAO,mEAAmE,CAAC;AAC3E,OAAO,0CAA0C,CAAC;AAClD,OAAO,+CAA+C,CAAC;AACvD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEnF,MAAM,2BAA2B,GAAG,KAAK,IAAyB,EAAE,CAChE,MAAM,OAAO,CACT,IAAI,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AAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAC3B,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEjC,MAAM,GAAG,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACnC,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC;QAChB,MAAM,MAAM,CAAC;QAEb,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QAC5B,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","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-menu/sp-action-menu.js';\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport { elementUpdated, expect, fixture, html, oneEvent } from '@open-wc/testing';\n\nconst deprecatedActionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-menu>\n </sp-action-menu>\n `\n );\n\nconst actionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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\ndescribe('Action menu', () => {\n it('loads', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('loads - [slot=\"label\"]', async () => {\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu>\n <span slot=\"label\">More Actions</span>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads - [custom icon]', async () => {\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('stays `quiet`', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n\n el.quiet = false;\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n });\n it('stay `valid`', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n\n expect(el.invalid).to.be.false;\n\n el.invalid = true;\n await elementUpdated(el);\n\n expect(el.invalid).to.be.false;\n });\n it('focus()', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n\n el.focus();\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(document.activeElement).to.not.equal(el);\n\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n });\n it('opens unmeasured', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n const button = el.button as HTMLButtonElement;\n\n button.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n });\n it('opens unmeasured with deprecated syntax', async () => {\n const el = await deprecatedActionMenuFixture();\n\n await elementUpdated(el);\n const button = el.button as HTMLButtonElement;\n\n button.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n });\n it('toggles open/close multiple time', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n let items = el.querySelectorAll('sp-menu-item');\n const count = items.length;\n expect(items.length).to.equal(count);\n\n let opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(0);\n\n let closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(count);\n\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(0);\n\n closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(count);\n });\n});\n"]}