@spectrum-web-components/action-menu 0.41.2 → 0.42.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/custom-elements.json +5 -0
- package/package.json +9 -9
- package/src/ActionMenu.d.ts +2 -0
- package/src/ActionMenu.dev.js +13 -0
- package/src/ActionMenu.dev.js.map +2 -2
- package/src/ActionMenu.js +3 -3
- package/src/ActionMenu.js.map +3 -3
- package/stories/action-menu.stories.js +22 -0
- package/stories/action-menu.stories.js.map +2 -2
- package/test/action-menu-directive.test.js +29 -0
- package/test/action-menu-directive.test.js.map +7 -0
- package/test/benchmark/test-basic.js +0 -1
- package/test/benchmark/test-basic.js.map +2 -2
- 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 +0 -1
- package/test/index.js.map +2 -2
package/custom-elements.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/action-menu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
"lit-html"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@spectrum-web-components/action-button": "^0.
|
|
65
|
-
"@spectrum-web-components/base": "^0.
|
|
66
|
-
"@spectrum-web-components/icon": "^0.
|
|
67
|
-
"@spectrum-web-components/icons-workflow": "^0.
|
|
68
|
-
"@spectrum-web-components/picker": "^0.
|
|
69
|
-
"@spectrum-web-components/shared": "^0.
|
|
64
|
+
"@spectrum-web-components/action-button": "^0.42.0",
|
|
65
|
+
"@spectrum-web-components/base": "^0.42.0",
|
|
66
|
+
"@spectrum-web-components/icon": "^0.42.0",
|
|
67
|
+
"@spectrum-web-components/icons-workflow": "^0.42.0",
|
|
68
|
+
"@spectrum-web-components/picker": "^0.42.0",
|
|
69
|
+
"@spectrum-web-components/shared": "^0.42.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@spectrum-css/actionmenu": "^5.1.
|
|
72
|
+
"@spectrum-css/actionmenu": "^5.1.2"
|
|
73
73
|
},
|
|
74
74
|
"types": "./src/index.d.ts",
|
|
75
75
|
"customElements": "custom-elements.json",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"./**/*.dev.js",
|
|
79
79
|
"./sync/sp-*.js"
|
|
80
80
|
],
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "9b3bd55ff8e8f9438817255976e77fd456b19d72"
|
|
82
82
|
}
|
package/src/ActionMenu.d.ts
CHANGED
|
@@ -28,8 +28,10 @@ export declare class ActionMenu extends ActionMenu_base {
|
|
|
28
28
|
protected itemRole: string;
|
|
29
29
|
private get hasLabel();
|
|
30
30
|
private get labelOnly();
|
|
31
|
+
private handleSlottableRequest;
|
|
31
32
|
protected get buttonContent(): TemplateResult[];
|
|
32
33
|
protected render(): TemplateResult;
|
|
33
34
|
protected update(changedProperties: PropertyValues<this>): void;
|
|
35
|
+
protected updated(changes: PropertyValues<this>): void;
|
|
34
36
|
}
|
|
35
37
|
export {};
|
package/src/ActionMenu.dev.js
CHANGED
|
@@ -22,6 +22,7 @@ import { ObserveSlotPresence } from "@spectrum-web-components/shared/src/observe
|
|
|
22
22
|
import { ObserveSlotText } from "@spectrum-web-components/shared/src/observe-slot-text.js";
|
|
23
23
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-more.js";
|
|
24
24
|
import actionMenuStyles from "./action-menu.css.js";
|
|
25
|
+
import { SlottableRequestEvent } from "@spectrum-web-components/overlay/src/slottable-request-event.js";
|
|
25
26
|
export class ActionMenu extends ObserveSlotPresence(
|
|
26
27
|
ObserveSlotText(PickerBase, "label"),
|
|
27
28
|
'[slot="label-only"]'
|
|
@@ -32,6 +33,9 @@ export class ActionMenu extends ObserveSlotPresence(
|
|
|
32
33
|
this.static = void 0;
|
|
33
34
|
this.listRole = "menu";
|
|
34
35
|
this.itemRole = "menuitem";
|
|
36
|
+
this.handleSlottableRequest = (event) => {
|
|
37
|
+
this.dispatchEvent(new SlottableRequestEvent(event.name, event.data));
|
|
38
|
+
};
|
|
35
39
|
}
|
|
36
40
|
static get styles() {
|
|
37
41
|
return [actionMenuStyles];
|
|
@@ -102,6 +106,15 @@ export class ActionMenu extends ObserveSlotPresence(
|
|
|
102
106
|
}
|
|
103
107
|
super.update(changedProperties);
|
|
104
108
|
}
|
|
109
|
+
updated(changes) {
|
|
110
|
+
super.updated(changes);
|
|
111
|
+
if (this.hasRenderedOverlay) {
|
|
112
|
+
this.overlayElement.addEventListener(
|
|
113
|
+
"slottable-request",
|
|
114
|
+
this.handleSlottableRequest
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
105
118
|
}
|
|
106
119
|
__decorateClass([
|
|
107
120
|
property({ type: String })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ActionMenu.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 CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { state } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { DESCRIPTION_ID, PickerBase } from '@spectrum-web-components/picker';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport actionMenuStyles from './action-menu.css.js';\n\n/**\n * @element sp-action-menu\n *\n * @slot - menu items to be listed in the Action Menu\n * @slot icon - The icon to use for Action Menu\n * @slot label - The label to use on for the Action Menu\n * @slot tooltip - Tooltip to to be applied to the the Action Button\n * @attr selects - By default `sp-action-menu` does not manage a selection. If\n * you'd like for a selection to be held by the `sp-menu` that it presents in\n * its overlay, use `selects=\"single\" to activate this functionality.\n */\nexport class ActionMenu extends ObserveSlotPresence(\n ObserveSlotText(PickerBase, 'label'),\n '[slot=\"label-only\"]'\n) {\n public static override get styles(): CSSResultArray {\n return [actionMenuStyles];\n }\n\n @property({ type: String })\n public override selects: undefined | 'single' = undefined;\n\n @property({ type: String, reflect: true })\n public static: 'white' | 'black' | undefined = undefined;\n\n protected override listRole: 'listbox' | 'menu' = 'menu';\n protected override itemRole = 'menuitem';\n private get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n @state()\n private get labelOnly(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override get buttonContent(): TemplateResult[] {\n return [\n html`\n ${this.labelOnly\n ? html``\n : html`\n <slot\n name=\"icon\"\n slot=\"icon\"\n ?icon-only=${!this.hasLabel}\n ?hidden=${this.labelOnly}\n >\n <sp-icon-more class=\"icon\"></sp-icon-more>\n </slot>\n `}\n <slot name=\"label\" ?hidden=${!this.hasLabel}></slot>\n <slot name=\"label-only\"></slot>\n <slot\n name=\"tooltip\"\n @slotchange=${this.handleTooltipSlotchange}\n ></slot>\n `,\n ];\n }\n\n protected override render(): TemplateResult {\n if (this.tooltipEl) {\n this.tooltipEl.disabled = this.open;\n }\n return html`\n <sp-action-button\n aria-describedby=${DESCRIPTION_ID}\n ?quiet=${this.quiet}\n ?selected=${this.open}\n static=${ifDefined(this.static)}\n aria-haspopup=\"true\"\n aria-controls=${ifDefined(this.open ? 'menu' : undefined)}\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-label=${ifDefined(this.label || undefined)}\n id=\"button\"\n class=\"button\"\n size=${this.size}\n @blur=${this.handleButtonBlur}\n @click=${this.handleActivate}\n @pointerdown=${this.handleButtonPointerdown}\n @focus=${this.handleButtonFocus}\n @keydown=${{\n handleEvent: this.handleEnterKeydown,\n capture: true,\n }}\n ?disabled=${this.disabled}\n >\n ${this.buttonContent}\n </sp-action-button>\n ${this.renderMenu} ${this.renderDescriptionSlot}\n `;\n }\n\n protected override update(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('invalid')) {\n this.invalid = false;\n }\n super.update(changedProperties);\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,OAGG;AACP,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,gBAAgB,kBAAkB;AAC3C,OAAO;AACP,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAChC,OAAO;AACP,OAAO,sBAAsB;
|
|
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 CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { state } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { DESCRIPTION_ID, PickerBase } from '@spectrum-web-components/picker';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport actionMenuStyles from './action-menu.css.js';\nimport { SlottableRequestEvent } from '@spectrum-web-components/overlay/src/slottable-request-event.js';\n\n/**\n * @element sp-action-menu\n *\n * @slot - menu items to be listed in the Action Menu\n * @slot icon - The icon to use for Action Menu\n * @slot label - The label to use on for the Action Menu\n * @slot tooltip - Tooltip to to be applied to the the Action Button\n * @attr selects - By default `sp-action-menu` does not manage a selection. If\n * you'd like for a selection to be held by the `sp-menu` that it presents in\n * its overlay, use `selects=\"single\" to activate this functionality.\n */\nexport class ActionMenu extends ObserveSlotPresence(\n ObserveSlotText(PickerBase, 'label'),\n '[slot=\"label-only\"]'\n) {\n public static override get styles(): CSSResultArray {\n return [actionMenuStyles];\n }\n\n @property({ type: String })\n public override selects: undefined | 'single' = undefined;\n\n @property({ type: String, reflect: true })\n public static: 'white' | 'black' | undefined = undefined;\n\n protected override listRole: 'listbox' | 'menu' = 'menu';\n protected override itemRole = 'menuitem';\n private get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n @state()\n private get labelOnly(): boolean {\n return this.slotContentIsPresent;\n }\n\n private handleSlottableRequest = (event: SlottableRequestEvent): void => {\n this.dispatchEvent(new SlottableRequestEvent(event.name, event.data));\n };\n\n protected override get buttonContent(): TemplateResult[] {\n return [\n html`\n ${this.labelOnly\n ? html``\n : html`\n <slot\n name=\"icon\"\n slot=\"icon\"\n ?icon-only=${!this.hasLabel}\n ?hidden=${this.labelOnly}\n >\n <sp-icon-more class=\"icon\"></sp-icon-more>\n </slot>\n `}\n <slot name=\"label\" ?hidden=${!this.hasLabel}></slot>\n <slot name=\"label-only\"></slot>\n <slot\n name=\"tooltip\"\n @slotchange=${this.handleTooltipSlotchange}\n ></slot>\n `,\n ];\n }\n\n protected override render(): TemplateResult {\n if (this.tooltipEl) {\n this.tooltipEl.disabled = this.open;\n }\n return html`\n <sp-action-button\n aria-describedby=${DESCRIPTION_ID}\n ?quiet=${this.quiet}\n ?selected=${this.open}\n static=${ifDefined(this.static)}\n aria-haspopup=\"true\"\n aria-controls=${ifDefined(this.open ? 'menu' : undefined)}\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-label=${ifDefined(this.label || undefined)}\n id=\"button\"\n class=\"button\"\n size=${this.size}\n @blur=${this.handleButtonBlur}\n @click=${this.handleActivate}\n @pointerdown=${this.handleButtonPointerdown}\n @focus=${this.handleButtonFocus}\n @keydown=${{\n handleEvent: this.handleEnterKeydown,\n capture: true,\n }}\n ?disabled=${this.disabled}\n >\n ${this.buttonContent}\n </sp-action-button>\n ${this.renderMenu} ${this.renderDescriptionSlot}\n `;\n }\n\n protected override update(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('invalid')) {\n this.invalid = false;\n }\n super.update(changedProperties);\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n super.updated(changes);\n if (this.hasRenderedOverlay) {\n this.overlayElement.addEventListener(\n 'slottable-request',\n this.handleSlottableRequest\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,OAGG;AACP,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,gBAAgB,kBAAkB;AAC3C,OAAO;AACP,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAChC,OAAO;AACP,OAAO,sBAAsB;AAC7B,SAAS,6BAA6B;AAa/B,aAAM,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AAA,yBAClC,KAAK,iBAAiB;AAAA,2BACpB;AAAA,MACP,aAAa,KAAK;AAAA,MAClB,SAAS;AAAA,IACb,CAAC;AAAA,4BACW,KAAK,QAAQ;AAAA;AAAA,kBAEvB,KAAK,aAAa;AAAA;AAAA,cAEtB,KAAK,UAAU,IAAI,KAAK,qBAAqB;AAAA;AAAA,EAEvD;AAAA,EAEmB,OAAO,mBAA+C;AACrE,QAAI,kBAAkB,IAAI,SAAS,GAAG;AAClC,WAAK,UAAU;AAAA,IACnB;AACA,UAAM,OAAO,iBAAiB;AAAA,EAClC;AAAA,EAEmB,QAAQ,SAAqC;AAC5D,UAAM,QAAQ,OAAO;AACrB,QAAI,KAAK,oBAAoB;AACzB,WAAK,eAAe;AAAA,QAChB;AAAA,QACA,KAAK;AAAA,MACT;AAAA,IACJ;AAAA,EACJ;AACJ;AA9FoB;AAAA,EADf,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GARjB,WASO;AAGT;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAXhC,WAYF;AASK;AAAA,EADX,MAAM;AAAA,GApBE,WAqBG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/ActionMenu.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var l=(
|
|
1
|
+
"use strict";var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var l=(r,i,e,o)=>{for(var t=o>1?void 0:o?h(i,e):i,n=r.length-1,a;n>=0;n--)(a=r[n])&&(t=(o?a(i,e,t):a(t))||t);return o&&t&&u(i,e,t),t};import{html as s}from"@spectrum-web-components/base";import{state as c}from"@spectrum-web-components/base/src/decorators.js";import{ifDefined as d}from"@spectrum-web-components/base/src/directives.js";import{property as p}from"@spectrum-web-components/base/src/decorators.js";import{DESCRIPTION_ID as b,PickerBase as m}from"@spectrum-web-components/picker";import"@spectrum-web-components/action-button/sp-action-button.js";import{ObserveSlotPresence as v}from"@spectrum-web-components/shared/src/observe-slot-presence.js";import{ObserveSlotText as f}from"@spectrum-web-components/shared/src/observe-slot-text.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-more.js";import $ from"./action-menu.css.js";import{SlottableRequestEvent as y}from"@spectrum-web-components/overlay/src/slottable-request-event.js";export class ActionMenu extends v(f(m,"label"),'[slot="label-only"]'){constructor(){super(...arguments);this.selects=void 0;this.static=void 0;this.listRole="menu";this.itemRole="menuitem";this.handleSlottableRequest=e=>{this.dispatchEvent(new y(e.name,e.data))}}static get styles(){return[$]}get hasLabel(){return this.slotHasContent}get labelOnly(){return this.slotContentIsPresent}get buttonContent(){return[s`
|
|
2
2
|
${this.labelOnly?s``:s`
|
|
3
3
|
<slot
|
|
4
4
|
name="icon"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
></slot>
|
|
18
18
|
`]}render(){return this.tooltipEl&&(this.tooltipEl.disabled=this.open),s`
|
|
19
19
|
<sp-action-button
|
|
20
|
-
aria-describedby=${
|
|
20
|
+
aria-describedby=${b}
|
|
21
21
|
?quiet=${this.quiet}
|
|
22
22
|
?selected=${this.open}
|
|
23
23
|
static=${d(this.static)}
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
${this.buttonContent}
|
|
39
39
|
</sp-action-button>
|
|
40
40
|
${this.renderMenu} ${this.renderDescriptionSlot}
|
|
41
|
-
`}update(
|
|
41
|
+
`}update(e){e.has("invalid")&&(this.invalid=!1),super.update(e)}updated(e){super.updated(e),this.hasRenderedOverlay&&this.overlayElement.addEventListener("slottable-request",this.handleSlottableRequest)}}l([p({type:String})],ActionMenu.prototype,"selects",2),l([p({type:String,reflect:!0})],ActionMenu.prototype,"static",2),l([c()],ActionMenu.prototype,"labelOnly",1);
|
|
42
42
|
//# sourceMappingURL=ActionMenu.js.map
|
package/src/ActionMenu.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ActionMenu.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 CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { state } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { DESCRIPTION_ID, PickerBase } from '@spectrum-web-components/picker';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport actionMenuStyles from './action-menu.css.js';\n\n/**\n * @element sp-action-menu\n *\n * @slot - menu items to be listed in the Action Menu\n * @slot icon - The icon to use for Action Menu\n * @slot label - The label to use on for the Action Menu\n * @slot tooltip - Tooltip to to be applied to the the Action Button\n * @attr selects - By default `sp-action-menu` does not manage a selection. If\n * you'd like for a selection to be held by the `sp-menu` that it presents in\n * its overlay, use `selects=\"single\" to activate this functionality.\n */\nexport class ActionMenu extends ObserveSlotPresence(\n ObserveSlotText(PickerBase, 'label'),\n '[slot=\"label-only\"]'\n) {\n public static override get styles(): CSSResultArray {\n return [actionMenuStyles];\n }\n\n @property({ type: String })\n public override selects: undefined | 'single' = undefined;\n\n @property({ type: String, reflect: true })\n public static: 'white' | 'black' | undefined = undefined;\n\n protected override listRole: 'listbox' | 'menu' = 'menu';\n protected override itemRole = 'menuitem';\n private get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n @state()\n private get labelOnly(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override get buttonContent(): TemplateResult[] {\n return [\n html`\n ${this.labelOnly\n ? html``\n : html`\n <slot\n name=\"icon\"\n slot=\"icon\"\n ?icon-only=${!this.hasLabel}\n ?hidden=${this.labelOnly}\n >\n <sp-icon-more class=\"icon\"></sp-icon-more>\n </slot>\n `}\n <slot name=\"label\" ?hidden=${!this.hasLabel}></slot>\n <slot name=\"label-only\"></slot>\n <slot\n name=\"tooltip\"\n @slotchange=${this.handleTooltipSlotchange}\n ></slot>\n `,\n ];\n }\n\n protected override render(): TemplateResult {\n if (this.tooltipEl) {\n this.tooltipEl.disabled = this.open;\n }\n return html`\n <sp-action-button\n aria-describedby=${DESCRIPTION_ID}\n ?quiet=${this.quiet}\n ?selected=${this.open}\n static=${ifDefined(this.static)}\n aria-haspopup=\"true\"\n aria-controls=${ifDefined(this.open ? 'menu' : undefined)}\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-label=${ifDefined(this.label || undefined)}\n id=\"button\"\n class=\"button\"\n size=${this.size}\n @blur=${this.handleButtonBlur}\n @click=${this.handleActivate}\n @pointerdown=${this.handleButtonPointerdown}\n @focus=${this.handleButtonFocus}\n @keydown=${{\n handleEvent: this.handleEnterKeydown,\n capture: true,\n }}\n ?disabled=${this.disabled}\n >\n ${this.buttonContent}\n </sp-action-button>\n ${this.renderMenu} ${this.renderDescriptionSlot}\n `;\n }\n\n protected override update(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('invalid')) {\n this.invalid = false;\n }\n super.update(changedProperties);\n }\n}\n"],
|
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,MAGG,gCACP,OAAS,SAAAC,MAAa,kDACtB,OAAS,aAAAC,MAAiB,kDAC1B,OAAS,YAAAC,MAAgB,kDACzB,OAAS,kBAAAC,EAAgB,cAAAC,MAAkB,kCAC3C,MAAO,6DACP,OAAS,uBAAAC,MAA2B,+DACpC,OAAS,mBAAAC,MAAuB,2DAChC,MAAO,gEACP,OAAOC,MAAsB,
|
|
6
|
-
"names": ["html", "state", "ifDefined", "property", "DESCRIPTION_ID", "PickerBase", "ObserveSlotPresence", "ObserveSlotText", "actionMenuStyles", "changedProperties", "__decorateClass"]
|
|
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 CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { state } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { DESCRIPTION_ID, PickerBase } from '@spectrum-web-components/picker';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport actionMenuStyles from './action-menu.css.js';\nimport { SlottableRequestEvent } from '@spectrum-web-components/overlay/src/slottable-request-event.js';\n\n/**\n * @element sp-action-menu\n *\n * @slot - menu items to be listed in the Action Menu\n * @slot icon - The icon to use for Action Menu\n * @slot label - The label to use on for the Action Menu\n * @slot tooltip - Tooltip to to be applied to the the Action Button\n * @attr selects - By default `sp-action-menu` does not manage a selection. If\n * you'd like for a selection to be held by the `sp-menu` that it presents in\n * its overlay, use `selects=\"single\" to activate this functionality.\n */\nexport class ActionMenu extends ObserveSlotPresence(\n ObserveSlotText(PickerBase, 'label'),\n '[slot=\"label-only\"]'\n) {\n public static override get styles(): CSSResultArray {\n return [actionMenuStyles];\n }\n\n @property({ type: String })\n public override selects: undefined | 'single' = undefined;\n\n @property({ type: String, reflect: true })\n public static: 'white' | 'black' | undefined = undefined;\n\n protected override listRole: 'listbox' | 'menu' = 'menu';\n protected override itemRole = 'menuitem';\n private get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n @state()\n private get labelOnly(): boolean {\n return this.slotContentIsPresent;\n }\n\n private handleSlottableRequest = (event: SlottableRequestEvent): void => {\n this.dispatchEvent(new SlottableRequestEvent(event.name, event.data));\n };\n\n protected override get buttonContent(): TemplateResult[] {\n return [\n html`\n ${this.labelOnly\n ? html``\n : html`\n <slot\n name=\"icon\"\n slot=\"icon\"\n ?icon-only=${!this.hasLabel}\n ?hidden=${this.labelOnly}\n >\n <sp-icon-more class=\"icon\"></sp-icon-more>\n </slot>\n `}\n <slot name=\"label\" ?hidden=${!this.hasLabel}></slot>\n <slot name=\"label-only\"></slot>\n <slot\n name=\"tooltip\"\n @slotchange=${this.handleTooltipSlotchange}\n ></slot>\n `,\n ];\n }\n\n protected override render(): TemplateResult {\n if (this.tooltipEl) {\n this.tooltipEl.disabled = this.open;\n }\n return html`\n <sp-action-button\n aria-describedby=${DESCRIPTION_ID}\n ?quiet=${this.quiet}\n ?selected=${this.open}\n static=${ifDefined(this.static)}\n aria-haspopup=\"true\"\n aria-controls=${ifDefined(this.open ? 'menu' : undefined)}\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-label=${ifDefined(this.label || undefined)}\n id=\"button\"\n class=\"button\"\n size=${this.size}\n @blur=${this.handleButtonBlur}\n @click=${this.handleActivate}\n @pointerdown=${this.handleButtonPointerdown}\n @focus=${this.handleButtonFocus}\n @keydown=${{\n handleEvent: this.handleEnterKeydown,\n capture: true,\n }}\n ?disabled=${this.disabled}\n >\n ${this.buttonContent}\n </sp-action-button>\n ${this.renderMenu} ${this.renderDescriptionSlot}\n `;\n }\n\n protected override update(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('invalid')) {\n this.invalid = false;\n }\n super.update(changedProperties);\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n super.updated(changes);\n if (this.hasRenderedOverlay) {\n this.overlayElement.addEventListener(\n 'slottable-request',\n this.handleSlottableRequest\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,MAGG,gCACP,OAAS,SAAAC,MAAa,kDACtB,OAAS,aAAAC,MAAiB,kDAC1B,OAAS,YAAAC,MAAgB,kDACzB,OAAS,kBAAAC,EAAgB,cAAAC,MAAkB,kCAC3C,MAAO,6DACP,OAAS,uBAAAC,MAA2B,+DACpC,OAAS,mBAAAC,MAAuB,2DAChC,MAAO,gEACP,OAAOC,MAAsB,uBAC7B,OAAS,yBAAAC,MAA6B,kEAa/B,aAAM,mBAAmBH,EAC5BC,EAAgBF,EAAY,OAAO,EACnC,qBACJ,CAAE,CAHK,kCASH,KAAgB,QAAgC,OAGhD,KAAO,OAAwC,OAE/C,KAAmB,SAA+B,OAClD,KAAmB,SAAW,WAU9B,KAAQ,uBAA0BK,GAAuC,CACrE,KAAK,cAAc,IAAID,EAAsBC,EAAM,KAAMA,EAAM,IAAI,CAAC,CACxE,EAvBA,WAA2B,QAAyB,CAChD,MAAO,CAACF,CAAgB,CAC5B,CAUA,IAAY,UAAoB,CAC5B,OAAO,KAAK,cAChB,CAGA,IAAY,WAAqB,CAC7B,OAAO,KAAK,oBAChB,CAMA,IAAuB,eAAkC,CACrD,MAAO,CACHR;AAAA,kBACM,KAAK,UACDA,IACAA;AAAA;AAAA;AAAA;AAAA,2CAIqB,CAAC,KAAK,QAAQ;AAAA,wCACjB,KAAK,SAAS;AAAA;AAAA;AAAA;AAAA,uBAI/B;AAAA,6CACsB,CAAC,KAAK,QAAQ;AAAA;AAAA;AAAA;AAAA,kCAIzB,KAAK,uBAAuB;AAAA;AAAA,aAGtD,CACJ,CAEmB,QAAyB,CACxC,OAAI,KAAK,YACL,KAAK,UAAU,SAAW,KAAK,MAE5BA;AAAA;AAAA,mCAEoBI,CAAc;AAAA,yBACxB,KAAK,KAAK;AAAA,4BACP,KAAK,IAAI;AAAA,yBACZF,EAAU,KAAK,MAAM,CAAC;AAAA;AAAA,gCAEfA,EAAU,KAAK,KAAO,OAAS,MAAS,CAAC;AAAA,gCACzC,KAAK,KAAO,OAAS,OAAO;AAAA,6BAC/BA,EAAU,KAAK,OAAS,MAAS,CAAC;AAAA;AAAA;AAAA,uBAGxC,KAAK,IAAI;AAAA,wBACR,KAAK,gBAAgB;AAAA,yBACpB,KAAK,cAAc;AAAA,+BACb,KAAK,uBAAuB;AAAA,yBAClC,KAAK,iBAAiB;AAAA,2BACpB,CACP,YAAa,KAAK,mBAClB,QAAS,EACb,CAAC;AAAA,4BACW,KAAK,QAAQ;AAAA;AAAA,kBAEvB,KAAK,aAAa;AAAA;AAAA,cAEtB,KAAK,UAAU,IAAI,KAAK,qBAAqB;AAAA,SAEvD,CAEmB,OAAOS,EAA+C,CACjEA,EAAkB,IAAI,SAAS,IAC/B,KAAK,QAAU,IAEnB,MAAM,OAAOA,CAAiB,CAClC,CAEmB,QAAQC,EAAqC,CAC5D,MAAM,QAAQA,CAAO,EACjB,KAAK,oBACL,KAAK,eAAe,iBAChB,oBACA,KAAK,sBACT,CAER,CACJ,CA9FoBC,EAAA,CADfV,EAAS,CAAE,KAAM,MAAO,CAAC,GARjB,WASO,uBAGTU,EAAA,CADNV,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAXhC,WAYF,sBASKU,EAAA,CADXZ,EAAM,GApBE,WAqBG",
|
|
6
|
+
"names": ["html", "state", "ifDefined", "property", "DESCRIPTION_ID", "PickerBase", "ObserveSlotPresence", "ObserveSlotText", "actionMenuStyles", "SlottableRequestEvent", "event", "changedProperties", "changes", "__decorateClass"]
|
|
7
7
|
}
|
|
@@ -7,6 +7,7 @@ import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
|
7
7
|
import "@spectrum-web-components/menu/sp-menu-group.js";
|
|
8
8
|
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
9
9
|
import "@spectrum-web-components/tooltip/sp-tooltip.js";
|
|
10
|
+
import { slottableRequest } from "@spectrum-web-components/overlay/src/slottable-request-directive.js";
|
|
10
11
|
import { ActionMenuMarkup } from "./";
|
|
11
12
|
import { makeOverBackground } from "../../button/stories/index.js";
|
|
12
13
|
import { isOverlayOpen } from "../../overlay/stories/index.js";
|
|
@@ -345,4 +346,25 @@ export const groups = ({
|
|
|
345
346
|
</sp-action-menu>
|
|
346
347
|
`;
|
|
347
348
|
groups.decorators = [isOverlayOpen];
|
|
349
|
+
export const directive = () => {
|
|
350
|
+
const renderOptions = () => html`
|
|
351
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
352
|
+
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
353
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
354
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
355
|
+
<sp-menu-divider></sp-menu-divider>
|
|
356
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
357
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
358
|
+
`;
|
|
359
|
+
return html`
|
|
360
|
+
<sp-action-menu ${slottableRequest(renderOptions)}>
|
|
361
|
+
<span slot="label">
|
|
362
|
+
Select a Country with a very long label, too long in fact
|
|
363
|
+
</span>
|
|
364
|
+
</sp-action-menu>
|
|
365
|
+
`;
|
|
366
|
+
};
|
|
367
|
+
directive.swc_vrt = {
|
|
368
|
+
skip: true
|
|
369
|
+
};
|
|
348
370
|
//# sourceMappingURL=action-menu.stories.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/action-menu/sp-action-menu.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-group.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport { ActionMenuMarkup } from './';\nimport { makeOverBackground } from '../../button/stories/index.js';\nimport { isOverlayOpen } from '../../overlay/stories/index.js';\nimport '../../overlay/stories/index.js';\n\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\nimport type { MenuItem } from '@spectrum-web-components/menu/src/MenuItem.js';\nimport { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';\nimport { Menu } from '@spectrum-web-components/menu';\nimport { ActionMenu } from '../src/ActionMenu';\n\nexport default {\n component: 'sp-action-menu',\n title: 'Action menu',\n argTypes: {\n onChange: { action: 'change' },\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 tooltipDescription: {\n name: 'Tooltip Description',\n type: { name: 'string', required: false },\n description: 'Tooltip description',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: {\n type: 'text',\n },\n },\n tooltipPlacement: {\n name: 'Tooltip Placement',\n type: { name: 'string', required: false },\n description: 'Tooltip Placement.',\n table: {\n defaultValue: { summary: 'bottom' },\n },\n control: {\n options: [\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'bottom',\n 'right',\n 'left',\n 'top-start',\n 'top-end',\n 'bottom-start',\n 'bottom-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n 'none',\n ],\n type: 'select',\n },\n },\n quiet: {\n name: 'quiet',\n type: { name: 'boolean', required: false },\n description: 'Quiet rendering',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n staticValue: {\n name: 'static',\n type: { name: 'string', required: false },\n description: 'The visual static variant to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'none' },\n },\n control: {\n type: 'select',\n labels: {\n white: 'white',\n black: 'black',\n none: undefined,\n },\n options: ['white', 'black', 'none'],\n },\n },\n align: {\n name: 'align',\n type: { name: 'string', required: false },\n description: 'Alignment of the Action Menu',\n table: {\n defaultValue: { summary: 'start' },\n },\n control: {\n type: 'select',\n labels: {\n start: 'start',\n end: 'end',\n },\n },\n options: ['start', 'end'],\n },\n },\n args: {\n align: 'start',\n visibleLabel: 'More Actions',\n disabled: false,\n open: false,\n quiet: false,\n tooltipDescription: '',\n tooltipPlacement: 'bottom',\n static: undefined,\n },\n};\n\ninterface StoryArgs {\n align?: 'start' | 'end';\n visibleLabel?: string;\n disabled?: boolean;\n open?: boolean;\n customIcon?: string | TemplateResult;\n selects?: 'single';\n selected?: boolean;\n quiet?: boolean;\n staticValue?: 'white' | 'black' | undefined;\n tooltipDescription?: string | 'none';\n tooltipPlacement?: Placement;\n}\n\nconst Template = (args: StoryArgs = {}): TemplateResult =>\n ActionMenuMarkup(args);\n\nexport const Default = (args: StoryArgs = {}): TemplateResult => Template(args);\n\nexport const staticWhite = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\nstaticWhite.args = {\n staticValue: 'white',\n};\nstaticWhite.decorators = [makeOverBackground()];\nexport const staticBlack = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\nstaticBlack.args = {\n staticValue: 'black',\n};\nstaticBlack.decorators = [makeOverBackground()];\nexport const quiet = (args: StoryArgs = {}): TemplateResult => Template(args);\nquiet.args = {\n quiet: true,\n};\n\nexport const labelOnly = ({\n align = 'start',\n changeHandler = (() => undefined) as (event: Event) => void,\n disabled = false,\n open = false,\n size = 'm' as 'm' | 's' | 'l' | 'xl' | 'xxl',\n selects = '' as 'single',\n selected = false,\n} = {}): TemplateResult => html`\n <sp-action-menu\n ?disabled=${disabled}\n ?open=${open}\n size=${size}\n @change=${(event: Event & { target: Menu }): void => {\n navigator.clipboard.writeText(event.target.value);\n changeHandler(event);\n }}\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n style=${ifDefined(align === 'end' ? 'float: inline-end;' : undefined)}\n >\n <span slot=\"label-only\">Label Only</span>\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\nexport const selects = (args: StoryArgs = {}): TemplateResult =>\n Template({\n ...args,\n selects: 'single',\n selected: true,\n });\nselects.args = {\n open: true,\n};\nselects.decorators = [isOverlayOpen];\n\nexport const iconOnly = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\niconOnly.args = {\n visibleLabel: '',\n};\n\nexport const tooltipDescriptionAndPlacement = (\n args: StoryArgs = {}\n): TemplateResult => Template(args);\ntooltipDescriptionAndPlacement.args = {\n tooltipDescription: 'Your tooltip string here',\n visibleLabel: '',\n tooltipPlacement: 'bottom',\n} as StoryArgs;\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\nexport const submenu = ({ align = 'start' } = {}): TemplateResult => {\n return html`\n <sp-action-menu\n label=\"More Actions\"\n style=${ifDefined(\n align === 'end' ? 'float: inline-end;' : undefined\n )}\n >\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item>Two</sp-menu-item>\n <sp-menu-item>\n Select some items\n <sp-menu slot=\"submenu\" selects=\"multiple\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected>B</sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `;\n};\n\nexport const controlled = ({ align = 'start' } = {}): TemplateResult => {\n const state = {\n snap: true,\n grid: false,\n guides: true,\n latestChange: '',\n };\n function toggle(prop: 'snap' | 'grid' | 'guides') {\n return (event: Event): void => {\n const item = event.target as MenuItem;\n state[prop] = !state[prop];\n // in Lit-based usage, this would be handled via render():\n // <sp-menu-item ?selected=${this.isSomethingSelected}>\n item.selected = state[prop];\n };\n }\n function onChange(event: Event): void {\n state.latestChange = (event.target as MenuItem).value;\n logState();\n }\n function logState(): void {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById(\n 'state-json'\n )!.textContent = `application state: ${JSON.stringify(state)}`;\n }\n return html`\n <sp-action-menu\n label=\"View\"\n @change=${onChange}\n style=${ifDefined(\n align === 'end' ? 'float: inline-end;' : undefined\n )}\n >\n <sp-menu-item value=\"action\" @click=${() => alert('action')}>\n Non-selectable action\n </sp-menu-item>\n <sp-menu-item\n value=\"snap\"\n ?selected=${state.snap}\n @click=${toggle('snap')}\n >\n Snap\n </sp-menu-item>\n <sp-menu-item>\n Show\n <sp-menu\n slot=\"submenu\"\n selects=\"multiple\"\n @change=${(event: Event) => event.preventDefault()}\n >\n <sp-menu-item\n value=\"grid\"\n ?selected=${state.grid}\n @click=${toggle('grid')}\n >\n Grid\n </sp-menu-item>\n <sp-menu-item\n value=\"guides\"\n ?selected=${state.guides}\n @click=${toggle('guides')}\n >\n Guides\n </sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n <span id=\"state-json\"></span>\n `;\n};\n\nexport const groups = ({\n align = 'start',\n onChange,\n}: {\n align: 'start' | 'end';\n onChange(value: string): void;\n}): TemplateResult => html`\n <sp-action-menu\n @change=${({ target: { value } }: Event & { target: ActionMenu }) =>\n onChange(value)}\n open\n style=${ifDefined(align === 'end' ? 'float: inline-end;' : undefined)}\n >\n <sp-menu-group id=\"cms\">\n <span slot=\"header\">cms</span>\n <sp-menu-item value=\"updateAllSiteContent\">\n Update All Content\n </sp-menu-item>\n <sp-menu-item value=\"refreshAllXDs\">Refresh All XDs</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"ssg\">\n <span slot=\"header\">ssg</span>\n <sp-menu-item value=\"clearCache\">Clear Cache</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"vrt\">\n <span slot=\"header\">vrt</span>\n <sp-menu-item value=\"vrt-contributions\">Contributions</sp-menu-item>\n <sp-menu-item value=\"vrt-internal\">Internal</sp-menu-item>\n <sp-menu-item value=\"vrt-public\">Public</sp-menu-item>\n <sp-menu-item value=\"vrt-patterns\">Patterns</sp-menu-item>\n <sp-menu-item value=\"vrt\">All</sp-menu-item>\n </sp-menu-group>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-group id=\"misc\">\n <sp-menu-item value=\"logout\">Logout</sp-menu-item>\n </sp-menu-group>\n </sp-action-menu>\n`;\n\ngroups.decorators = [isO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"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/action-menu/sp-action-menu.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-group.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport { slottableRequest } from '@spectrum-web-components/overlay/src/slottable-request-directive.js';\nimport { ActionMenuMarkup } from './';\nimport { makeOverBackground } from '../../button/stories/index.js';\nimport { isOverlayOpen } from '../../overlay/stories/index.js';\nimport '../../overlay/stories/index.js';\n\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\nimport type { MenuItem } from '@spectrum-web-components/menu/src/MenuItem.js';\nimport { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';\nimport { Menu } from '@spectrum-web-components/menu';\nimport { ActionMenu } from '../src/ActionMenu';\n\nexport default {\n component: 'sp-action-menu',\n title: 'Action menu',\n argTypes: {\n onChange: { action: 'change' },\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 tooltipDescription: {\n name: 'Tooltip Description',\n type: { name: 'string', required: false },\n description: 'Tooltip description',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: {\n type: 'text',\n },\n },\n tooltipPlacement: {\n name: 'Tooltip Placement',\n type: { name: 'string', required: false },\n description: 'Tooltip Placement.',\n table: {\n defaultValue: { summary: 'bottom' },\n },\n control: {\n options: [\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'bottom',\n 'right',\n 'left',\n 'top-start',\n 'top-end',\n 'bottom-start',\n 'bottom-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n 'none',\n ],\n type: 'select',\n },\n },\n quiet: {\n name: 'quiet',\n type: { name: 'boolean', required: false },\n description: 'Quiet rendering',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n staticValue: {\n name: 'static',\n type: { name: 'string', required: false },\n description: 'The visual static variant to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'none' },\n },\n control: {\n type: 'select',\n labels: {\n white: 'white',\n black: 'black',\n none: undefined,\n },\n options: ['white', 'black', 'none'],\n },\n },\n align: {\n name: 'align',\n type: { name: 'string', required: false },\n description: 'Alignment of the Action Menu',\n table: {\n defaultValue: { summary: 'start' },\n },\n control: {\n type: 'select',\n labels: {\n start: 'start',\n end: 'end',\n },\n },\n options: ['start', 'end'],\n },\n },\n args: {\n align: 'start',\n visibleLabel: 'More Actions',\n disabled: false,\n open: false,\n quiet: false,\n tooltipDescription: '',\n tooltipPlacement: 'bottom',\n static: undefined,\n },\n};\n\ninterface StoryArgs {\n align?: 'start' | 'end';\n visibleLabel?: string;\n disabled?: boolean;\n open?: boolean;\n customIcon?: string | TemplateResult;\n selects?: 'single';\n selected?: boolean;\n quiet?: boolean;\n staticValue?: 'white' | 'black' | undefined;\n tooltipDescription?: string | 'none';\n tooltipPlacement?: Placement;\n}\n\nconst Template = (args: StoryArgs = {}): TemplateResult =>\n ActionMenuMarkup(args);\n\nexport const Default = (args: StoryArgs = {}): TemplateResult => Template(args);\n\nexport const staticWhite = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\nstaticWhite.args = {\n staticValue: 'white',\n};\nstaticWhite.decorators = [makeOverBackground()];\nexport const staticBlack = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\nstaticBlack.args = {\n staticValue: 'black',\n};\nstaticBlack.decorators = [makeOverBackground()];\nexport const quiet = (args: StoryArgs = {}): TemplateResult => Template(args);\nquiet.args = {\n quiet: true,\n};\n\nexport const labelOnly = ({\n align = 'start',\n changeHandler = (() => undefined) as (event: Event) => void,\n disabled = false,\n open = false,\n size = 'm' as 'm' | 's' | 'l' | 'xl' | 'xxl',\n selects = '' as 'single',\n selected = false,\n} = {}): TemplateResult => html`\n <sp-action-menu\n ?disabled=${disabled}\n ?open=${open}\n size=${size}\n @change=${(event: Event & { target: Menu }): void => {\n navigator.clipboard.writeText(event.target.value);\n changeHandler(event);\n }}\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n style=${ifDefined(align === 'end' ? 'float: inline-end;' : undefined)}\n >\n <span slot=\"label-only\">Label Only</span>\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\nexport const selects = (args: StoryArgs = {}): TemplateResult =>\n Template({\n ...args,\n selects: 'single',\n selected: true,\n });\nselects.args = {\n open: true,\n};\nselects.decorators = [isOverlayOpen];\n\nexport const iconOnly = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\niconOnly.args = {\n visibleLabel: '',\n};\n\nexport const tooltipDescriptionAndPlacement = (\n args: StoryArgs = {}\n): TemplateResult => Template(args);\ntooltipDescriptionAndPlacement.args = {\n tooltipDescription: 'Your tooltip string here',\n visibleLabel: '',\n tooltipPlacement: 'bottom',\n} as StoryArgs;\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\nexport const submenu = ({ align = 'start' } = {}): TemplateResult => {\n return html`\n <sp-action-menu\n label=\"More Actions\"\n style=${ifDefined(\n align === 'end' ? 'float: inline-end;' : undefined\n )}\n >\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item>Two</sp-menu-item>\n <sp-menu-item>\n Select some items\n <sp-menu slot=\"submenu\" selects=\"multiple\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected>B</sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `;\n};\n\nexport const controlled = ({ align = 'start' } = {}): TemplateResult => {\n const state = {\n snap: true,\n grid: false,\n guides: true,\n latestChange: '',\n };\n function toggle(prop: 'snap' | 'grid' | 'guides') {\n return (event: Event): void => {\n const item = event.target as MenuItem;\n state[prop] = !state[prop];\n // in Lit-based usage, this would be handled via render():\n // <sp-menu-item ?selected=${this.isSomethingSelected}>\n item.selected = state[prop];\n };\n }\n function onChange(event: Event): void {\n state.latestChange = (event.target as MenuItem).value;\n logState();\n }\n function logState(): void {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById(\n 'state-json'\n )!.textContent = `application state: ${JSON.stringify(state)}`;\n }\n return html`\n <sp-action-menu\n label=\"View\"\n @change=${onChange}\n style=${ifDefined(\n align === 'end' ? 'float: inline-end;' : undefined\n )}\n >\n <sp-menu-item value=\"action\" @click=${() => alert('action')}>\n Non-selectable action\n </sp-menu-item>\n <sp-menu-item\n value=\"snap\"\n ?selected=${state.snap}\n @click=${toggle('snap')}\n >\n Snap\n </sp-menu-item>\n <sp-menu-item>\n Show\n <sp-menu\n slot=\"submenu\"\n selects=\"multiple\"\n @change=${(event: Event) => event.preventDefault()}\n >\n <sp-menu-item\n value=\"grid\"\n ?selected=${state.grid}\n @click=${toggle('grid')}\n >\n Grid\n </sp-menu-item>\n <sp-menu-item\n value=\"guides\"\n ?selected=${state.guides}\n @click=${toggle('guides')}\n >\n Guides\n </sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n <span id=\"state-json\"></span>\n `;\n};\n\nexport const groups = ({\n align = 'start',\n onChange,\n}: {\n align: 'start' | 'end';\n onChange(value: string): void;\n}): TemplateResult => html`\n <sp-action-menu\n @change=${({ target: { value } }: Event & { target: ActionMenu }) =>\n onChange(value)}\n open\n style=${ifDefined(align === 'end' ? 'float: inline-end;' : undefined)}\n >\n <sp-menu-group id=\"cms\">\n <span slot=\"header\">cms</span>\n <sp-menu-item value=\"updateAllSiteContent\">\n Update All Content\n </sp-menu-item>\n <sp-menu-item value=\"refreshAllXDs\">Refresh All XDs</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"ssg\">\n <span slot=\"header\">ssg</span>\n <sp-menu-item value=\"clearCache\">Clear Cache</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"vrt\">\n <span slot=\"header\">vrt</span>\n <sp-menu-item value=\"vrt-contributions\">Contributions</sp-menu-item>\n <sp-menu-item value=\"vrt-internal\">Internal</sp-menu-item>\n <sp-menu-item value=\"vrt-public\">Public</sp-menu-item>\n <sp-menu-item value=\"vrt-patterns\">Patterns</sp-menu-item>\n <sp-menu-item value=\"vrt\">All</sp-menu-item>\n </sp-menu-group>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-group id=\"misc\">\n <sp-menu-item value=\"logout\">Logout</sp-menu-item>\n </sp-menu-group>\n </sp-action-menu>\n`;\n\ngroups.decorators = [isOverlayOpen];\n\nexport const directive = (): TemplateResult => {\n const renderOptions = (): TemplateResult => 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 return 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};\n\ndirective.swc_vrt = {\n skip: true,\n};\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAA4B;AACrC,SAAS,iBAAiB;AAE1B,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,OAAO;AAEP,OAAO;AAMP,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,IACN,UAAU,EAAE,QAAQ,SAAS;AAAA,IAC7B,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,M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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASjD;AAEO,aAAM,SAAS,CAAC;AAAA,EACnB,QAAQ;AAAA,EACR;AACJ,MAGsB;AAAA;AAAA,kBAEJ,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAC3B,SAAS,KAAK,CAAC;AAAA;AAAA,gBAEX,UAAU,UAAU,QAAQ,uBAAuB,MAAS,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4B7E,OAAO,aAAa,CAAC,aAAa;AAE3B,aAAM,YAAY,MAAsB;AAC3C,QAAM,gBAAgB,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS5C,SAAO;AAAA,0BACe,iBAAiB,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAMzD;AAEA,UAAU,UAAU;AAAA,EAChB,MAAM;AACV;",
|
|
6
6
|
"names": ["selects"]
|
|
7
7
|
}
|
|
@@ -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
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
3
|
-
import "@spectrum-web-components/menu/sp-menu.js";
|
|
4
3
|
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
5
4
|
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
6
5
|
import { html } from "lit";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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
|
|
5
|
-
"mappings": ";AAWA,OAAO;AACP,OAAO;AACP,OAAO;AACP,
|
|
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
6
|
"names": []
|
|
7
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,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASX;AAEA,MAAM,2BAA2B,YAAY;AAAA,EAKzC,cAAc;AACV,UAAM;AAHV,iBAAQ;AAiCR,SAAQ,eAAiC,QAAQ,QAAQ,KAAK;AA7B1D,SAAK,eAAe,IAAI,QAAQ,CAAC,QAAQ;AACrC,WAAK,QAAQ;AACb,WAAK,MAAM;AAAA,IACf,CAAC;AAAA,EACL;AAAA,EAEA,MAAM,QAAuB;AACzB,SAAK,SAAS,KAAK;AACnB,UAAM,gBAAgB,CAAC;AACvB,KAAC,GAAG,KAAK,OAAO,QAAQ,EAAE,QAAQ,CAAC,UAAU;AACzC,UAAI,oBAAoB,OAAO;AAC3B,sBAAc,KAAM,MAA0B,cAAc;AAAA,MAChE;AAAA,IACJ,CAAC;AACD,UAAM,QAAQ,IAAI,CAAC,KAAK,OAAO,gBAAgB,GAAG,aAAa,CAAC;AAChE,SAAK,OAAO,iBAAiB,aAAa,MAAM;AAC5C,4BAAsB,MAAO,KAAK,OAAO,OAAO,KAAM;AAAA,IAC1D,CAAC;AACD,SAAK,OAAO,iBAAiB,aAAa,MAAM;AAC5C,WAAK,SAAS;AACd,UAAI,KAAK,SAAS,GAAG;AACjB,aAAK,MAAM,IAAI;AACf;AAAA,MACJ;AACA,4BAAsB,MAAO,KAAK,OAAO,OAAO,IAAK;AAAA,IACzD,CAAC;AACD,0BAAsB,MAAO,KAAK,OAAO,OAAO,IAAK;AAAA,EACzD;AAAA,EAIA,IAAI,iBAAmC;AACnC,WAAO,KAAK;AAAA,EAChB;AACJ;AAEA,eAAe,OAAO,wBAAwB,kBAAkB;AAEhE;AAAA,EACI;AAAA;AAAA,0BAEsB,iBAAiB,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMrD,EAAE,YAAY,EAAE;AACpB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
class ActionMenuWorkflow extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.count = 0;
|
|
11
|
+
this.readyPromise = Promise.resolve(false);
|
|
12
|
+
this.readyPromise = new Promise((res) => {
|
|
13
|
+
this.ready = res;
|
|
14
|
+
this.setup();
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async setup() {
|
|
18
|
+
this.target = this.nextElementSibling;
|
|
19
|
+
const childPromises = [];
|
|
20
|
+
[...this.target.children].forEach((child) => {
|
|
21
|
+
if ("updateComplete" in child) {
|
|
22
|
+
childPromises.push(child.updateComplete);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
await Promise.all([this.target.updateComplete, ...childPromises]);
|
|
26
|
+
this.target.addEventListener("sp-opened", () => {
|
|
27
|
+
requestAnimationFrame(() => this.target.open = false);
|
|
28
|
+
});
|
|
29
|
+
this.target.addEventListener("sp-closed", () => {
|
|
30
|
+
this.count += 1;
|
|
31
|
+
if (this.count >= 5) {
|
|
32
|
+
this.ready(true);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
requestAnimationFrame(() => this.target.open = true);
|
|
36
|
+
});
|
|
37
|
+
requestAnimationFrame(() => this.target.open = true);
|
|
38
|
+
}
|
|
39
|
+
get updateComplete() {
|
|
40
|
+
return this.readyPromise;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
customElements.define("action-menu-workflow", ActionMenuWorkflow);
|
|
44
|
+
measureFixtureCreation(
|
|
45
|
+
html`
|
|
46
|
+
<action-menu-workflow></action-menu-workflow>
|
|
47
|
+
<sp-action-menu>
|
|
48
|
+
<span slot="label">
|
|
49
|
+
Select a Country with a very long label, too long in fact
|
|
50
|
+
</span>
|
|
51
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
52
|
+
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
53
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
54
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
55
|
+
<sp-menu-divider></sp-menu-divider>
|
|
56
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
57
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
58
|
+
</sp-action-menu>
|
|
59
|
+
`,
|
|
60
|
+
{ numRenders: 1 }
|
|
61
|
+
);
|
|
62
|
+
//# sourceMappingURL=test-open-close.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["test-open-close.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 '@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';\nimport { SpectrumElement } from '@spectrum-web-components/base';\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>\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>\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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,EAAE,YAAY,EAAE;AACpB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/test/index.js
CHANGED
|
@@ -534,7 +534,6 @@ export const testActionMenu = (mode) => {
|
|
|
534
534
|
expect(openSpy.callCount).to.equal(1);
|
|
535
535
|
});
|
|
536
536
|
it("opens, then closes, on subsequent clicks", async function() {
|
|
537
|
-
this.retries(0);
|
|
538
537
|
const el = await actionMenuFixture();
|
|
539
538
|
const rect = el.getBoundingClientRect();
|
|
540
539
|
await nextFrame();
|
package/test/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n aTimeout,\n elementUpdated,\n expect,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers';\n\nimport { spy } from 'sinon';\n\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport type { Menu, MenuItem } from '@spectrum-web-components/menu';\nimport {\n fixture,\n ignoreResizeObserverLoopError,\n} from '../../../test/testing-helpers.js';\nimport '@spectrum-web-components/dialog/sp-dialog-base.js';\nimport {\n iconOnly,\n tooltipDescriptionAndPlacement,\n} from '../stories/action-menu.stories.js';\nimport { findDescribedNode } from '../../../test/testing-helpers-a11y.js';\nimport type { Tooltip } from '@spectrum-web-components/tooltip';\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport type { TestablePicker } from '../../picker/test/index.js';\nimport type { Overlay } from '@spectrum-web-components/overlay';\nimport { sendKeys } from '@web/test-runner-commands';\n\nignoreResizeObserverLoopError(before, after);\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\nconst actionSubmenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected id=\"root-selected-item\">\n Two\n </sp-menu-item>\n <sp-menu-item id=\"item-with-submenu\">\n B should be selected\n <sp-menu slot=\"submenu\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected id=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `\n );\n\nexport const testActionMenu = (mode: 'sync' | 'async'): void => {\n describe(`Action menu: ${mode}`, () => {\n testForLitDevWarnings(async () => await actionMenuFixture());\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 await nextFrame();\n await nextFrame();\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 await nextFrame();\n await nextFrame();\n\n await expect(el).to.be.accessible();\n });\n it('dispatches change events, no [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${({\n target: { value },\n }: Event & { target: ActionMenu }) => {\n changeSpy(value);\n }}\n >\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 expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await elementUpdated(el);\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(1);\n expect(changeSpy.calledWith('Deselect')).to.be.true;\n });\n it('closes when Menu Item has [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${() => {\n changeSpy();\n }}\n >\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item href=\"#\">Deselect</sp-menu-item>\n <sp-menu-item href=\"#\">Select Inverse</sp-menu-item>\n <sp-menu-item href=\"#\">Feather...</sp-menu-item>\n <sp-menu-item href=\"#\">Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item href=\"#\">Save Selection</sp-menu-item>\n <sp-menu-item href=\"#\" disabled>\n Make Work Path\n </sp-menu-item>\n </sp-action-menu>\n `\n );\n\n expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(0);\n });\n it('can be `quiet`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.quiet).to.be.false;\n\n el.quiet = true;\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n });\n it('can be `static`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.static == undefined).to.be.true;\n\n el.static = 'black';\n await elementUpdated(el);\n\n expect(el.static == 'black').to.be.true;\n\n el.static = 'white';\n await elementUpdated(el);\n\n expect(el.static == 'white').to.be.true;\n });\n it('stay `valid`', async () => {\n const el = await actionMenuFixture();\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 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 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 const button = el.button as HTMLButtonElement;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.not.have.attribute('aria-expanded', 'true');\n expect(button).to.not.have.attribute('aria-controls', 'menu');\n\n el.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n });\n it('opens repeatedly with Menu in the correct location', async function () {\n const el = await fixture<ActionMenu>(\n iconOnly({\n ...iconOnly.args,\n align: 'end',\n })\n );\n\n await elementUpdated(el);\n\n el.focus();\n await elementUpdated(el);\n let opened = oneEvent(el, 'sp-opened');\n await sendKeys({ press: 'ArrowRight' });\n await sendKeys({ press: 'ArrowLeft' });\n await sendKeys({ press: 'Space' });\n await opened;\n\n const firstRect = (\n el as unknown as { overlayElement: Overlay }\n ).overlayElement.dialogEl.getBoundingClientRect();\n\n let closed = oneEvent(el, 'sp-closed');\n await sendKeys({ press: 'Space' });\n await closed;\n\n opened = oneEvent(el, 'sp-opened');\n await sendKeys({ press: 'Space' });\n await opened;\n\n const secondRect = (\n el as unknown as { overlayElement: Overlay }\n ).overlayElement.dialogEl.getBoundingClientRect();\n\n closed = oneEvent(el, 'sp-closed');\n await sendKeys({ press: 'Space' });\n await closed;\n\n expect(firstRect).to.deep.equal(secondRect);\n });\n it('opens and selects in a single pointer button interaction', async () => {\n const el = await actionMenuFixture();\n const thirdItem = el.querySelector(\n 'sp-menu-item:nth-of-type(3)'\n ) as MenuItem;\n const boundingRect = el.button.getBoundingClientRect();\n\n expect(el.value).to.not.equal(thirdItem.value);\n const opened = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n {\n type: 'down',\n },\n ],\n });\n await opened;\n\n const thirdItemRect = thirdItem.getBoundingClientRect();\n const closed = oneEvent(el, 'sp-closed');\n let selected = '';\n el.addEventListener('change', (event: Event) => {\n selected = (event.target as ActionMenu).value;\n });\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n thirdItemRect.x + thirdItemRect.width / 2,\n thirdItemRect.y + thirdItemRect.height / 2,\n ],\n },\n {\n type: 'up',\n },\n ],\n });\n await closed;\n\n expect(el.open).to.be.false;\n expect(selected).to.equal(thirdItem.value);\n });\n it('has attribute aria-describedby', async () => {\n const name = 'sp-picker';\n const description = 'Rendering a Picker';\n\n const el = await fixture(html`\n <sp-action-menu label=${name}>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <span slot=\"description\">${description}</span>\n </sp-action-menu>\n `);\n\n await elementUpdated(el);\n\n await findDescribedNode(name, description);\n });\n it('opens unmeasured with deprecated syntax', async () => {\n const el = await deprecatedActionMenuFixture();\n\n el.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\n const button = el.button as HTMLButtonElement;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n let opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n\n let closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n\n closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n });\n it('allows submenu items to be selected', async () => {\n const root = await actionSubmenuFixture();\n const menuItem = root.querySelector('#item-with-submenu') as Menu;\n const submenu = menuItem.querySelector(\n 'sp-menu[slot=\"submenu\"]'\n ) as Menu;\n const selectedItem = submenu.querySelector(\n '#sub-selected-item'\n ) as MenuItem;\n\n expect(selectedItem.selected, 'item should be initially selected')\n .to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n expect(root.open).to.be.true;\n\n opened = oneEvent(menuItem, 'sp-opened');\n menuItem.dispatchEvent(\n new PointerEvent('pointerenter', { bubbles: true })\n );\n await opened;\n\n await elementUpdated(submenu);\n expect(\n selectedItem.selected,\n 'initially selected item should maintain selection'\n ).to.be.true;\n });\n it('allows top-level selection state to change', async () => {\n let selected = true;\n const handleChange = (\n event: Event & { target: ActionMenu }\n ): void => {\n if (event.target.value === 'test') {\n selected = !selected;\n\n event.target.updateComplete.then(() => {\n event.target.value = selected ? 'test' : '';\n });\n }\n };\n const root = await fixture<ActionMenu>(html`\n <sp-action-menu label=\"More Actions\" @change=${handleChange}>\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected value=\"test\" id=\"root-selected-item\">\n Two\n </sp-menu-item>\n <sp-menu-item id=\"item-with-submenu\">\n B should be selected\n <sp-menu slot=\"submenu\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected id=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `);\n\n const unselectedItem = root.querySelector(\n 'sp-menu-item'\n ) as MenuItem;\n const selectedItem = root.querySelector(\n '#root-selected-item'\n ) as MenuItem;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n let closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n expect(root.open).to.be.false;\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking unselected\n // (no event listener: should remain selected = false)\n closed = oneEvent(root, 'sp-closed');\n unselectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.false;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n });\n it('shows tooltip', async function () {\n const openSpy = spy();\n const el = await fixture<ActionMenu>(\n tooltipDescriptionAndPlacement(\n tooltipDescriptionAndPlacement.args\n )\n );\n const tooltip = el.querySelector('sp-tooltip') as Tooltip;\n const rect = el.getBoundingClientRect();\n tooltip.addEventListener('sp-opened', () => openSpy());\n await elementUpdated(tooltip);\n\n await nextFrame();\n await nextFrame();\n\n const overlay = tooltip.shadowRoot.querySelector(\n 'sp-overlay'\n ) as Overlay;\n await elementUpdated(overlay);\n\n expect(overlay.triggerElement === el.button).to.be.true;\n let open = oneEvent(tooltip, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n await open;\n\n expect(tooltip.open).to.be.true;\n\n const close = oneEvent(tooltip, 'sp-closed');\n open = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await close;\n await open;\n\n expect(tooltip.open, 'tooltip still open').to.be.false;\n expect(el.open, 'menu not open').to.be.true;\n\n const menu = (el as unknown as TestablePicker).optionsMenu;\n const menuRect = menu.getBoundingClientRect();\n\n await sendMouse({\n steps: [\n {\n position: [\n menuRect.left + menuRect.width / 2,\n menuRect.top + menuRect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n\n await aTimeout(150);\n\n expect(openSpy.callCount).to.equal(1);\n });\n it('opens, then closes, on subsequent clicks', async function () {\n this.retries(0);\n const el = await actionMenuFixture();\n const rect = el.getBoundingClientRect();\n\n await nextFrame();\n await nextFrame();\n\n const open = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await open;\n\n expect(el.open).to.be.true;\n await aTimeout(50);\n expect(el.open).to.be.true;\n\n const close = oneEvent(el, 'sp-closed');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await close;\n\n expect(el.open).to.be.false;\n await aTimeout(50);\n expect(el.open).to.be.false;\n });\n });\n};\n"],
|
|
5
|
-
"mappings": ";AAYA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,6BAA6B;AAEtC,SAAS,WAAW;AAIpB;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,OAAO;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,yBAAyB;AAElC,SAAS,iBAAiB;AAG1B,SAAS,gBAAgB;AAEzB,8BAA8B,QAAQ,KAAK;AAE3C,MAAM,8BAA8B,YAChC,MAAM;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaJ;AAEJ,MAAM,oBAAoB,YACtB,MAAM;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWJ;AAEJ,MAAM,uBAAuB,YACzB,MAAM;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBJ;AAEG,aAAM,iBAAiB,CAAC,SAAiC;AAC5D,WAAS,gBAAgB,IAAI,IAAI,MAAM;AACnC,0BAAsB,YAAY,MAAM,kBAAkB,CAAC;AAC3D,OAAG,SAAS,YAAY;AACpB,YAAM,KAAK,MAAM,kBAAkB;AACnC,YAAM,eAAe,EAAE;AAEvB,aAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AAErB,YAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,IACtC,CAAC;AACD,OAAG,0BAA0B,YAAY;AACrC,YAAM,KAAK,MAAM;AAAA,QACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AI,EAAE,GAAG,GAAG;AAEtB,YAAM,QAAQ,SAAS,IAAI,WAAW;AACtC,YAAM,UAAU;AAAA,QACZ,OAAO;AAAA,UACH;AAAA,YACI,UAAU;AAAA,cACN,KAAK,OAAO,KAAK,QAAQ;AAAA,cACzB,KAAK,MAAM,KAAK,SAAS;AAAA,YAC7B;AAAA,YACA,MAAM;AAAA,UACV;AAAA,QACJ;AAAA,MACJ,CAAC;AACD,YAAM;AAEN,aAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,YAAM,SAAS,EAAE;AACjB,aAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAAA,IAC1B,CAAC;AAAA,EACL,CAAC;AACL;",
|
|
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 aTimeout,\n elementUpdated,\n expect,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers';\n\nimport { spy } from 'sinon';\n\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport type { Menu, MenuItem } from '@spectrum-web-components/menu';\nimport {\n fixture,\n ignoreResizeObserverLoopError,\n} from '../../../test/testing-helpers.js';\nimport '@spectrum-web-components/dialog/sp-dialog-base.js';\nimport {\n iconOnly,\n tooltipDescriptionAndPlacement,\n} from '../stories/action-menu.stories.js';\nimport { findDescribedNode } from '../../../test/testing-helpers-a11y.js';\nimport type { Tooltip } from '@spectrum-web-components/tooltip';\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport type { TestablePicker } from '../../picker/test/index.js';\nimport type { Overlay } from '@spectrum-web-components/overlay';\nimport { sendKeys } from '@web/test-runner-commands';\n\nignoreResizeObserverLoopError(before, after);\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\nconst actionSubmenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected id=\"root-selected-item\">\n Two\n </sp-menu-item>\n <sp-menu-item id=\"item-with-submenu\">\n B should be selected\n <sp-menu slot=\"submenu\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected id=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `\n );\n\nexport const testActionMenu = (mode: 'sync' | 'async'): void => {\n describe(`Action menu: ${mode}`, () => {\n testForLitDevWarnings(async () => await actionMenuFixture());\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 await nextFrame();\n await nextFrame();\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 await nextFrame();\n await nextFrame();\n\n await expect(el).to.be.accessible();\n });\n it('dispatches change events, no [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${({\n target: { value },\n }: Event & { target: ActionMenu }) => {\n changeSpy(value);\n }}\n >\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 expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await elementUpdated(el);\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(1);\n expect(changeSpy.calledWith('Deselect')).to.be.true;\n });\n it('closes when Menu Item has [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${() => {\n changeSpy();\n }}\n >\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item href=\"#\">Deselect</sp-menu-item>\n <sp-menu-item href=\"#\">Select Inverse</sp-menu-item>\n <sp-menu-item href=\"#\">Feather...</sp-menu-item>\n <sp-menu-item href=\"#\">Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item href=\"#\">Save Selection</sp-menu-item>\n <sp-menu-item href=\"#\" disabled>\n Make Work Path\n </sp-menu-item>\n </sp-action-menu>\n `\n );\n\n expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(0);\n });\n it('can be `quiet`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.quiet).to.be.false;\n\n el.quiet = true;\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n });\n it('can be `static`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.static == undefined).to.be.true;\n\n el.static = 'black';\n await elementUpdated(el);\n\n expect(el.static == 'black').to.be.true;\n\n el.static = 'white';\n await elementUpdated(el);\n\n expect(el.static == 'white').to.be.true;\n });\n it('stay `valid`', async () => {\n const el = await actionMenuFixture();\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 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 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 const button = el.button as HTMLButtonElement;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.not.have.attribute('aria-expanded', 'true');\n expect(button).to.not.have.attribute('aria-controls', 'menu');\n\n el.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n });\n it('opens repeatedly with Menu in the correct location', async function () {\n const el = await fixture<ActionMenu>(\n iconOnly({\n ...iconOnly.args,\n align: 'end',\n })\n );\n\n await elementUpdated(el);\n\n el.focus();\n await elementUpdated(el);\n let opened = oneEvent(el, 'sp-opened');\n await sendKeys({ press: 'ArrowRight' });\n await sendKeys({ press: 'ArrowLeft' });\n await sendKeys({ press: 'Space' });\n await opened;\n\n const firstRect = (\n el as unknown as { overlayElement: Overlay }\n ).overlayElement.dialogEl.getBoundingClientRect();\n\n let closed = oneEvent(el, 'sp-closed');\n await sendKeys({ press: 'Space' });\n await closed;\n\n opened = oneEvent(el, 'sp-opened');\n await sendKeys({ press: 'Space' });\n await opened;\n\n const secondRect = (\n el as unknown as { overlayElement: Overlay }\n ).overlayElement.dialogEl.getBoundingClientRect();\n\n closed = oneEvent(el, 'sp-closed');\n await sendKeys({ press: 'Space' });\n await closed;\n\n expect(firstRect).to.deep.equal(secondRect);\n });\n it('opens and selects in a single pointer button interaction', async () => {\n const el = await actionMenuFixture();\n const thirdItem = el.querySelector(\n 'sp-menu-item:nth-of-type(3)'\n ) as MenuItem;\n const boundingRect = el.button.getBoundingClientRect();\n\n expect(el.value).to.not.equal(thirdItem.value);\n const opened = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n {\n type: 'down',\n },\n ],\n });\n await opened;\n\n const thirdItemRect = thirdItem.getBoundingClientRect();\n const closed = oneEvent(el, 'sp-closed');\n let selected = '';\n el.addEventListener('change', (event: Event) => {\n selected = (event.target as ActionMenu).value;\n });\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n thirdItemRect.x + thirdItemRect.width / 2,\n thirdItemRect.y + thirdItemRect.height / 2,\n ],\n },\n {\n type: 'up',\n },\n ],\n });\n await closed;\n\n expect(el.open).to.be.false;\n expect(selected).to.equal(thirdItem.value);\n });\n it('has attribute aria-describedby', async () => {\n const name = 'sp-picker';\n const description = 'Rendering a Picker';\n\n const el = await fixture(html`\n <sp-action-menu label=${name}>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <span slot=\"description\">${description}</span>\n </sp-action-menu>\n `);\n\n await elementUpdated(el);\n\n await findDescribedNode(name, description);\n });\n it('opens unmeasured with deprecated syntax', async () => {\n const el = await deprecatedActionMenuFixture();\n\n el.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\n const button = el.button as HTMLButtonElement;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n let opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n\n let closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n\n closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n });\n it('allows submenu items to be selected', async () => {\n const root = await actionSubmenuFixture();\n const menuItem = root.querySelector('#item-with-submenu') as Menu;\n const submenu = menuItem.querySelector(\n 'sp-menu[slot=\"submenu\"]'\n ) as Menu;\n const selectedItem = submenu.querySelector(\n '#sub-selected-item'\n ) as MenuItem;\n\n expect(selectedItem.selected, 'item should be initially selected')\n .to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n expect(root.open).to.be.true;\n\n opened = oneEvent(menuItem, 'sp-opened');\n menuItem.dispatchEvent(\n new PointerEvent('pointerenter', { bubbles: true })\n );\n await opened;\n\n await elementUpdated(submenu);\n expect(\n selectedItem.selected,\n 'initially selected item should maintain selection'\n ).to.be.true;\n });\n it('allows top-level selection state to change', async () => {\n let selected = true;\n const handleChange = (\n event: Event & { target: ActionMenu }\n ): void => {\n if (event.target.value === 'test') {\n selected = !selected;\n\n event.target.updateComplete.then(() => {\n event.target.value = selected ? 'test' : '';\n });\n }\n };\n const root = await fixture<ActionMenu>(html`\n <sp-action-menu label=\"More Actions\" @change=${handleChange}>\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected value=\"test\" id=\"root-selected-item\">\n Two\n </sp-menu-item>\n <sp-menu-item id=\"item-with-submenu\">\n B should be selected\n <sp-menu slot=\"submenu\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected id=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `);\n\n const unselectedItem = root.querySelector(\n 'sp-menu-item'\n ) as MenuItem;\n const selectedItem = root.querySelector(\n '#root-selected-item'\n ) as MenuItem;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n let closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n expect(root.open).to.be.false;\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking unselected\n // (no event listener: should remain selected = false)\n closed = oneEvent(root, 'sp-closed');\n unselectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.false;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n });\n it('shows tooltip', async function () {\n const openSpy = spy();\n const el = await fixture<ActionMenu>(\n tooltipDescriptionAndPlacement(\n tooltipDescriptionAndPlacement.args\n )\n );\n const tooltip = el.querySelector('sp-tooltip') as Tooltip;\n const rect = el.getBoundingClientRect();\n tooltip.addEventListener('sp-opened', () => openSpy());\n await elementUpdated(tooltip);\n\n await nextFrame();\n await nextFrame();\n\n const overlay = tooltip.shadowRoot.querySelector(\n 'sp-overlay'\n ) as Overlay;\n await elementUpdated(overlay);\n\n expect(overlay.triggerElement === el.button).to.be.true;\n let open = oneEvent(tooltip, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n await open;\n\n expect(tooltip.open).to.be.true;\n\n const close = oneEvent(tooltip, 'sp-closed');\n open = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await close;\n await open;\n\n expect(tooltip.open, 'tooltip still open').to.be.false;\n expect(el.open, 'menu not open').to.be.true;\n\n const menu = (el as unknown as TestablePicker).optionsMenu;\n const menuRect = menu.getBoundingClientRect();\n\n await sendMouse({\n steps: [\n {\n position: [\n menuRect.left + menuRect.width / 2,\n menuRect.top + menuRect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n\n await aTimeout(150);\n\n expect(openSpy.callCount).to.equal(1);\n });\n it('opens, then closes, on subsequent clicks', async function () {\n const el = await actionMenuFixture();\n const rect = el.getBoundingClientRect();\n\n await nextFrame();\n await nextFrame();\n\n const open = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await open;\n\n expect(el.open).to.be.true;\n await aTimeout(50);\n expect(el.open).to.be.true;\n\n const close = oneEvent(el, 'sp-closed');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await close;\n\n expect(el.open).to.be.false;\n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