@spectrum-web-components/action-menu 1.1.0 → 1.1.2
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 +8 -8
- package/sp-action-menu.d.ts +6 -0
- package/sp-action-menu.dev.js +5 -0
- package/sp-action-menu.dev.js.map +7 -0
- package/sp-action-menu.js +2 -0
- package/sp-action-menu.js.map +7 -0
- package/src/ActionMenu.d.ts +38 -0
- package/src/ActionMenu.dev.js +118 -0
- package/src/ActionMenu.dev.js.map +7 -0
- package/src/ActionMenu.js +43 -0
- package/src/ActionMenu.js.map +7 -0
- package/src/action-menu.css.d.ts +2 -0
- package/src/action-menu.css.dev.js +7 -0
- package/src/action-menu.css.dev.js.map +7 -0
- package/src/action-menu.css.js +4 -0
- package/src/action-menu.css.js.map +7 -0
- package/src/index.d.ts +1 -0
- package/src/index.dev.js +3 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/stories/action-menu-sizes.stories.js +23 -0
- package/stories/action-menu-sizes.stories.js.map +7 -0
- package/stories/action-menu.stories.js +469 -0
- package/stories/action-menu.stories.js.map +7 -0
- package/stories/index.js +71 -0
- package/stories/index.js.map +7 -0
- package/sync/sp-action-menu.d.ts +2 -0
- package/sync/sp-action-menu.dev.js +4 -0
- package/sync/sp-action-menu.dev.js.map +7 -0
- package/sync/sp-action-menu.js +2 -0
- package/sync/sp-action-menu.js.map +7 -0
- package/test/action-menu-directive.test.js +29 -0
- package/test/action-menu-directive.test.js.map +7 -0
- package/test/action-menu-groups.test.js +85 -0
- package/test/action-menu-groups.test.js.map +7 -0
- package/test/action-menu-memory.test.js +5 -0
- package/test/action-menu-memory.test.js.map +7 -0
- package/test/action-menu-responsive.test.js +120 -0
- package/test/action-menu-responsive.test.js.map +7 -0
- package/test/action-menu-sizes.test-vrt.js +5 -0
- package/test/action-menu-sizes.test-vrt.js.map +7 -0
- package/test/action-menu-sync.test.js +9 -0
- package/test/action-menu-sync.test.js.map +7 -0
- package/test/action-menu.test-vrt.js +5 -0
- package/test/action-menu.test-vrt.js.map +7 -0
- package/test/action-menu.test.js +9 -0
- package/test/action-menu.test.js.map +7 -0
- package/test/benchmark/test-basic.js +21 -0
- package/test/benchmark/test-basic.js.map +7 -0
- package/test/benchmark/test-directive.js +26 -0
- package/test/benchmark/test-directive.js.map +7 -0
- package/test/benchmark/test-lazy.js +35 -0
- package/test/benchmark/test-lazy.js.map +7 -0
- package/test/benchmark/test-open-close-directive.js +67 -0
- package/test/benchmark/test-open-close-directive.js.map +7 -0
- package/test/benchmark/test-open-close.js +62 -0
- package/test/benchmark/test-open-close.js.map +7 -0
- package/test/index.js +651 -0
- package/test/index.js.map +7 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { expect, oneEvent } from "@open-wc/testing";
|
|
3
|
+
import { sendKeys } from "@web/test-runner-commands";
|
|
4
|
+
import { directive } from "../stories/action-menu.stories.js";
|
|
5
|
+
import { fixture } from "../../../test/testing-helpers.js";
|
|
6
|
+
import { nextFrame } from "@spectrum-web-components/overlay/src/AbstractOverlay.js";
|
|
7
|
+
describe("Slottable Request Directive", () => {
|
|
8
|
+
it("Action Menu requests for options rendering when opening and closing", async function() {
|
|
9
|
+
const el = await fixture(directive());
|
|
10
|
+
const initialNodeLength = el.children.length;
|
|
11
|
+
expect(el.open).to.be.false;
|
|
12
|
+
expect(el.children.length).to.equal(initialNodeLength);
|
|
13
|
+
const opened = oneEvent(el, "sp-opened");
|
|
14
|
+
el.click();
|
|
15
|
+
await opened;
|
|
16
|
+
expect(el.open).to.be.true;
|
|
17
|
+
expect(el.children.length).to.be.gt(initialNodeLength);
|
|
18
|
+
const closed = oneEvent(el, "sp-closed");
|
|
19
|
+
await sendKeys({
|
|
20
|
+
press: "Escape"
|
|
21
|
+
});
|
|
22
|
+
await closed;
|
|
23
|
+
await nextFrame();
|
|
24
|
+
await nextFrame();
|
|
25
|
+
expect(el.open).to.be.false;
|
|
26
|
+
expect(el.children.length).to.equal(initialNodeLength);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=action-menu-directive.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-menu-directive.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { expect, oneEvent } from '@open-wc/testing';\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport { sendKeys } from '@web/test-runner-commands';\n\nimport { directive } from '../stories/action-menu.stories.js';\nimport { fixture } from '../../../test/testing-helpers.js';\nimport { nextFrame } from '@spectrum-web-components/overlay/src/AbstractOverlay.js';\n\ndescribe('Slottable Request Directive', () => {\n it('Action Menu requests for options rendering when opening and closing', async function () {\n const el = await fixture<ActionMenu>(directive());\n const initialNodeLength = el.children.length;\n expect(el.open).to.be.false;\n expect(el.children.length).to.equal(initialNodeLength);\n\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await opened;\n\n expect(el.open).to.be.true;\n expect(el.children.length).to.be.gt(initialNodeLength);\n\n const closed = oneEvent(el, 'sp-closed');\n await sendKeys({\n press: 'Escape',\n });\n await closed;\n await nextFrame();\n await nextFrame();\n\n expect(el.open).to.be.false;\n expect(el.children.length).to.equal(initialNodeLength);\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,QAAQ,gBAAgB;AAEjC,SAAS,gBAAgB;AAEzB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAE1B,SAAS,+BAA+B,MAAM;AAC1C,KAAG,uEAAuE,iBAAkB;AACxF,UAAM,KAAK,MAAM,QAAoB,UAAU,CAAC;AAChD,UAAM,oBAAoB,GAAG,SAAS;AACtC,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,WAAO,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,iBAAiB;AAErD,UAAM,SAAS,SAAS,IAAI,WAAW;AACvC,OAAG,MAAM;AACT,UAAM;AAEN,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,WAAO,GAAG,SAAS,MAAM,EAAE,GAAG,GAAG,GAAG,iBAAiB;AAErD,UAAM,SAAS,SAAS,IAAI,WAAW;AACvC,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AACD,UAAM;AACN,UAAM,UAAU;AAChB,UAAM,UAAU;AAEhB,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,WAAO,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,iBAAiB;AAAA,EACzD,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { elementUpdated, expect, oneEvent } from "@open-wc/testing";
|
|
3
|
+
import { fixture } from "../../../test/testing-helpers.js";
|
|
4
|
+
import { sendKeys } from "@web/test-runner-commands";
|
|
5
|
+
import { groupsWithSelects } from "../stories/action-menu.stories.js";
|
|
6
|
+
describe("Action Menu - Groups", () => {
|
|
7
|
+
it("throws focus into the Menu when opened", async function() {
|
|
8
|
+
var _a;
|
|
9
|
+
const el = await fixture(
|
|
10
|
+
groupsWithSelects({ onChange: () => {
|
|
11
|
+
} })
|
|
12
|
+
);
|
|
13
|
+
const firstGroup = el.querySelector("sp-menu-group");
|
|
14
|
+
const firstItem = el.querySelector("sp-menu-item");
|
|
15
|
+
expect(firstItem.focused).to.be.false;
|
|
16
|
+
expect(document.activeElement === firstGroup).to.be.false;
|
|
17
|
+
const opened = oneEvent(el, "sp-opened");
|
|
18
|
+
el.focus();
|
|
19
|
+
await sendKeys({
|
|
20
|
+
press: "ArrowDown"
|
|
21
|
+
});
|
|
22
|
+
await opened;
|
|
23
|
+
expect(firstItem.focused).to.be.true;
|
|
24
|
+
expect(
|
|
25
|
+
document.activeElement === firstGroup,
|
|
26
|
+
(_a = document.activeElement) == null ? void 0 : _a.localName
|
|
27
|
+
).to.be.true;
|
|
28
|
+
});
|
|
29
|
+
it('toggles child group with `selects="multiple"`', async function() {
|
|
30
|
+
var _a;
|
|
31
|
+
this.retries(0);
|
|
32
|
+
const el = await fixture(
|
|
33
|
+
groupsWithSelects({ onChange: () => {
|
|
34
|
+
} })
|
|
35
|
+
);
|
|
36
|
+
const multipleGroup = el.querySelector(
|
|
37
|
+
'[selects="multiple"]'
|
|
38
|
+
);
|
|
39
|
+
const firstItem = multipleGroup.querySelector(
|
|
40
|
+
"sp-menu-item"
|
|
41
|
+
);
|
|
42
|
+
expect(firstItem.selected).to.be.false;
|
|
43
|
+
let opened = oneEvent(el, "sp-opened");
|
|
44
|
+
el.focus();
|
|
45
|
+
await sendKeys({
|
|
46
|
+
press: "ArrowDown"
|
|
47
|
+
});
|
|
48
|
+
await opened;
|
|
49
|
+
expect(el.open).to.be.true;
|
|
50
|
+
await sendKeys({
|
|
51
|
+
press: "ArrowUp"
|
|
52
|
+
});
|
|
53
|
+
await elementUpdated(el);
|
|
54
|
+
let closed = oneEvent(el, "sp-closed");
|
|
55
|
+
await sendKeys({
|
|
56
|
+
press: "Enter"
|
|
57
|
+
});
|
|
58
|
+
await closed;
|
|
59
|
+
await elementUpdated(el);
|
|
60
|
+
await elementUpdated(firstItem);
|
|
61
|
+
expect(el.open).to.be.false;
|
|
62
|
+
expect(firstItem.selected).to.be.true;
|
|
63
|
+
expect(document.activeElement === el, (_a = document.activeElement) == null ? void 0 : _a.localName).to.be.true;
|
|
64
|
+
opened = oneEvent(el, "sp-opened");
|
|
65
|
+
await sendKeys({
|
|
66
|
+
press: "ArrowDown"
|
|
67
|
+
});
|
|
68
|
+
await opened;
|
|
69
|
+
expect(el.open).to.be.true;
|
|
70
|
+
await sendKeys({
|
|
71
|
+
press: "ArrowUp"
|
|
72
|
+
});
|
|
73
|
+
await elementUpdated(el);
|
|
74
|
+
closed = oneEvent(el, "sp-closed");
|
|
75
|
+
await sendKeys({
|
|
76
|
+
press: "Enter"
|
|
77
|
+
});
|
|
78
|
+
await closed;
|
|
79
|
+
await elementUpdated(el);
|
|
80
|
+
await elementUpdated(firstItem);
|
|
81
|
+
expect(el.open).to.be.false;
|
|
82
|
+
expect(firstItem.selected).to.be.false;
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=action-menu-groups.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-menu-groups.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 { elementUpdated, expect, oneEvent } from '@open-wc/testing';\nimport { fixture } from '../../../test/testing-helpers.js';\nimport { sendKeys } from '@web/test-runner-commands';\n\nimport { groupsWithSelects } from '../stories/action-menu.stories.js';\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport { MenuItem } from '@spectrum-web-components/menu';\n\ndescribe('Action Menu - Groups', () => {\n it('throws focus into the Menu when opened', async function () {\n const el = await fixture<ActionMenu>(\n groupsWithSelects({ onChange: () => {} })\n );\n\n const firstGroup = el.querySelector('sp-menu-group') as HTMLElement;\n const firstItem = el.querySelector('sp-menu-item') as MenuItem;\n\n expect(firstItem.focused).to.be.false;\n expect(document.activeElement === firstGroup).to.be.false;\n\n const opened = oneEvent(el, 'sp-opened');\n el.focus();\n await sendKeys({\n press: 'ArrowDown',\n });\n await opened;\n\n expect(firstItem.focused).to.be.true;\n expect(\n document.activeElement === firstGroup,\n document.activeElement?.localName\n ).to.be.true;\n });\n\n it('toggles child group with `selects=\"multiple\"`', async function () {\n this.retries(0);\n const el = await fixture<ActionMenu>(\n groupsWithSelects({ onChange: () => {} })\n );\n\n const multipleGroup = el.querySelector(\n '[selects=\"multiple\"]'\n ) as HTMLElement;\n const firstItem = multipleGroup.querySelector(\n 'sp-menu-item'\n ) as MenuItem;\n\n expect(firstItem.selected).to.be.false;\n\n let opened = oneEvent(el, 'sp-opened');\n el.focus();\n await sendKeys({\n press: 'ArrowDown',\n });\n await opened;\n expect(el.open).to.be.true;\n\n await sendKeys({\n press: 'ArrowUp',\n });\n await elementUpdated(el);\n\n let closed = oneEvent(el, 'sp-closed');\n await sendKeys({\n press: 'Enter',\n });\n await closed;\n\n await elementUpdated(el);\n await elementUpdated(firstItem);\n\n expect(el.open).to.be.false;\n expect(firstItem.selected).to.be.true;\n expect(document.activeElement === el, document.activeElement?.localName)\n .to.be.true;\n\n opened = oneEvent(el, 'sp-opened');\n await sendKeys({\n press: 'ArrowDown',\n });\n await opened;\n expect(el.open).to.be.true;\n\n await sendKeys({\n press: 'ArrowUp',\n });\n await elementUpdated(el);\n\n closed = oneEvent(el, 'sp-closed');\n await sendKeys({\n press: 'Enter',\n });\n await closed;\n\n await elementUpdated(el);\n await elementUpdated(firstItem);\n\n expect(el.open).to.be.false;\n expect(firstItem.selected).to.be.false;\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,gBAAgB,QAAQ,gBAAgB;AACjD,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAEzB,SAAS,yBAAyB;AAIl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AAM;AAEN,UAAM,eAAe,EAAE;AACvB,UAAM,eAAe,SAAS;AAE9B,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,WAAO,UAAU,QAAQ,EAAE,GAAG,GAAG;AACjC,WAAO,SAAS,kBAAkB,KAAI,cAAS,kBAAT,mBAAwB,SAAS,EAClE,GAAG,GAAG;AAEX,aAAS,SAAS,IAAI,WAAW;AACjC,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AACD,UAAM;AACN,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAEtB,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AACD,UAAM,eAAe,EAAE;AAEvB,aAAS,SAAS,IAAI,WAAW;AACjC,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AACD,UAAM;AAEN,UAAM,eAAe,EAAE;AACvB,UAAM,eAAe,SAAS;AAE9B,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,WAAO,UAAU,QAAQ,EAAE,GAAG,GAAG;AAAA,EACrC,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-menu-memory.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\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 { Default } from '../stories/action-menu.stories.js';\nimport { testForMemoryLeaks } from '../../../test/testing-helpers.js';\n\ntestForMemoryLeaks(Default({}));\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,eAAe;AACxB,SAAS,0BAA0B;AAEnC,mBAAmB,QAAQ,CAAC,CAAC,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import {
|
|
3
|
+
elementUpdated,
|
|
4
|
+
expect,
|
|
5
|
+
fixture,
|
|
6
|
+
html,
|
|
7
|
+
nextFrame,
|
|
8
|
+
oneEvent
|
|
9
|
+
} from "@open-wc/testing";
|
|
10
|
+
import "@spectrum-web-components/action-menu/sync/sp-action-menu.js";
|
|
11
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
12
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
13
|
+
import { setViewport } from "@web/test-runner-commands";
|
|
14
|
+
import { spreadProps } from "../../../test/lit-helpers.js";
|
|
15
|
+
import { sendMouse } from "../../../test/plugins/browser.js";
|
|
16
|
+
describe("ActionMenu, responsive", () => {
|
|
17
|
+
let el;
|
|
18
|
+
const actionMenuFixture = async (args) => {
|
|
19
|
+
const test = await fixture(html`
|
|
20
|
+
<div>
|
|
21
|
+
<sp-action-menu id="action-menu" ${spreadProps(args || {})}>
|
|
22
|
+
<span slot="label">Action Menu</span>
|
|
23
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
24
|
+
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
25
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
26
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
27
|
+
<sp-menu-divider></sp-menu-divider>
|
|
28
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
29
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
30
|
+
</sp-action-menu>
|
|
31
|
+
</div>
|
|
32
|
+
`);
|
|
33
|
+
return test.querySelector("sp-action-menu");
|
|
34
|
+
};
|
|
35
|
+
describe("container", () => {
|
|
36
|
+
beforeEach(async () => {
|
|
37
|
+
el = await actionMenuFixture();
|
|
38
|
+
await elementUpdated(el);
|
|
39
|
+
});
|
|
40
|
+
it("is a Tray in mobile", async () => {
|
|
41
|
+
el.isMobile.matches = true;
|
|
42
|
+
el.bindEvents();
|
|
43
|
+
await setViewport({ width: 360, height: 640 });
|
|
44
|
+
await nextFrame();
|
|
45
|
+
const opened = oneEvent(el, "sp-opened");
|
|
46
|
+
const boundingRect = el.button.getBoundingClientRect();
|
|
47
|
+
sendMouse({
|
|
48
|
+
steps: [
|
|
49
|
+
{
|
|
50
|
+
type: "click",
|
|
51
|
+
position: [
|
|
52
|
+
boundingRect.x + boundingRect.width / 2,
|
|
53
|
+
boundingRect.y + boundingRect.height / 2
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
await opened;
|
|
59
|
+
const tray = el.shadowRoot.querySelector("sp-tray");
|
|
60
|
+
const popover = el.shadowRoot.querySelector("sp-popover");
|
|
61
|
+
expect(tray).to.not.be.null;
|
|
62
|
+
expect(popover).to.be.null;
|
|
63
|
+
});
|
|
64
|
+
it("is a Popover in desktop", async () => {
|
|
65
|
+
await setViewport({ width: 701, height: 640 });
|
|
66
|
+
await nextFrame();
|
|
67
|
+
await nextFrame();
|
|
68
|
+
const opened = oneEvent(el, "sp-opened");
|
|
69
|
+
el.open = true;
|
|
70
|
+
await opened;
|
|
71
|
+
const popover = el.shadowRoot.querySelector("sp-popover");
|
|
72
|
+
const tray = el.shadowRoot.querySelector("sp-tray");
|
|
73
|
+
expect(popover).to.not.be.null;
|
|
74
|
+
expect(tray).to.be.null;
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe("forcePopover", () => {
|
|
78
|
+
beforeEach(async () => {
|
|
79
|
+
el = await actionMenuFixture({ forcePopover: true });
|
|
80
|
+
await elementUpdated(el);
|
|
81
|
+
});
|
|
82
|
+
it("is a Popover in mobile", async () => {
|
|
83
|
+
el.isMobile.matches = true;
|
|
84
|
+
el.bindEvents();
|
|
85
|
+
await setViewport({ width: 360, height: 640 });
|
|
86
|
+
await nextFrame();
|
|
87
|
+
const opened = oneEvent(el, "sp-opened");
|
|
88
|
+
const boundingRect = el.button.getBoundingClientRect();
|
|
89
|
+
sendMouse({
|
|
90
|
+
steps: [
|
|
91
|
+
{
|
|
92
|
+
type: "click",
|
|
93
|
+
position: [
|
|
94
|
+
boundingRect.x + boundingRect.width / 2,
|
|
95
|
+
boundingRect.y + boundingRect.height / 2
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
await opened;
|
|
101
|
+
const tray = el.shadowRoot.querySelector("sp-tray");
|
|
102
|
+
const popover = el.shadowRoot.querySelector("sp-popover");
|
|
103
|
+
expect(tray).to.be.null;
|
|
104
|
+
expect(popover).to.not.be.null;
|
|
105
|
+
});
|
|
106
|
+
it("is a Popover in desktop", async () => {
|
|
107
|
+
await setViewport({ width: 701, height: 640 });
|
|
108
|
+
await nextFrame();
|
|
109
|
+
await nextFrame();
|
|
110
|
+
const opened = oneEvent(el, "sp-opened");
|
|
111
|
+
el.open = true;
|
|
112
|
+
await opened;
|
|
113
|
+
const popover = el.shadowRoot.querySelector("sp-popover");
|
|
114
|
+
const tray = el.shadowRoot.querySelector("sp-tray");
|
|
115
|
+
expect(popover).to.not.be.null;
|
|
116
|
+
expect(tray).to.be.null;
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
//# sourceMappingURL=action-menu-responsive.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-menu-responsive.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 {\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport '@spectrum-web-components/action-menu/sync/sp-action-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport { setViewport } from '@web/test-runner-commands';\nimport { spreadProps } from '../../../test/lit-helpers.js';\nimport { sendMouse } from '../../../test/plugins/browser.js';\n\ndescribe('ActionMenu, responsive', () => {\n let el: ActionMenu;\n const actionMenuFixture = async (args?: {\n forcePopover: boolean;\n }): Promise<ActionMenu> => {\n const test = await fixture<HTMLDivElement>(html`\n <div>\n <sp-action-menu id=\"action-menu\" ${spreadProps(args || {})}>\n <span slot=\"label\">Action Menu</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 </div>\n `);\n\n return test.querySelector('sp-action-menu') as ActionMenu;\n };\n\n describe('container', () => {\n beforeEach(async () => {\n el = await actionMenuFixture();\n await elementUpdated(el);\n });\n\n it('is a Tray in mobile', async () => {\n /**\n * This is a hack to set the `isMobile` property to true so that we can test the MobileController\n */\n el.isMobile.matches = true;\n el.bindEvents();\n\n /**\n * While we can set the view port, but not `(hover: none) and (pointer: coarse)`\n * which prevents us from testing this at unit time. Hopefully there will be\n * a future version of Playwright and/or @web/test-runner that does allow this.\n * See: https://github.com/microsoft/playwright/issues/11781\n **/\n await setViewport({ width: 360, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n\n const opened = oneEvent(el, 'sp-opened');\n\n const boundingRect = el.button.getBoundingClientRect();\n sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n ],\n });\n\n await opened;\n\n const tray = el.shadowRoot.querySelector('sp-tray');\n const popover = el.shadowRoot.querySelector('sp-popover');\n\n expect(tray).to.not.be.null;\n expect(popover).to.be.null;\n });\n\n it('is a Popover in desktop', async () => {\n await setViewport({ width: 701, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n await nextFrame();\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n const popover = el.shadowRoot.querySelector('sp-popover');\n const tray = el.shadowRoot.querySelector('sp-tray');\n\n expect(popover).to.not.be.null;\n expect(tray).to.be.null;\n });\n });\n\n describe('forcePopover', () => {\n beforeEach(async () => {\n el = await actionMenuFixture({ forcePopover: true });\n await elementUpdated(el);\n });\n\n it('is a Popover in mobile', async () => {\n /**\n * This is a hack to set the `isMobile` property to true so that we can test the MobileController\n */\n el.isMobile.matches = true;\n el.bindEvents();\n\n /**\n * While we can set the view port, but not `(hover: none) and (pointer: coarse)`\n * which prevents us from testing this at unit time. Hopefully there will be\n * a future version of Playwright and/or @web/test-runner that does allow this.\n * See: https://github.com/microsoft/playwright/issues/11781\n **/\n await setViewport({ width: 360, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n\n const opened = oneEvent(el, 'sp-opened');\n\n const boundingRect = el.button.getBoundingClientRect();\n sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n ],\n });\n\n await opened;\n\n const tray = el.shadowRoot.querySelector('sp-tray');\n const popover = el.shadowRoot.querySelector('sp-popover');\n\n expect(tray).to.be.null;\n expect(popover).to.not.be.null;\n });\n\n it('is a Popover in desktop', async () => {\n await setViewport({ width: 701, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n await nextFrame();\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n const popover = el.shadowRoot.querySelector('sp-popover');\n const tray = el.shadowRoot.querySelector('sp-tray');\n\n expect(popover).to.not.be.null;\n expect(tray).to.be.null;\n });\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAE1B,SAAS,0BAA0B,MAAM;AACrC,MAAI;AACJ,QAAM,oBAAoB,OAAO,SAEN;AACvB,UAAM,OAAO,MAAM,QAAwB;AAAA;AAAA,mDAEA,YAAY,QAAQ,CAAC,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAWjE;AAED,WAAO,KAAK,cAAc,gBAAgB;AAAA,EAC9C;AAEA,WAAS,aAAa,MAAM;AACxB,eAAW,YAAY;AACnB,WAAK,MAAM,kBAAkB;AAC7B,YAAM,eAAe,EAAE;AAAA,IAC3B,CAAC;AAED,OAAG,uBAAuB,YAAY;AAIlC,SAAG,SAAS,UAAU;AACtB,SAAG,WAAW;AAQd,YAAM,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI,CAAC;AAE7C,YAAM,UAAU;AAEhB,YAAM,SAAS,SAAS,IAAI,WAAW;AAEvC,YAAM,eAAe,GAAG,OAAO,sBAAsB;AACrD,gBAAU;AAAA,QACN,OAAO;AAAA,UACH;AAAA,YACI,MAAM;AAAA,YACN,UAAU;AAAA,cACN,aAAa,IAAI,aAAa,QAAQ;AAAA,cACtC,aAAa,IAAI,aAAa,SAAS;AAAA,YAC3C;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ,CAAC;AAED,YAAM;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IAAI,EAAE,GAAG,GAAG;AACnB,aAAO,OAAO,EAAE,GAAG,IAAI,GAAG;AAAA,IAC9B,CAAC;AAED,OAAG,2BAA2B,YAAY;AACtC,YAAM,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI,CAAC;AAE7C,YAAM,UAAU;AAChB,YAAM,UAAU;AAEhB,YAAM,SAAS,SAAS,IAAI,WAAW;AACvC,SAAG,OAAO;AACV,YAAM;AAEN,YAAM,UAAU,GAAG,WAAW,cAAc,YAAY;AACxD,YAAM,OAAO,GAAG,WAAW,cAAc,SAAS;AAElD,aAAO,OAAO,EAAE,GAAG,IAAI,GAAG;AAC1B,aAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACvB,CAAC;AAAA,EACL,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
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';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionMenuSizesStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,0BAA0B,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-menu/sync/sp-action-menu.js";
|
|
3
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
4
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
5
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
6
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
7
|
+
import { testActionMenu } from "./";
|
|
8
|
+
testActionMenu("sync");
|
|
9
|
+
//# sourceMappingURL=action-menu-sync.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-menu-sync.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-menu/sync/sp-action-menu.js';\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';\n\nimport { testActionMenu } from './';\n\ntestActionMenu('sync');\n"],
|
|
5
|
+
"mappings": ";AAYA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,SAAS,sBAAsB;AAE/B,eAAe,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-menu.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.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ActionMenuStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,qBAAqB,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
3
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
4
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
5
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
6
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
7
|
+
import { testActionMenu } from "./";
|
|
8
|
+
testActionMenu("async");
|
|
9
|
+
//# sourceMappingURL=action-menu.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["action-menu.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-menu/sp-action-menu.js';\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';\n\nimport { testActionMenu } from './';\n\ntestActionMenu('async');\n"],
|
|
5
|
+
"mappings": ";AAYA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,SAAS,sBAAsB;AAE/B,eAAe,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
3
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
4
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
5
|
+
import { html } from "lit";
|
|
6
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
7
|
+
measureFixtureCreation(html`
|
|
8
|
+
<sp-action-menu>
|
|
9
|
+
<span slot="label">
|
|
10
|
+
Select a Country with a very long label, too long in fact
|
|
11
|
+
</span>
|
|
12
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
13
|
+
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
14
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
15
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
16
|
+
<sp-menu-divider></sp-menu-divider>
|
|
17
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
18
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
19
|
+
</sp-action-menu>
|
|
20
|
+
`);
|
|
21
|
+
//# sourceMappingURL=test-basic.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["test-basic.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 '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-action-menu>\n <span slot=\"label\">\n Select a Country with a very long label, too long in fact\n </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"],
|
|
5
|
+
"mappings": ";AAWA,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAatB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
3
|
+
import { html } from "@spectrum-web-components/base";
|
|
4
|
+
import { slottableRequest } from "@spectrum-web-components/overlay/src/slottable-request-directive.js";
|
|
5
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
6
|
+
const renderOptions = () => {
|
|
7
|
+
import("@spectrum-web-components/menu/sp-menu-item.js");
|
|
8
|
+
import("@spectrum-web-components/menu/sp-menu-divider.js");
|
|
9
|
+
return html`
|
|
10
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
11
|
+
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
12
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
13
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
14
|
+
<sp-menu-divider></sp-menu-divider>
|
|
15
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
16
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
17
|
+
`;
|
|
18
|
+
};
|
|
19
|
+
measureFixtureCreation(html`
|
|
20
|
+
<sp-action-menu ${slottableRequest(renderOptions)}>
|
|
21
|
+
<span slot="label">
|
|
22
|
+
Select a Country with a very long label, too long in fact
|
|
23
|
+
</span>
|
|
24
|
+
</sp-action-menu>
|
|
25
|
+
`);
|
|
26
|
+
//# sourceMappingURL=test-directive.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["test-directive.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 '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { slottableRequest } from '@spectrum-web-components/overlay/src/slottable-request-directive.js';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nconst renderOptions = (): TemplateResult => {\n import('@spectrum-web-components/menu/sp-menu-item.js');\n import('@spectrum-web-components/menu/sp-menu-divider.js');\n return html`\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 `;\n};\n\nmeasureFixtureCreation(html`\n <sp-action-menu ${slottableRequest(renderOptions)}>\n <span slot=\"label\">\n Select a Country with a very long label, too long in fact\n </span>\n </sp-action-menu>\n`);\n"],
|
|
5
|
+
"mappings": ";AAWA,OAAO;AACP,SAAS,YAA4B;AACrC,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AAEvC,MAAM,gBAAgB,MAAsB;AACxC,SAAO,+CAA+C;AACtD,SAAO,kDAAkD;AACzD,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASX;AAEA,uBAAuB;AAAA,sBACD,iBAAiB,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,CAKpD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
3
|
+
import { html, render } from "@spectrum-web-components/base";
|
|
4
|
+
import {
|
|
5
|
+
removeSlottableRequest
|
|
6
|
+
} from "@spectrum-web-components/overlay/src/slottable-request-event.js";
|
|
7
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
8
|
+
const handleSlottableRequest = (event) => {
|
|
9
|
+
import("@spectrum-web-components/menu/sp-menu-item.js");
|
|
10
|
+
import("@spectrum-web-components/menu/sp-menu-divider.js");
|
|
11
|
+
const label = html`
|
|
12
|
+
<span slot="label">
|
|
13
|
+
Select a Country with a very long label, too long in fact
|
|
14
|
+
</span>
|
|
15
|
+
`;
|
|
16
|
+
const template = event.data === removeSlottableRequest ? label : html`
|
|
17
|
+
${label}
|
|
18
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
19
|
+
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
20
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
21
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
22
|
+
<sp-menu-divider></sp-menu-divider>
|
|
23
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
24
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
25
|
+
`;
|
|
26
|
+
render(template, event.target);
|
|
27
|
+
};
|
|
28
|
+
measureFixtureCreation(html`
|
|
29
|
+
<sp-action-menu @slottable-request=${handleSlottableRequest}>
|
|
30
|
+
<span slot="label">
|
|
31
|
+
Select a Country with a very long label, too long in fact
|
|
32
|
+
</span>
|
|
33
|
+
</sp-action-menu>
|
|
34
|
+
`);
|
|
35
|
+
//# sourceMappingURL=test-lazy.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["test-lazy.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 '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport { html, render } from '@spectrum-web-components/base';\nimport {\n removeSlottableRequest,\n type SlottableRequestEvent,\n} from '@spectrum-web-components/overlay/src/slottable-request-event.js';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nconst handleSlottableRequest = (event: SlottableRequestEvent): void => {\n import('@spectrum-web-components/menu/sp-menu-item.js');\n import('@spectrum-web-components/menu/sp-menu-divider.js');\n const label = html`\n <span slot=\"label\">\n Select a Country with a very long label, too long in fact\n </span>\n `;\n const template =\n event.data === removeSlottableRequest\n ? label\n : html`\n ${label}\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 `;\n render(template, event.target as HTMLElement);\n};\n\nmeasureFixtureCreation(html`\n <sp-action-menu @slottable-request=${handleSlottableRequest}>\n <span slot=\"label\">\n Select a Country with a very long label, too long in fact\n </span>\n </sp-action-menu>\n`);\n"],
|
|
5
|
+
"mappings": ";AAWA,OAAO;AACP,SAAS,MAAM,cAAc;AAC7B;AAAA,EACI;AAAA,OAEG;AACP,SAAS,8BAA8B;AAEvC,MAAM,yBAAyB,CAAC,UAAuC;AACnE,SAAO,+CAA+C;AACtD,SAAO,kDAAkD;AACzD,QAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAKd,QAAM,WACF,MAAM,SAAS,yBACT,QACA;AAAA,oBACM,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASrB,SAAO,UAAU,MAAM,MAAqB;AAChD;AAEA,uBAAuB;AAAA,yCACkB,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA,CAK9D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
3
|
+
import { slottableRequest } from "@spectrum-web-components/overlay/src/slottable-request-directive.js";
|
|
4
|
+
import { html } from "lit";
|
|
5
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
6
|
+
const renderOptions = () => {
|
|
7
|
+
import("@spectrum-web-components/menu/sp-menu-item.js");
|
|
8
|
+
import("@spectrum-web-components/menu/sp-menu-divider.js");
|
|
9
|
+
return html`
|
|
10
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
11
|
+
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
12
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
13
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
14
|
+
<sp-menu-divider></sp-menu-divider>
|
|
15
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
16
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
17
|
+
`;
|
|
18
|
+
};
|
|
19
|
+
class ActionMenuWorkflow extends HTMLElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.count = 0;
|
|
23
|
+
this.readyPromise = Promise.resolve(false);
|
|
24
|
+
this.readyPromise = new Promise((res) => {
|
|
25
|
+
this.ready = res;
|
|
26
|
+
this.setup();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async setup() {
|
|
30
|
+
this.target = this.nextElementSibling;
|
|
31
|
+
const childPromises = [];
|
|
32
|
+
[...this.target.children].forEach((child) => {
|
|
33
|
+
if ("updateComplete" in child) {
|
|
34
|
+
childPromises.push(child.updateComplete);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
await Promise.all([this.target.updateComplete, ...childPromises]);
|
|
38
|
+
this.target.addEventListener("sp-opened", () => {
|
|
39
|
+
requestAnimationFrame(() => this.target.open = false);
|
|
40
|
+
});
|
|
41
|
+
this.target.addEventListener("sp-closed", () => {
|
|
42
|
+
this.count += 1;
|
|
43
|
+
if (this.count >= 5) {
|
|
44
|
+
this.ready(true);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
requestAnimationFrame(() => this.target.open = true);
|
|
48
|
+
});
|
|
49
|
+
requestAnimationFrame(() => this.target.open = true);
|
|
50
|
+
}
|
|
51
|
+
get updateComplete() {
|
|
52
|
+
return this.readyPromise;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
customElements.define("action-menu-workflow", ActionMenuWorkflow);
|
|
56
|
+
measureFixtureCreation(
|
|
57
|
+
html`
|
|
58
|
+
<action-menu-workflow></action-menu-workflow>
|
|
59
|
+
<sp-action-menu ${slottableRequest(renderOptions)}>
|
|
60
|
+
<span slot="label">
|
|
61
|
+
Select a Country with a very long label, too long in fact
|
|
62
|
+
</span>
|
|
63
|
+
</sp-action-menu>
|
|
64
|
+
`,
|
|
65
|
+
{ numRenders: 1 }
|
|
66
|
+
);
|
|
67
|
+
//# sourceMappingURL=test-open-close-directive.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["test-open-close-directive.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-menu/sp-action-menu.js';\nimport type { ActionMenu } from '@spectrum-web-components/action-menu';\nimport { slottableRequest } from '@spectrum-web-components/overlay/src/slottable-request-directive.js';\nimport { html, TemplateResult } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\nimport { SpectrumElement } from '@spectrum-web-components/base';\n\nconst renderOptions = (): TemplateResult => {\n import('@spectrum-web-components/menu/sp-menu-item.js');\n import('@spectrum-web-components/menu/sp-menu-divider.js');\n return html`\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 `;\n};\n\nclass ActionMenuWorkflow extends HTMLElement {\n ready!: (value: boolean | PromiseLike<boolean>) => void;\n target!: ActionMenu;\n count = 0;\n\n constructor() {\n super();\n this.readyPromise = new Promise((res) => {\n this.ready = res;\n this.setup();\n });\n }\n\n async setup(): Promise<void> {\n this.target = this.nextElementSibling as ActionMenu;\n const childPromises = [] as Promise<boolean>[];\n [...this.target.children].forEach((child) => {\n if ('updateComplete' in child) {\n childPromises.push((child as SpectrumElement).updateComplete);\n }\n });\n await Promise.all([this.target.updateComplete, ...childPromises]);\n this.target.addEventListener('sp-opened', () => {\n requestAnimationFrame(() => (this.target.open = false));\n });\n this.target.addEventListener('sp-closed', () => {\n this.count += 1;\n if (this.count >= 5) {\n this.ready(true);\n return;\n }\n requestAnimationFrame(() => (this.target.open = true));\n });\n requestAnimationFrame(() => (this.target.open = true));\n }\n\n private readyPromise: Promise<boolean> = Promise.resolve(false);\n\n get updateComplete(): Promise<boolean> {\n return this.readyPromise;\n }\n}\n\ncustomElements.define('action-menu-workflow', ActionMenuWorkflow);\n\nmeasureFixtureCreation(\n html`\n <action-menu-workflow></action-menu-workflow>\n <sp-action-menu ${slottableRequest(renderOptions)}>\n <span slot=\"label\">\n Select a Country with a very long label, too long in fact\n </span>\n </sp-action-menu>\n `,\n { numRenders: 1 }\n);\n"],
|
|
5
|
+
"mappings": ";AAYA,OAAO;AAEP,SAAS,wBAAwB;AACjC,SAAS,YAA4B;AACrC,SAAS,8BAA8B;AAGvC,MAAM,gBAAgB,MAAsB;AACxC,SAAO,+CAA+C;AACtD,SAAO,kDAAkD;AACzD,SAA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