@spectrum-web-components/overlay 0.18.10-styles.28 → 0.18.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  "modules": [
5
5
  {
6
6
  "kind": "javascript-module",
7
- "path": "src/ActiveOverlay.ts",
7
+ "path": "src/ActiveOverlay.js",
8
8
  "declarations": [
9
9
  {
10
10
  "kind": "class",
@@ -555,14 +555,14 @@
555
555
  "name": "ActiveOverlay",
556
556
  "declaration": {
557
557
  "name": "ActiveOverlay",
558
- "module": "src/ActiveOverlay.ts"
558
+ "module": "src/ActiveOverlay.js"
559
559
  }
560
560
  }
561
561
  ]
562
562
  },
563
563
  {
564
564
  "kind": "javascript-module",
565
- "path": "src/OverlayTrigger.ts",
565
+ "path": "src/OverlayTrigger.js",
566
566
  "declarations": [
567
567
  {
568
568
  "kind": "variable",
@@ -1094,7 +1094,7 @@
1094
1094
  "name": "LONGPRESS_INSTRUCTIONS",
1095
1095
  "declaration": {
1096
1096
  "name": "LONGPRESS_INSTRUCTIONS",
1097
- "module": "src/OverlayTrigger.ts"
1097
+ "module": "src/OverlayTrigger.js"
1098
1098
  }
1099
1099
  },
1100
1100
  {
@@ -1102,14 +1102,14 @@
1102
1102
  "name": "OverlayTrigger",
1103
1103
  "declaration": {
1104
1104
  "name": "OverlayTrigger",
1105
- "module": "src/OverlayTrigger.ts"
1105
+ "module": "src/OverlayTrigger.js"
1106
1106
  }
1107
1107
  }
1108
1108
  ]
1109
1109
  },
1110
1110
  {
1111
1111
  "kind": "javascript-module",
1112
- "path": "src/VirtualTrigger.ts",
1112
+ "path": "src/VirtualTrigger.js",
1113
1113
  "declarations": [
1114
1114
  {
1115
1115
  "kind": "class",
@@ -1177,7 +1177,7 @@
1177
1177
  "name": "VirtualTrigger",
1178
1178
  "declaration": {
1179
1179
  "name": "VirtualTrigger",
1180
- "module": "src/VirtualTrigger.ts"
1180
+ "module": "src/VirtualTrigger.js"
1181
1181
  }
1182
1182
  }
1183
1183
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/overlay",
3
- "version": "0.18.10-styles.28+7ca5b0103",
3
+ "version": "0.18.10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/overlay"
13
13
  },
14
14
  "author": "",
15
- "homepage": "https://adobe.github.io/spectrum-web-components/components/overlay",
15
+ "homepage": "https://opensource.adobe.com/spectrum-web-components/components/overlay",
16
16
  "bugs": {
17
17
  "url": "https://github.com/adobe/spectrum-web-components/issues"
18
18
  },
@@ -103,10 +103,10 @@
103
103
  ],
104
104
  "dependencies": {
105
105
  "@floating-ui/dom": "^1.0.4",
106
- "@spectrum-web-components/action-button": "^0.10.8",
107
- "@spectrum-web-components/base": "^0.7.2",
108
- "@spectrum-web-components/shared": "^0.15.3",
109
- "@spectrum-web-components/theme": "^0.14.9-styles.28+7ca5b0103"
106
+ "@spectrum-web-components/action-button": "^0.10.9",
107
+ "@spectrum-web-components/base": "^0.7.3",
108
+ "@spectrum-web-components/shared": "^0.15.4",
109
+ "@spectrum-web-components/theme": "^0.14.9"
110
110
  },
111
111
  "types": "./src/index.d.ts",
112
112
  "customElements": "custom-elements.json",
@@ -117,5 +117,5 @@
117
117
  "./stories/overlay-story-components.js",
118
118
  "./**/*.dev.js"
119
119
  ],
120
- "gitHead": "7ca5b0103010e0a5ede4ecf72eba3b3107e8da0d"
120
+ "gitHead": "02534b6685ff89a21dba86c09b2169f5b30a46f2"
121
121
  }
@@ -21,6 +21,7 @@ import { sendKeys } from "@web/test-runner-commands";
21
21
  import "@spectrum-web-components/theme/sp-theme.js";
22
22
  import "@spectrum-web-components/theme/src/themes.js";
23
23
  import { ignoreResizeObserverLoopError } from "../../../test/testing-helpers.js";
24
+ import { isFirefox } from "@spectrum-web-components/shared/src/platform.js";
24
25
  ignoreResizeObserverLoopError(before, after);
25
26
  async function styledFixture(story) {
26
27
  const test = await fixture(html`
@@ -229,7 +230,7 @@ describe("Overlay Trigger - Hover", () => {
229
230
  expect(el.open).to.be.null;
230
231
  });
231
232
  it('will not return focus to a "modal" parent', async () => {
232
- if (/Firefox/.test(window.navigator.userAgent)) {
233
+ if (isFirefox()) {
233
234
  return;
234
235
  }
235
236
  const el = await styledFixture(html`
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["overlay-trigger-hover.test.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n aTimeout,\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n oneEvent,\n waitUntil,\n} from '@open-wc/testing';\nimport '@spectrum-web-components/overlay/overlay-trigger.js';\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport '@spectrum-web-components/dialog/sp-dialog-wrapper.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-magnify.js';\nimport { OverlayTrigger } from '@spectrum-web-components/overlay';\nimport { spy } from 'sinon';\nimport { ActionButton } from '@spectrum-web-components/action-button';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { Button } from '@spectrum-web-components/button';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport { Theme } from '@spectrum-web-components/theme';\nimport { Tooltip } from '@spectrum-web-components/tooltip';\nimport { ignoreResizeObserverLoopError } from '../../../test/testing-helpers.js';\n\nignoreResizeObserverLoopError(before, after);\n\nasync function styledFixture<T extends Element>(\n story: TemplateResult\n): Promise<T> {\n const test = await fixture<Theme>(html`\n <sp-theme theme=\"spectrum\" scale=\"medium\" color=\"light\">\n ${story}\n </sp-theme>\n `);\n return test.children[0] as T;\n}\n\ndescribe('Overlay Trigger - Hover', () => {\n it('displays `hover` declaratively', async () => {\n const openedSpy = spy();\n const closedSpy = spy();\n const el = await fixture<OverlayTrigger>(\n (() => html`\n <overlay-trigger\n placement=\"right-start\"\n open=\"hover\"\n @sp-opened=${() => openedSpy()}\n @sp-closed=${() => closedSpy()}\n >\n <sp-action-button slot=\"trigger\">\n <sp-icon-magnify slot=\"icon\"></sp-icon-magnify>\n </sp-action-button>\n <sp-popover slot=\"hover-content\" tip></sp-popover>\n </overlay-trigger>\n `)()\n );\n await elementUpdated(el);\n\n await waitUntil(\n () => openedSpy.calledOnce,\n 'hover content projected to overlay',\n { timeout: 2000 }\n );\n\n el.removeAttribute('open');\n await elementUpdated(el);\n\n await waitUntil(() => closedSpy.calledOnce, 'hover content returned', {\n timeout: 2000,\n });\n });\n describe('\"tooltip\" mouse interactions', () => {\n let el: OverlayTrigger;\n let button: ActionButton;\n let tooltip: Tooltip;\n beforeEach(async () => {\n el = await fixture<OverlayTrigger>(\n (() => html`\n <overlay-trigger placement=\"right-start\">\n <sp-action-button slot=\"trigger\">\n <sp-icon-magnify slot=\"icon\"></sp-icon-magnify>\n </sp-action-button>\n <sp-tooltip slot=\"hover-content\" tip>\n Magnify\n </sp-tooltip>\n </overlay-trigger>\n `)()\n );\n await elementUpdated(el);\n button = el.querySelector('sp-action-button') as ActionButton;\n tooltip = el.querySelector('sp-tooltip') as Tooltip;\n });\n it('allows pointer to enter the \"tooltip\" without closing the \"tooltip\"', async () => {\n const opened = oneEvent(button, 'sp-opened');\n button.dispatchEvent(\n new MouseEvent('mouseenter', {\n bubbles: true,\n composed: true,\n })\n );\n await nextFrame();\n button.dispatchEvent(\n new MouseEvent('mouseleave', {\n relatedTarget: tooltip,\n bubbles: true,\n composed: true,\n })\n );\n await nextFrame();\n tooltip.dispatchEvent(\n new MouseEvent('mouseleave', {\n relatedTarget: button,\n bubbles: true,\n composed: true,\n })\n );\n await opened;\n\n expect(el.open).to.equal('hover');\n\n const closed = oneEvent(button, 'sp-closed');\n button.dispatchEvent(\n new MouseEvent('mouseleave', {\n bubbles: true,\n composed: true,\n })\n );\n await closed;\n\n expect(el.open).to.be.null;\n });\n it('closes the \"tooltip\" when leaving the \"tooltip\"', async () => {\n const opened = oneEvent(button, 'sp-opened');\n button.dispatchEvent(\n new MouseEvent('mouseenter', {\n bubbles: true,\n composed: true,\n })\n );\n await nextFrame();\n button.dispatchEvent(\n new MouseEvent('mouseleave', {\n relatedTarget: tooltip,\n bubbles: true,\n composed: true,\n })\n );\n await opened;\n\n expect(el.open).to.equal('hover');\n\n const closed = oneEvent(button, 'sp-closed');\n tooltip.dispatchEvent(\n new MouseEvent('mouseleave', {\n bubbles: true,\n composed: true,\n })\n );\n await closed;\n\n expect(el.open).to.be.null;\n });\n });\n it('persists hover content', async () => {\n const el = await fixture<OverlayTrigger>(\n (() => html`\n <overlay-trigger placement=\"right-start\">\n <sp-action-button slot=\"trigger\">\n <sp-icon-magnify slot=\"icon\"></sp-icon-magnify>\n </sp-action-button>\n <sp-popover slot=\"hover-content\" tip></sp-popover>\n </overlay-trigger>\n `)()\n );\n await elementUpdated(el);\n\n expect(el.open).to.be.undefined;\n\n const trigger = el.querySelector('[slot=\"trigger\"]') as ActionButton;\n trigger.dispatchEvent(\n new Event('mouseenter', {\n bubbles: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.open).to.equal('hover');\n\n trigger.click();\n\n await elementUpdated(el);\n\n expect(el.open).to.equal('hover');\n });\n it('closes persistent hover content on `longpress`', async () => {\n const el = await fixture<OverlayTrigger>(\n (() => html`\n <overlay-trigger placement=\"right-start\">\n <sp-action-button slot=\"trigger\">\n <sp-icon-magnify slot=\"icon\"></sp-icon-magnify>\n </sp-action-button>\n <sp-popover slot=\"hover-content\" tip></sp-popover>\n <sp-popover slot=\"longpress-content\" tip></sp-popover>\n </overlay-trigger>\n `)()\n );\n await elementUpdated(el);\n\n expect(el.open).to.be.undefined;\n\n const trigger = el.querySelector('[slot=\"trigger\"]') as ActionButton;\n trigger.dispatchEvent(\n new Event('mouseenter', {\n bubbles: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.open).to.equal('hover');\n\n trigger.dispatchEvent(\n new Event('longpress', {\n bubbles: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.open).to.equal('longpress');\n });\n it('closes `hover` overlay when [type=\"modal\"]', async () => {\n const el = await fixture<OverlayTrigger>(\n (() => html`\n <overlay-trigger placement=\"right-start\" type=\"modal\">\n <sp-action-button slot=\"trigger\">\n <sp-icon-magnify slot=\"icon\"></sp-icon-magnify>\n </sp-action-button>\n <sp-popover slot=\"hover-content\" tip></sp-popover>\n </overlay-trigger>\n `)()\n );\n await elementUpdated(el);\n\n expect(el.open).to.be.undefined;\n\n const trigger = el.querySelector('[slot=\"trigger\"]') as ActionButton;\n const opened = oneEvent(el, 'sp-opened');\n trigger.focus();\n await opened;\n\n await elementUpdated(el);\n await aTimeout(500);\n\n expect(el.open).to.equal('hover');\n\n const closed = oneEvent(el, 'sp-closed');\n trigger.blur();\n await closed;\n\n await elementUpdated(el);\n\n expect(el.open).to.be.null;\n });\n it('will not return focus to a \"modal\" parent', async () => {\n // There is an `sp-dialog-base` recyling issue in Firefox\n if (/Firefox/.test(window.navigator.userAgent)) {\n return;\n }\n const el = await styledFixture<OverlayTrigger>(html`\n <overlay-trigger type=\"modal\" placement=\"none\">\n <sp-button slot=\"trigger\">Toggle Dialog</sp-button>\n <sp-dialog-wrapper\n slot=\"click-content\"\n headline=\"Dialog title\"\n size=\"s\"\n >\n ${[1, 2, 3, 4].map(\n (index) => html`\n <overlay-trigger>\n <sp-button slot=\"trigger\" id=\"button-${index}\">\n Button with Tooltip ${index}\n </sp-button>\n <sp-tooltip slot=\"hover-content\">\n Tooltip ${index}\n </sp-tooltip>\n </overlay-trigger>\n `\n )}\n </sp-dialog-wrapper>\n </overlay-trigger>\n `);\n await elementUpdated(el);\n\n const button = el.querySelector('sp-button') as Button;\n const dialog = el.querySelector('sp-dialog-wrapper') as HTMLElement;\n await elementUpdated(button);\n await elementUpdated(dialog);\n\n let opened = oneEvent(button, 'sp-opened');\n button.dispatchEvent(new Event('click', { bubbles: true }));\n await opened;\n const button1 = dialog.querySelector('#button-1') as Button;\n const button2 = dialog.querySelector('#button-2') as Button;\n\n opened = oneEvent(button1, 'sp-opened');\n sendKeys({\n press: 'Tab',\n });\n await opened;\n\n await nextFrame();\n\n expect(button1 === document.activeElement).to.be.true;\n\n opened = oneEvent(button2, 'sp-opened');\n sendKeys({\n press: 'Tab',\n });\n await opened;\n\n await nextFrame();\n\n expect(button2 === document.activeElement).to.be.true;\n });\n});\n"],
5
- "mappings": ";AAWA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,SAAS,WAAW;AAEpB,SAAS,gBAAgB;AAEzB,OAAO;AACP,OAAO;AAIP,SAAS,qCAAqC;AAE9C,8BAA8B,QAAQ,KAAK;AAE3C,eAAe,cACX,OACU;AACV,QAAM,OAAO,MAAM,QAAe;AAAA;AAAA,cAExB;AAAA;AAAA,KAET;AACD,SAAO,KAAK,SAAS;AACzB;AAEA,SAAS,2BAA2B,MAAM;AACtC,KAAG,kCAAkC,YAAY;AAC7C,UAAM,YAAY,IAAI;AACtB,UAAM,YAAY,IAAI;AACtB,UAAM,KAAK,MAAM;AAAA,OACZ,MAAM;AAAA;AAAA;AAAA;AAAA,iCAIc,MAAM,UAAU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A,UAAM,KAAK,MAAM,cAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAQjC,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE;AAAA,MACX,CAAC,UAAU;AAAA;AAAA,uEAEoC;AAAA,0DACb;AAAA;AAAA;AAAA,8CAGZ;AAAA;AAAA;AAAA;AAAA,IAI1B;AAAA;AAAA;AAAA,SAGX;AACD,UAAM,eAAe,EAAE;AAEvB,UAAM,SAAS,GAAG,cAAc,WAAW;AAC3C,UAAM,SAAS,GAAG,cAAc,mBAAmB;AACnD,UAAM,eAAe,MAAM;AAC3B,UAAM,eAAe,MAAM;AAE3B,QAAI,SAAS,SAAS,QAAQ,WAAW;AACzC,WAAO,cAAc,IAAI,MAAM,SAAS,EAAE,SAAS,KAAK,CAAC,CAAC;AAC1D,UAAM;AACN,UAAM,UAAU,OAAO,cAAc,WAAW;AAChD,UAAM,UAAU,OAAO,cAAc,WAAW;AAEhD,aAAS,SAAS,SAAS,WAAW;AACtC,aAAS;AAAA,MACL,OAAO;AAAA,IACX,CAAC;AACD,UAAM;AAEN,UAAM,UAAU;AAEhB,WAAO,YAAY,SAAS,aAAa,EAAE,GAAG,GAAG;AAEjD,aAAS,SAAS,SAAS,WAAW;AACtC,aAAS;AAAA,MACL,OAAO;AAAA,IACX,CAAC;AACD,UAAM;AAEN,UAAM,UAAU;AAEhB,WAAO,YAAY,SAAS,aAAa,EAAE,GAAG,GAAG;AAAA,EACrD,CAAC;AACL,CAAC;",
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 {\n aTimeout,\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n oneEvent,\n waitUntil,\n} from '@open-wc/testing';\nimport '@spectrum-web-components/overlay/overlay-trigger.js';\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport '@spectrum-web-components/dialog/sp-dialog-wrapper.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-magnify.js';\nimport { OverlayTrigger } from '@spectrum-web-components/overlay';\nimport { spy } from 'sinon';\nimport { ActionButton } from '@spectrum-web-components/action-button';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { Button } from '@spectrum-web-components/button';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport { Theme } from '@spectrum-web-components/theme';\nimport { Tooltip } from '@spectrum-web-components/tooltip';\nimport { ignoreResizeObserverLoopError } from '../../../test/testing-helpers.js';\nimport { isFirefox } from '@spectrum-web-components/shared/src/platform.js';\n\nignoreResizeObserverLoopError(before, after);\n\nasync function styledFixture<T extends Element>(\n story: TemplateResult\n): Promise<T> {\n const test = await fixture<Theme>(html`\n <sp-theme theme=\"spectrum\" scale=\"medium\" color=\"light\">\n ${story}\n </sp-theme>\n `);\n return test.children[0] as T;\n}\n\ndescribe('Overlay Trigger - Hover', () => {\n it('displays `hover` declaratively', async () => {\n const openedSpy = spy();\n const closedSpy = spy();\n const el = await fixture<OverlayTrigger>(\n (() => html`\n <overlay-trigger\n placement=\"right-start\"\n open=\"hover\"\n @sp-opened=${() => openedSpy()}\n @sp-closed=${() => closedSpy()}\n >\n <sp-action-button slot=\"trigger\">\n <sp-icon-magnify slot=\"icon\"></sp-icon-magnify>\n </sp-action-button>\n <sp-popover slot=\"hover-content\" tip></sp-popover>\n </overlay-trigger>\n `)()\n );\n await elementUpdated(el);\n\n await waitUntil(\n () => openedSpy.calledOnce,\n 'hover content projected to overlay',\n { timeout: 2000 }\n );\n\n el.removeAttribute('open');\n await elementUpdated(el);\n\n await waitUntil(() => closedSpy.calledOnce, 'hover content returned', {\n timeout: 2000,\n });\n });\n describe('\"tooltip\" mouse interactions', () => {\n let el: OverlayTrigger;\n let button: ActionButton;\n let tooltip: Tooltip;\n beforeEach(async () => {\n el = await fixture<OverlayTrigger>(\n (() => html`\n <overlay-trigger placement=\"right-start\">\n <sp-action-button slot=\"trigger\">\n <sp-icon-magnify slot=\"icon\"></sp-icon-magnify>\n </sp-action-button>\n <sp-tooltip slot=\"hover-content\" tip>\n Magnify\n </sp-tooltip>\n </overlay-trigger>\n `)()\n );\n await elementUpdated(el);\n button = el.querySelector('sp-action-button') as ActionButton;\n tooltip = el.querySelector('sp-tooltip') as Tooltip;\n });\n it('allows pointer to enter the \"tooltip\" without closing the \"tooltip\"', async () => {\n const opened = oneEvent(button, 'sp-opened');\n button.dispatchEvent(\n new MouseEvent('mouseenter', {\n bubbles: true,\n composed: true,\n })\n );\n await nextFrame();\n button.dispatchEvent(\n new MouseEvent('mouseleave', {\n relatedTarget: tooltip,\n bubbles: true,\n composed: true,\n })\n );\n await nextFrame();\n tooltip.dispatchEvent(\n new MouseEvent('mouseleave', {\n relatedTarget: button,\n bubbles: true,\n composed: true,\n })\n );\n await opened;\n\n expect(el.open).to.equal('hover');\n\n const closed = oneEvent(button, 'sp-closed');\n button.dispatchEvent(\n new MouseEvent('mouseleave', {\n bubbles: true,\n composed: true,\n })\n );\n await closed;\n\n expect(el.open).to.be.null;\n });\n it('closes the \"tooltip\" when leaving the \"tooltip\"', async () => {\n const opened = oneEvent(button, 'sp-opened');\n button.dispatchEvent(\n new MouseEvent('mouseenter', {\n bubbles: true,\n composed: true,\n })\n );\n await nextFrame();\n button.dispatchEvent(\n new MouseEvent('mouseleave', {\n relatedTarget: tooltip,\n bubbles: true,\n composed: true,\n })\n );\n await opened;\n\n expect(el.open).to.equal('hover');\n\n const closed = oneEvent(button, 'sp-closed');\n tooltip.dispatchEvent(\n new MouseEvent('mouseleave', {\n bubbles: true,\n composed: true,\n })\n );\n await closed;\n\n expect(el.open).to.be.null;\n });\n });\n it('persists hover content', async () => {\n const el = await fixture<OverlayTrigger>(\n (() => html`\n <overlay-trigger placement=\"right-start\">\n <sp-action-button slot=\"trigger\">\n <sp-icon-magnify slot=\"icon\"></sp-icon-magnify>\n </sp-action-button>\n <sp-popover slot=\"hover-content\" tip></sp-popover>\n </overlay-trigger>\n `)()\n );\n await elementUpdated(el);\n\n expect(el.open).to.be.undefined;\n\n const trigger = el.querySelector('[slot=\"trigger\"]') as ActionButton;\n trigger.dispatchEvent(\n new Event('mouseenter', {\n bubbles: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.open).to.equal('hover');\n\n trigger.click();\n\n await elementUpdated(el);\n\n expect(el.open).to.equal('hover');\n });\n it('closes persistent hover content on `longpress`', async () => {\n const el = await fixture<OverlayTrigger>(\n (() => html`\n <overlay-trigger placement=\"right-start\">\n <sp-action-button slot=\"trigger\">\n <sp-icon-magnify slot=\"icon\"></sp-icon-magnify>\n </sp-action-button>\n <sp-popover slot=\"hover-content\" tip></sp-popover>\n <sp-popover slot=\"longpress-content\" tip></sp-popover>\n </overlay-trigger>\n `)()\n );\n await elementUpdated(el);\n\n expect(el.open).to.be.undefined;\n\n const trigger = el.querySelector('[slot=\"trigger\"]') as ActionButton;\n trigger.dispatchEvent(\n new Event('mouseenter', {\n bubbles: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.open).to.equal('hover');\n\n trigger.dispatchEvent(\n new Event('longpress', {\n bubbles: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.open).to.equal('longpress');\n });\n it('closes `hover` overlay when [type=\"modal\"]', async () => {\n const el = await fixture<OverlayTrigger>(\n (() => html`\n <overlay-trigger placement=\"right-start\" type=\"modal\">\n <sp-action-button slot=\"trigger\">\n <sp-icon-magnify slot=\"icon\"></sp-icon-magnify>\n </sp-action-button>\n <sp-popover slot=\"hover-content\" tip></sp-popover>\n </overlay-trigger>\n `)()\n );\n await elementUpdated(el);\n\n expect(el.open).to.be.undefined;\n\n const trigger = el.querySelector('[slot=\"trigger\"]') as ActionButton;\n const opened = oneEvent(el, 'sp-opened');\n trigger.focus();\n await opened;\n\n await elementUpdated(el);\n await aTimeout(500);\n\n expect(el.open).to.equal('hover');\n\n const closed = oneEvent(el, 'sp-closed');\n trigger.blur();\n await closed;\n\n await elementUpdated(el);\n\n expect(el.open).to.be.null;\n });\n it('will not return focus to a \"modal\" parent', async () => {\n // There is an `sp-dialog-base` recyling issue in Firefox\n if (isFirefox()) {\n return;\n }\n const el = await styledFixture<OverlayTrigger>(html`\n <overlay-trigger type=\"modal\" placement=\"none\">\n <sp-button slot=\"trigger\">Toggle Dialog</sp-button>\n <sp-dialog-wrapper\n slot=\"click-content\"\n headline=\"Dialog title\"\n size=\"s\"\n >\n ${[1, 2, 3, 4].map(\n (index) => html`\n <overlay-trigger>\n <sp-button slot=\"trigger\" id=\"button-${index}\">\n Button with Tooltip ${index}\n </sp-button>\n <sp-tooltip slot=\"hover-content\">\n Tooltip ${index}\n </sp-tooltip>\n </overlay-trigger>\n `\n )}\n </sp-dialog-wrapper>\n </overlay-trigger>\n `);\n await elementUpdated(el);\n\n const button = el.querySelector('sp-button') as Button;\n const dialog = el.querySelector('sp-dialog-wrapper') as HTMLElement;\n await elementUpdated(button);\n await elementUpdated(dialog);\n\n let opened = oneEvent(button, 'sp-opened');\n button.dispatchEvent(new Event('click', { bubbles: true }));\n await opened;\n const button1 = dialog.querySelector('#button-1') as Button;\n const button2 = dialog.querySelector('#button-2') as Button;\n\n opened = oneEvent(button1, 'sp-opened');\n sendKeys({\n press: 'Tab',\n });\n await opened;\n\n await nextFrame();\n\n expect(button1 === document.activeElement).to.be.true;\n\n opened = oneEvent(button2, 'sp-opened');\n sendKeys({\n press: 'Tab',\n });\n await opened;\n\n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