@spectrum-web-components/overlay 1.0.2 → 1.0.3

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.
Files changed (74) hide show
  1. package/LICENSE +201 -0
  2. package/custom-elements.json +189 -73
  3. package/package.json +8 -7
  4. package/src/Overlay.d.ts +348 -18
  5. package/src/Overlay.dev.js +271 -12
  6. package/src/Overlay.dev.js.map +2 -2
  7. package/src/Overlay.js +4 -4
  8. package/src/Overlay.js.map +3 -3
  9. package/src/PlacementController.d.ts +118 -1
  10. package/src/PlacementController.dev.js +75 -0
  11. package/src/PlacementController.dev.js.map +2 -2
  12. package/src/PlacementController.js.map +2 -2
  13. package/src/overlay.css.dev.js +1 -1
  14. package/src/overlay.css.dev.js.map +1 -1
  15. package/src/overlay.css.js +1 -1
  16. package/src/overlay.css.js.map +1 -1
  17. package/stories/index.js +48 -0
  18. package/stories/index.js.map +7 -0
  19. package/stories/overlay-directive.stories.js +324 -0
  20. package/stories/overlay-directive.stories.js.map +7 -0
  21. package/stories/overlay-element.stories.js +675 -0
  22. package/stories/overlay-element.stories.js.map +7 -0
  23. package/stories/overlay-story-components.js +338 -0
  24. package/stories/overlay-story-components.js.map +7 -0
  25. package/stories/overlay.stories.js +1397 -0
  26. package/stories/overlay.stories.js.map +7 -0
  27. package/test/benchmark/basic-test.js +40 -0
  28. package/test/benchmark/basic-test.js.map +7 -0
  29. package/test/benchmark/directive-test.js +43 -0
  30. package/test/benchmark/directive-test.js.map +7 -0
  31. package/test/benchmark/element-test.js +40 -0
  32. package/test/benchmark/element-test.js.map +7 -0
  33. package/test/benchmark/lazy-test.js +47 -0
  34. package/test/benchmark/lazy-test.js.map +7 -0
  35. package/test/index.js +605 -0
  36. package/test/index.js.map +7 -0
  37. package/test/overlay-directive.test-vrt.js +5 -0
  38. package/test/overlay-directive.test-vrt.js.map +7 -0
  39. package/test/overlay-directive.test.js +162 -0
  40. package/test/overlay-directive.test.js.map +7 -0
  41. package/test/overlay-element.test-vrt.js +5 -0
  42. package/test/overlay-element.test-vrt.js.map +7 -0
  43. package/test/overlay-element.test.js +934 -0
  44. package/test/overlay-element.test.js.map +7 -0
  45. package/test/overlay-lifecycle.test.js +139 -0
  46. package/test/overlay-lifecycle.test.js.map +7 -0
  47. package/test/overlay-memory.test.js +10 -0
  48. package/test/overlay-memory.test.js.map +7 -0
  49. package/test/overlay-timer.test.js +118 -0
  50. package/test/overlay-timer.test.js.map +7 -0
  51. package/test/overlay-trigger-click.test.js +164 -0
  52. package/test/overlay-trigger-click.test.js.map +7 -0
  53. package/test/overlay-trigger-directive.test.js +75 -0
  54. package/test/overlay-trigger-directive.test.js.map +7 -0
  55. package/test/overlay-trigger-extended.test.js +235 -0
  56. package/test/overlay-trigger-extended.test.js.map +7 -0
  57. package/test/overlay-trigger-hover-click.test.js +225 -0
  58. package/test/overlay-trigger-hover-click.test.js.map +7 -0
  59. package/test/overlay-trigger-hover.test.js +308 -0
  60. package/test/overlay-trigger-hover.test.js.map +7 -0
  61. package/test/overlay-trigger-longpress.test.js +549 -0
  62. package/test/overlay-trigger-longpress.test.js.map +7 -0
  63. package/test/overlay-trigger-sync.test.js +5 -0
  64. package/test/overlay-trigger-sync.test.js.map +7 -0
  65. package/test/overlay-trigger.test.js +5 -0
  66. package/test/overlay-trigger.test.js.map +7 -0
  67. package/test/overlay-update.test.js +28 -0
  68. package/test/overlay-update.test.js.map +7 -0
  69. package/test/overlay-v1.test.js +569 -0
  70. package/test/overlay-v1.test.js.map +7 -0
  71. package/test/overlay.test-vrt.js +5 -0
  72. package/test/overlay.test-vrt.js.map +7 -0
  73. package/test/overlay.test.js +776 -0
  74. package/test/overlay.test.js.map +7 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["overlay-element.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} from '@open-wc/testing';\nimport { Overlay } from '@spectrum-web-components/overlay/src/Overlay.js';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport { Tooltip } from '@spectrum-web-components/tooltip';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport { Theme } from '@spectrum-web-components/theme';\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport { Button } from '@spectrum-web-components/button';\nimport { sendKeys } from '@web/test-runner-commands';\nimport {\n click,\n receivesFocus,\n withSlider,\n} from '../stories/overlay-element.stories.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from '../src/slottable-request-event.js';\nimport { stub } from 'sinon';\nimport { OverlayStateEvent } from '@spectrum-web-components/overlay/src/events.js';\nimport { Slider } from '@spectrum-web-components/slider/src/Slider.js';\n\nconst OVERLAY_TYPES = ['modal', 'page', 'hint', 'auto', 'manual'] as const;\ntype OverlayTypes = (typeof OVERLAY_TYPES)[number];\n\nasync function styledFixture<T extends Element>(\n story: TemplateResult\n): Promise<T> {\n const test = await fixture<Theme>(html`\n <sp-theme system=\"spectrum\" scale=\"medium\" color=\"light\">\n ${story}\n </sp-theme>\n `);\n return test.children[0] as T;\n}\n\ndescribe('sp-overlay', () => {\n function opensDeclaratively(overlayType: OverlayTypes): void {\n it(`as [type=\"'${overlayType}'\"]`, async () => {\n const el = await styledFixture<Overlay>(html`\n <sp-overlay open type=${overlayType}>\n <sp-tooltip>Content</sp-tooltip>\n </sp-overlay>\n `);\n const content = el.children[0] as Tooltip;\n let opened = oneEvent(el, 'sp-opened');\n await opened;\n\n expect(content.open).to.be.true;\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(content.open).to.be.false;\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(content.open).to.be.true;\n });\n }\n\n describe('`slottable-request` event', () => {\n it('dispatched before `sp-opened`', async function () {\n let slottableRequestTime = 0;\n let openedTime = 0;\n const el = await fixture<Overlay>(html`\n <sp-overlay\n @slottable-request=${() =>\n (slottableRequestTime = performance.now())}\n @sp-opened=${() => (openedTime = performance.now())}\n >\n <sp-popover>test</sp-popover>\n </sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(slottableRequestTime).to.be.lt(openedTime);\n });\n it('dispatched after `sp-closed`', async function () {\n let slottableRequestTime = 0;\n let closedTime = 0;\n const el = await fixture<Overlay>(html`\n <sp-overlay\n @sp-closed=${() => (closedTime = performance.now())}\n @slottable-request=${() =>\n (slottableRequestTime = performance.now())}\n >\n <sp-popover>test</sp-popover>\n </sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n await nextFrame();\n await nextFrame();\n\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n await nextFrame();\n await nextFrame();\n\n expect(\n slottableRequestTime,\n `slottable-request: ${slottableRequestTime}, sp-closed: ${closedTime}`\n ).to.be.gt(closedTime);\n });\n it('follows transition timing from lazily added children', async function () {\n let slottableRequestTime = 0;\n let openedTime = 0;\n const popover = document.createElement('sp-popover');\n popover.textContent = 'Test';\n const el = await fixture<Overlay>(html`\n <sp-overlay\n @slottable-request=${(event: SlottableRequestEvent) => {\n slottableRequestTime = performance.now();\n if (event.data !== removeSlottableRequest) {\n (event.target as HTMLElement).append(popover);\n } else {\n popover.remove();\n }\n }}\n @sp-opened=${() => (openedTime = performance.now())}\n ></sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(slottableRequestTime).to.be.lte(openedTime);\n expect(openedTime - slottableRequestTime).to.be.gt(130);\n });\n\n describe('dev mode', () => {\n let consoleWarnStub!: ReturnType<typeof stub>;\n before(() => {\n window.__swc.verbose = true;\n consoleWarnStub = stub(console, 'warn');\n });\n afterEach(() => {\n consoleWarnStub.resetHistory();\n });\n after(() => {\n window.__swc.verbose = false;\n consoleWarnStub.restore();\n });\n\n it('warns that `slottable-request` events are experimental', async () => {\n const el = await fixture<Overlay>(html`\n <sp-overlay>\n <sp-popover>test</sp-popover>\n </sp-overlay>\n `);\n\n await elementUpdated(el);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n expect(\n (spyCall.args.at(0) as string).includes(\n '`slottable-request` events are experimental'\n ),\n '`slottable-request`-centric message'\n ).to.be.true;\n expect(\n spyCall.args.at(-1),\n 'confirm `data` shape'\n ).to.deep.equal({\n data: {\n localName: 'base',\n type: 'api',\n level: 'high',\n },\n });\n });\n });\n });\n\n describe('[type=\"modal\"]', () => {\n opensDeclaratively('modal');\n describe('interaction with other non-ancestor overlays', function () {\n beforeEach(async function () {\n this.fixture = await styledFixture<Overlay>(html`\n <div>\n ${OVERLAY_TYPES.map(\n (type) => html`\n <sp-overlay type=${type}>\n <sp-tooltip>${type} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n\n this.modal = this.fixture.querySelector(\n '[type=\"modal\"]'\n ) as Overlay;\n this.page = this.fixture.querySelector(\n '[type=\"page\"]'\n ) as Overlay;\n this.hint = this.fixture.querySelector(\n '[type=\"hint\"]'\n ) as Overlay;\n this.auto = this.fixture.querySelector(\n '[type=\"auto\"]'\n ) as Overlay;\n this.manual = this.fixture.querySelector(\n '[type=\"manual\"]'\n ) as Overlay;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n afterEach(async function () {\n const closed = oneEvent(this.modal, 'sp-closed');\n this.modal.open = false;\n await closed;\n });\n it('closes \"page\" overlays when opening', async function () {\n let opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.modal, 'sp-opened');\n const closed = oneEvent(this.page, 'sp-closed');\n this.modal.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"hint\" overlays when opening', async function () {\n let opened = oneEvent(this.hint, 'sp-opened');\n this.hint.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.modal, 'sp-opened');\n const closed = oneEvent(this.hint, 'sp-closed');\n this.modal.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"auto\" overlays when opening', async function () {\n let opened = oneEvent(this.auto, 'sp-opened');\n this.auto.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.modal, 'sp-opened');\n const closed = oneEvent(this.auto, 'sp-closed');\n this.modal.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('does not close \"manual\" overlays when opening', async function () {\n let opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n\n opened = oneEvent(this.modal, 'sp-opened');\n this.modal.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n });\n });\n describe('[type=\"page\"]', () => {\n opensDeclaratively('page');\n describe('interaction with other non-ancestor overlays', function () {\n beforeEach(async function () {\n this.fixture = await styledFixture<Overlay>(html`\n <div>\n ${OVERLAY_TYPES.map(\n (type) => html`\n <sp-overlay type=${type}>\n <sp-tooltip>${type} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n\n this.modal = this.fixture.querySelector(\n '[type=\"modal\"]'\n ) as Overlay;\n this.page = this.fixture.querySelector(\n '[type=\"page\"]'\n ) as Overlay;\n this.hint = this.fixture.querySelector(\n '[type=\"hint\"]'\n ) as Overlay;\n this.auto = this.fixture.querySelector(\n '[type=\"auto\"]'\n ) as Overlay;\n this.manual = this.fixture.querySelector(\n '[type=\"manual\"]'\n ) as Overlay;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n afterEach(async function () {\n const closed = oneEvent(this.page, 'sp-closed');\n this.page.open = false;\n await closed;\n });\n it('should not close \"modal\" overlays when opening', async function () {\n let opened = oneEvent(this.modal, 'sp-opened');\n this.modal.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"hint\" overlays when opening', async function () {\n let opened = oneEvent(this.hint, 'sp-opened');\n this.hint.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.page, 'sp-opened');\n const closed = oneEvent(this.hint, 'sp-closed');\n this.page.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('closes \"auto\" overlays when opening', async function () {\n let opened = oneEvent(this.auto, 'sp-opened');\n this.auto.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.page, 'sp-opened');\n const closed = oneEvent(this.auto, 'sp-closed');\n this.page.open = true;\n await opened;\n await closed;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n it('does not close \"manual\" overlays when opening', async function () {\n let opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n\n opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n });\n it('ignores Escape key interactions', async () => {\n const el = await styledFixture<Overlay>(html`\n <sp-overlay type=\"page\">\n <sp-popover>This is a \"page\" Overlay</sp-popover>\n </sp-overlay>\n `);\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n\n await sendKeys({\n press: 'Escape',\n });\n\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n });\n });\n\n describe('[type=\"hint\"]', () => {\n opensDeclaratively('hint');\n\n it('closes other `[type=hint]` overlays when opening', async () => {\n const test = await styledFixture<Overlay>(html`\n <div>\n ${[1, 2].map(\n (overlay) => html`\n <sp-overlay type=\"hint\" class=\"hint-${overlay}\">\n <sp-tooltip>Hint ${overlay} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n const hint1 = test.querySelector('.hint-1') as Overlay;\n const hint2 = test.querySelector('.hint-2') as Overlay;\n\n expect(hint1.open).to.be.false;\n expect(hint2.open).to.be.false;\n\n let opened = oneEvent(hint1, 'sp-opened');\n hint1.open = true;\n await opened;\n\n expect(hint1.open).to.be.true;\n expect(hint2.open).to.be.false;\n\n opened = oneEvent(hint2, 'sp-opened');\n let closed = oneEvent(hint1, 'sp-closed');\n hint2.open = true;\n await opened;\n await closed;\n\n expect(hint1.open).to.be.false;\n expect(hint2.open).to.be.true;\n\n opened = oneEvent(hint1, 'sp-opened');\n closed = oneEvent(hint2, 'sp-closed');\n hint1.open = true;\n await opened;\n await closed;\n\n expect(hint1.open).to.be.true;\n expect(hint2.open).to.be.false;\n });\n it('stays open when pointer enters overlay from trigger element', async () => {\n const test = await styledFixture(html`\n <div>\n <sp-button id=\"test-button\">This is a button.</sp-button>\n <sp-overlay\n trigger=\"test-button@hover\"\n type=\"hint\"\n placement=\"bottom\"\n offset=\"-10\"\n >\n <sp-tooltip>Help text.</sp-tooltip>\n </sp-overlay>\n </div>\n `);\n\n const button = test.querySelector('sp-button') as Button;\n const overlay = test.querySelector(\n 'sp-overlay'\n ) as unknown as Overlay;\n const el = test.querySelector('sp-tooltip') as Tooltip;\n const buttonRect = button.getBoundingClientRect();\n const buttonPoint = [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height - 2,\n ] as [number, number];\n\n await elementUpdated(overlay);\n\n // This test is possibly weird in its over simplicity for this contexts...\n await expect(button).to.be.accessible();\n // Pointer enter the button to trigger the tooltip\n let opened = oneEvent(button, 'sp-opened');\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n await elementUpdated(overlay);\n // Allow the overlay process time to get started (we're not waiting for it to finish),\n // so that the next step can happen _while_ it opens.\n await nextFrame();\n await nextFrame();\n expect(overlay.open).to.be.true;\n // Pointer leave the button to close the tooltip, but...\n // Pointer enter the tooltip to keep the tooltip open\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height - 1,\n ],\n },\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height,\n ],\n },\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height + 1,\n ],\n },\n ],\n });\n // Give the Overlay some time to process what just happened.\n await nextFrame();\n await nextFrame();\n expect(overlay.open).to.be.true;\n await opened;\n\n expect(el.open).to.be.true;\n await expect(button).to.be.accessible();\n\n let closed = oneEvent(button, 'sp-closed');\n // point enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n // pointer leave the button to close the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n\n expect(el.open).to.be.false;\n\n opened = oneEvent(button, 'sp-opened');\n // pointer enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n await opened;\n await elementUpdated(el);\n closed = oneEvent(button, 'sp-closed');\n // pointer leave the button to close the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n });\n it('stays open when pointer enters overlay from trigger element: self managed', async () => {\n const button = await styledFixture(html`\n <sp-button>\n This is a button.\n <sp-tooltip self-managed placement=\"bottom\">\n Help text.\n </sp-tooltip>\n </sp-button>\n `);\n\n const el = button.querySelector('sp-tooltip') as Tooltip;\n const buttonRect = button.getBoundingClientRect();\n const buttonPoint = [\n buttonRect.x + buttonRect.width / 2,\n buttonRect.y + buttonRect.height / 2,\n ] as [number, number];\n\n await elementUpdated(el);\n // This test is possibly weird in its over simplicity for this contexts...\n await expect(button).to.be.accessible();\n // Pointer enter the button to trigger the tooltip\n let opened = oneEvent(button, 'sp-opened');\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n // It takes this many frame for the overlay content to actual be queryable.\n // We're trying to do work _before_ `sp-opened` so it's a little tricky.\n // Is it possible to do this work _after_ `sp-opened` for more stability?\n // Try futzing with the `offset` values of the `sp-overlay`?\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n const tooltipRect = (\n el.shadowRoot.querySelector('#tooltip') as HTMLDivElement\n ).getBoundingClientRect();\n const tooltipPoint = [\n tooltipRect.x + tooltipRect.width / 2,\n tooltipRect.y + tooltipRect.height / 2,\n ] as [number, number];\n // Pointer leave the button to close the tooltip, but...\n // Pointer enter the tooltip to keep the tooltip open\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: tooltipPoint,\n },\n ],\n });\n await opened;\n\n expect(el.open).to.be.true;\n await expect(button).to.be.accessible();\n\n let closed = oneEvent(button, 'sp-closed');\n // point enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n // pointer leave the button to close the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n\n expect(el.open).to.be.false;\n\n opened = oneEvent(button, 'sp-opened');\n // pointer enter the button to trigger the tooltip\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: buttonPoint,\n },\n ],\n });\n await opened;\n expect(el.open).to.be.true;\n\n closed = oneEvent(button, 'sp-closed');\n // pointer leave the button to close the tooltip\n sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n buttonRect.x + buttonRect.width * 2,\n buttonRect.y + buttonRect.height * 2,\n ] as [number, number],\n },\n ],\n });\n await closed;\n expect(el.open).to.be.false;\n });\n });\n describe('[type=\"auto\"]', () => {\n opensDeclaratively('auto');\n it('receives focus', async () => {\n const test = await fixture(html`\n <div>${receivesFocus(receivesFocus.args)}</div>\n `);\n const trigger = test.querySelector('#trigger') as Button;\n const overlay = test.querySelector('a');\n\n expect(document.activeElement === overlay).to.be.false;\n\n const opened = oneEvent(trigger, 'sp-opened');\n trigger.click();\n await opened;\n\n expect(document.activeElement === overlay).to.be.true;\n });\n it('does not close when clicking a Slider track in the Overlay', async function () {\n const test = await fixture(html`\n <div>${withSlider()}</div>\n `);\n const el = test.querySelector('sp-overlay') as Overlay;\n const button = test.querySelector('sp-button') as Button;\n const slider = el.querySelector('sp-slider') as Slider;\n const track = slider.shadowRoot.querySelector(\n '#track'\n ) as HTMLDivElement;\n\n expect(el.open).to.be.false;\n\n const opened = oneEvent(el, 'sp-opened');\n const buttonRect = button.getBoundingClientRect();\n sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n buttonRect.left + buttonRect.width / 2,\n buttonRect.top + buttonRect.height / 2,\n ],\n },\n ],\n });\n await opened;\n\n expect(el.open).to.be.true;\n expect(slider.value).to.equal(5);\n\n const sliderRect = track.getBoundingClientRect();\n\n let pointerId = -1;\n slider.track.setPointerCapture = (id: number) => (pointerId = id);\n slider.track.releasePointerCapture = (id: number) =>\n (pointerId = id);\n expect(pointerId).to.equal(-1);\n track.dispatchEvent(\n new PointerEvent('pointerdown', {\n clientX: sliderRect.left + sliderRect.width - 5,\n clientY: sliderRect.top + sliderRect.height / 2,\n pointerId: 1,\n cancelable: true,\n bubbles: true,\n composed: true,\n button: 0,\n })\n );\n await elementUpdated(slider);\n\n track.dispatchEvent(\n new PointerEvent('pointerup', {\n pointerId: 1,\n cancelable: true,\n bubbles: true,\n composed: true,\n })\n );\n await elementUpdated(slider);\n\n await aTimeout(1500);\n\n expect(slider.value).to.equal(19.5);\n expect(el.open).to.be.true;\n });\n });\n describe('[type=\"manual\"]', () => {\n opensDeclaratively('manual');\n describe('interaction with other non-ancestor overlays', function () {\n beforeEach(async function () {\n this.fixture = await styledFixture<Overlay>(html`\n <div>\n ${OVERLAY_TYPES.map(\n (type) => html`\n <sp-overlay type=${type}>\n <sp-tooltip>${type} Content</sp-tooltip>\n </sp-overlay>\n `\n )}\n </div>\n `);\n\n this.modal = this.fixture.querySelector(\n '[type=\"modal\"]'\n ) as Overlay;\n this.page = this.fixture.querySelector(\n '[type=\"page\"]'\n ) as Overlay;\n this.hint = this.fixture.querySelector(\n '[type=\"hint\"]'\n ) as Overlay;\n this.auto = this.fixture.querySelector(\n '[type=\"auto\"]'\n ) as Overlay;\n this.manual = this.fixture.querySelector(\n '[type=\"manual\"]'\n ) as Overlay;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n });\n afterEach(async function () {\n const closed = oneEvent(this.manual, 'sp-closed');\n this.manual.open = false;\n await closed;\n });\n it('does not close \"modal\" overlays when opening', async function () {\n let opened = oneEvent(this.modal, 'sp-opened');\n this.modal.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.true;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n it('does not close \"modal\" overlays when opening', async function () {\n let opened = oneEvent(this.page, 'sp-opened');\n this.page.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.true;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n it('does not close \"hint\" overlays when opening', async function () {\n let opened = oneEvent(this.hint, 'sp-opened');\n this.hint.open = true;\n await opened;\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.true;\n expect(this.auto.open).to.be.false;\n expect(this.manual.open).to.be.true;\n });\n it('does not close \"auto\" overlays when opening', async function () {\n let opened = oneEvent(this.auto, 'sp-opened');\n this.auto.open = true;\n await opened;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.false;\n\n opened = oneEvent(this.manual, 'sp-opened');\n this.manual.open = true;\n await opened;\n\n expect(this.modal.open).to.be.false;\n expect(this.page.open).to.be.false;\n expect(this.hint.open).to.be.false;\n expect(this.auto.open).to.be.true;\n expect(this.manual.open).to.be.true;\n });\n });\n describe('only close when manually closed', function () {\n it('does not close when clicking away', async () => {\n const test = await fixture(html`\n <div>\n ${click({\n ...click.args,\n interaction: 'click',\n placement: 'bottom',\n type: 'manual',\n delayed: false,\n receivesFocus: 'auto',\n })}\n </div>\n `);\n const el = test.querySelector('sp-overlay') as Overlay;\n\n expect(el.open).to.be.false;\n\n const opened = oneEvent<OverlayStateEvent>(el, 'sp-opened');\n el.open = true;\n let { overlay } = await opened;\n expect(el === overlay).to.be.true;\n\n await sendMouse({\n steps: [\n {\n type: 'click',\n position: [50, 400],\n },\n ],\n });\n\n await aTimeout(200);\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent<OverlayStateEvent>(el, 'sp-closed');\n el.open = false;\n ({ overlay } = await closed);\n expect(el === overlay).to.be.true;\n\n expect(el.open).to.be.false;\n });\n it('does not close when pressing `Escape`', async () => {\n const test = await fixture(html`\n <div>\n ${click({\n ...click.args,\n interaction: 'click',\n placement: 'bottom',\n type: 'manual',\n delayed: false,\n receivesFocus: 'auto',\n })}\n </div>\n `);\n const el = test.querySelector('sp-overlay') as Overlay;\n\n expect(el.open).to.be.false;\n\n const opened = oneEvent<OverlayStateEvent>(el, 'sp-opened');\n el.open = true;\n let { overlay } = await opened;\n expect(el === overlay).to.be.true;\n\n await sendKeys({\n press: 'Escape',\n });\n\n await aTimeout(200);\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent<OverlayStateEvent>(el, 'sp-closed');\n el.open = false;\n ({ overlay } = await closed);\n expect(el === overlay).to.be.true;\n\n expect(el.open).to.be.false;\n });\n });\n });\n});\n"],
5
+ "mappings": ";AAWA;AAAA,EACI;AAAA,EACA;AAAA,EAC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AS,SAA4B,IAAI,WAAW;AAC1D,WAAG,OAAO;AACV,YAAI,EAAE,QAAQ,IAAI,MAAM;AACxB,eAAO,OAAO,OAAO,EAAE,GAAG,GAAG;AAE7B,cAAM,SAAS;AAAA,UACX,OAAO;AAAA,QACX,CAAC;AAED,cAAM,SAAS,GAAG;AAElB,eAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAEtB,cAAM,SAAS,SAA4B,IAAI,WAAW;AAC1D,WAAG,OAAO;AACV,SAAC,EAAE,QAAQ,IAAI,MAAM;AACrB,eAAO,OAAO,OAAO,EAAE,GAAG,GAAG;AAE7B,eAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAAA,MAC1B,CAAC;AAAA,IACL,CAAC;AAAA,EACL,CAAC;AACL,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ import {
3
+ elementUpdated,
4
+ expect,
5
+ fixture,
6
+ html,
7
+ nextFrame,
8
+ oneEvent,
9
+ waitUntil
10
+ } from "@open-wc/testing";
11
+ import "@spectrum-web-components/tooltip/sp-tooltip.js";
12
+ import "@spectrum-web-components/action-button/sp-action-button.js";
13
+ import "@spectrum-web-components/overlay/overlay-trigger.js";
14
+ import {
15
+ a11ySnapshot,
16
+ findAccessibilityNode,
17
+ sendKeys
18
+ } from "@web/test-runner-commands";
19
+ describe("Overlay Trigger - accessible hover content management", () => {
20
+ it("accessibly describes trigger content with hover content", async () => {
21
+ const el = await fixture(html`
22
+ <overlay-trigger placement="right-start">
23
+ <sp-action-button slot="trigger">
24
+ Button with Tooltip
25
+ </sp-action-button>
26
+ <sp-tooltip slot="hover-content">
27
+ Described by this content on focus/hover. 1
28
+ </sp-tooltip>
29
+ </overlay-trigger>
30
+ `);
31
+ await elementUpdated(el);
32
+ expect(el.open).to.be.undefined;
33
+ const snapshot = await a11ySnapshot(
34
+ {}
35
+ );
36
+ expect(
37
+ findAccessibilityNode(
38
+ snapshot,
39
+ (node) => node.name === "Button with Tooltip" && typeof node.description === "undefined"
40
+ ),
41
+ "`name`ed with no `description`"
42
+ );
43
+ });
44
+ it("gardens `aria-describedby` in its target", async () => {
45
+ const el = await fixture(html`
46
+ <overlay-trigger placement="right-start">
47
+ <sp-action-button slot="trigger" aria-describedby="descriptor">
48
+ Button with Tooltip
49
+ </sp-action-button>
50
+ <sp-tooltip slot="hover-content" delayed>
51
+ Described by this content on focus/hover. 2
52
+ </sp-tooltip>
53
+ </overlay-trigger>
54
+ <div id="descriptor">I'm a description!</div>
55
+ `);
56
+ const trigger = el.querySelector('[slot="trigger"]');
57
+ const tooltip = el.querySelector(
58
+ '[slot="hover-content"]'
59
+ );
60
+ await elementUpdated(el);
61
+ await nextFrame();
62
+ await nextFrame();
63
+ await waitUntil(
64
+ () => tooltip.id,
65
+ "Tooltip never published an ID for itself"
66
+ );
67
+ expect(trigger.getAttribute("aria-describedby")).to.equal(
68
+ `descriptor ${tooltip.id}`
69
+ );
70
+ trigger.remove();
71
+ await nextFrame();
72
+ expect(trigger.getAttribute("aria-describedby")).to.equal("descriptor");
73
+ });
74
+ it("applies `aria-describedby` attribute", async () => {
75
+ const el = await fixture(html`
76
+ <overlay-trigger placement="right-start">
77
+ <sp-action-button slot="trigger">
78
+ Button with Tooltip
79
+ </sp-action-button>
80
+ <sp-tooltip slot="hover-content" delayed>
81
+ Described by this content on focus/hover. 2
82
+ </sp-tooltip>
83
+ </overlay-trigger>
84
+ `);
85
+ const trigger = el.querySelector('[slot="trigger"]');
86
+ const tooltip = el.querySelector(
87
+ '[slot="hover-content"]'
88
+ );
89
+ await elementUpdated(el);
90
+ await nextFrame();
91
+ await nextFrame();
92
+ await waitUntil(
93
+ () => tooltip.id,
94
+ "Tooltip never published an ID for itself"
95
+ );
96
+ expect(trigger.getAttribute("aria-describedby")).to.equal(tooltip.id);
97
+ trigger.remove();
98
+ await nextFrame();
99
+ expect(trigger.getAttribute("aria-describedby")).to.be.null;
100
+ });
101
+ it("does not duplicate `aria-describedby` attribute", async () => {
102
+ const el = await fixture(html`
103
+ <div>
104
+ <sp-action-button slot="trigger">
105
+ Button with Tooltip
106
+ </sp-action-button>
107
+ <overlay-trigger placement="right-start">
108
+ <sp-tooltip slot="hover-content" delayed>
109
+ Described by this content on focus/hover. 2
110
+ </sp-tooltip>
111
+ </overlay-trigger>
112
+ </div>
113
+ `);
114
+ const trigger = el.querySelector('[slot="trigger"]');
115
+ const tooltip = el.querySelector("sp-tooltip");
116
+ const overlay = el.querySelector("overlay-trigger");
117
+ trigger.setAttribute("aria-describedby", tooltip.id);
118
+ overlay.append(trigger);
119
+ await elementUpdated(el);
120
+ expect(trigger.getAttribute("aria-describedby")).to.equal(tooltip.id);
121
+ expect(el.open).to.be.undefined;
122
+ const input = document.createElement("input");
123
+ el.insertAdjacentElement("afterbegin", input);
124
+ input.focus();
125
+ const opened = oneEvent(el, "sp-opened");
126
+ await sendKeys({
127
+ press: "Tab"
128
+ });
129
+ await opened;
130
+ expect(trigger.getAttribute("aria-describedby")).to.equal(tooltip.id);
131
+ const closed = oneEvent(el, "sp-closed");
132
+ trigger.dispatchEvent(
133
+ new FocusEvent("focusout", { bubbles: true, composed: true })
134
+ );
135
+ await closed;
136
+ expect(trigger.getAttribute("aria-describedby")).to.equal(tooltip.id);
137
+ });
138
+ });
139
+ //# sourceMappingURL=overlay-lifecycle.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["overlay-lifecycle.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 elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n oneEvent,\n waitUntil,\n} from '@open-wc/testing';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { OverlayTrigger } from '@spectrum-web-components/overlay';\nimport '@spectrum-web-components/overlay/overlay-trigger.js';\nimport {\n a11ySnapshot,\n findAccessibilityNode,\n sendKeys,\n} from '@web/test-runner-commands';\nimport { Tooltip } from '@spectrum-web-components/tooltip';\n\ndescribe('Overlay Trigger - accessible hover content management', () => {\n it('accessibly describes trigger content with hover content', async () => {\n const el = await fixture<OverlayTrigger>(html`\n <overlay-trigger placement=\"right-start\">\n <sp-action-button slot=\"trigger\">\n Button with Tooltip\n </sp-action-button>\n <sp-tooltip slot=\"hover-content\">\n Described by this content on focus/hover. 1\n </sp-tooltip>\n </overlay-trigger>\n `);\n\n await elementUpdated(el);\n\n expect(el.open).to.be.undefined;\n type DescribedNode = {\n name: string;\n description: string;\n };\n const snapshot = (await a11ySnapshot(\n {}\n )) as unknown as DescribedNode & {\n children: DescribedNode[];\n };\n expect(\n findAccessibilityNode<DescribedNode>(\n snapshot,\n (node) =>\n node.name === 'Button with Tooltip' &&\n typeof node.description === 'undefined'\n ),\n '`name`ed with no `description`'\n );\n });\n it('gardens `aria-describedby` in its target', async () => {\n const el = await fixture<OverlayTrigger>(html`\n <overlay-trigger placement=\"right-start\">\n <sp-action-button slot=\"trigger\" aria-describedby=\"descriptor\">\n Button with Tooltip\n </sp-action-button>\n <sp-tooltip slot=\"hover-content\" delayed>\n Described by this content on focus/hover. 2\n </sp-tooltip>\n </overlay-trigger>\n <div id=\"descriptor\">I'm a description!</div>\n `);\n\n const trigger = el.querySelector('[slot=\"trigger\"]') as HTMLElement;\n const tooltip = el.querySelector(\n '[slot=\"hover-content\"]'\n ) as HTMLElement;\n\n await elementUpdated(el);\n await nextFrame();\n await nextFrame();\n\n await waitUntil(\n () => tooltip.id,\n 'Tooltip never published an ID for itself'\n );\n\n expect(trigger.getAttribute('aria-describedby')).to.equal(\n `descriptor ${tooltip.id}`\n );\n\n trigger.remove();\n\n // slot change timing\n await nextFrame();\n\n expect(trigger.getAttribute('aria-describedby')).to.equal('descriptor');\n });\n it('applies `aria-describedby` attribute', async () => {\n const el = await fixture<OverlayTrigger>(html`\n <overlay-trigger placement=\"right-start\">\n <sp-action-button slot=\"trigger\">\n Button with Tooltip\n </sp-action-button>\n <sp-tooltip slot=\"hover-content\" delayed>\n Described by this content on focus/hover. 2\n </sp-tooltip>\n </overlay-trigger>\n `);\n\n const trigger = el.querySelector('[slot=\"trigger\"]') as HTMLElement;\n const tooltip = el.querySelector(\n '[slot=\"hover-content\"]'\n ) as HTMLElement;\n\n await elementUpdated(el);\n await nextFrame();\n await nextFrame();\n\n await waitUntil(\n () => tooltip.id,\n 'Tooltip never published an ID for itself'\n );\n\n expect(trigger.getAttribute('aria-describedby')).to.equal(tooltip.id);\n\n trigger.remove();\n\n // slot change timing\n await nextFrame();\n\n expect(trigger.getAttribute('aria-describedby')).to.be.null;\n });\n it('does not duplicate `aria-describedby` attribute', async () => {\n const el = await fixture<OverlayTrigger>(html`\n <div>\n <sp-action-button slot=\"trigger\">\n Button with Tooltip\n </sp-action-button>\n <overlay-trigger placement=\"right-start\">\n <sp-tooltip slot=\"hover-content\" delayed>\n Described by this content on focus/hover. 2\n </sp-tooltip>\n </overlay-trigger>\n </div>\n `);\n\n const trigger = el.querySelector('[slot=\"trigger\"]') as HTMLElement;\n const tooltip = el.querySelector('sp-tooltip') as Tooltip;\n const overlay = el.querySelector('overlay-trigger') as OverlayTrigger;\n\n trigger.setAttribute('aria-describedby', tooltip.id);\n overlay.append(trigger);\n\n await elementUpdated(el);\n expect(trigger.getAttribute('aria-describedby')).to.equal(tooltip.id);\n expect(el.open).to.be.undefined;\n\n // For `:focus-visible` heuristic.\n const input = document.createElement('input');\n el.insertAdjacentElement('afterbegin', input);\n input.focus();\n\n const opened = oneEvent(el, 'sp-opened');\n await sendKeys({\n press: 'Tab',\n });\n await opened;\n\n expect(trigger.getAttribute('aria-describedby')).to.equal(tooltip.id);\n\n const closed = oneEvent(el, 'sp-closed');\n trigger.dispatchEvent(\n new FocusEvent('focusout', { bubbles: true, composed: true })\n );\n await closed;\n\n expect(trigger.getAttribute('aria-describedby')).to.equal(tooltip.id);\n });\n});\n"],
5
+ "mappings": ";AAWA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,OAAO;AACP,OAAO;AAEP,OAAO;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAGP,SAAS,yDAAyD,MAAM;AACpE,KAAG,2DAA2D,YAAY;AACtE,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SASxC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAKtB,UAAM,WAAY,MAAM;AAAA,MACpB,CAAC;AAAA,IACL;AAGA;AAAA,MACI;AAAA,QACI;AAAA,QACA,CAAC,SACG,KAAK,SAAS,yBACd,OAAO,KAAK,gBAAgB;AAAA,MACpC;AAAA,MACA;AAAA,IACJ;AAAA,EACJ,CAAC;AACD,KAAG,4CAA4C,YAAY;AACvD,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAUxC;AAED,UAAM,UAAU,GAAG,cAAc,kBAAkB;AACnD,UAAM,UAAU,GAAG;AAAA,MACf;AAAA,IACJ;AAEA,UAAM,eAAe,EAAE;AACvB,UAAM,UAAU;AAChB,UAAM,UAAU;AAEhB,UAAM;AAAA,MACF,MAAM,QAAQ;AAAA,MACd;AAAA,IACJ;AAEA,WAAO,QAAQ,aAAa,kBAAkB,CAAC,EAAE,GAAG;AAAA,MAChD,cAAc,QAAQ,EAAE;AAAA,IAC5B;AAEA,YAAQ,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AA,IACX,CAAC;AACD,UAAM;AAEN,WAAO,QAAQ,aAAa,kBAAkB,CAAC,EAAE,GAAG,MAAM,QAAQ,EAAE;AAEpE,UAAM,SAAS,SAAS,IAAI,WAAW;AACvC,YAAQ;AAAA,MACJ,IAAI,WAAW,YAAY,EAAE,SAAS,MAAM,UAAU,KAAK,CAAC;AAAA,IAChE;AACA,UAAM;AAEN,WAAO,QAAQ,aAAa,kBAAkB,CAAC,EAAE,GAAG,MAAM,QAAQ,EAAE;AAAA,EACxE,CAAC;AACL,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ import { Default } from "../stories/overlay.stories.js";
3
+ import { testForMemoryLeaks } from "../../../test/testing-helpers.js";
4
+ testForMemoryLeaks(
5
+ Default({
6
+ placement: "bottom",
7
+ offset: 0
8
+ })
9
+ );
10
+ //# sourceMappingURL=overlay-memory.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["overlay-memory.test.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Default } from '../stories/overlay.stories.js';\nimport { testForMemoryLeaks } from '../../../test/testing-helpers.js';\n\n// Defualt Overlay\ntestForMemoryLeaks(\n Default({\n placement: 'bottom',\n offset: 0,\n })\n);\n"],
5
+ "mappings": ";AAWA,SAAS,eAAe;AACxB,SAAS,0BAA0B;AAGnC;AAAA,EACI,QAAQ;AAAA,IACJ,WAAW;AAAA,IACX,QAAQ;AAAA,EACZ,CAAC;AACL;",
6
+ "names": []
7
+ }
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ import { useFakeTimers } from "sinon";
3
+ import { OverlayTimer } from "@spectrum-web-components/overlay/src/overlay-timer.js";
4
+ import { expect } from "@open-wc/testing";
5
+ describe("Overlays timer", () => {
6
+ let clock;
7
+ beforeEach(() => {
8
+ clock = useFakeTimers();
9
+ });
10
+ afterEach(() => {
11
+ clock.restore();
12
+ });
13
+ it("should resolve after warmup", async () => {
14
+ const timer = new OverlayTimer({
15
+ warmUpDelay: 500,
16
+ coolDownDelay: 500
17
+ });
18
+ const element = document.createElement("div");
19
+ const promise = timer.openTimer(element);
20
+ clock.next();
21
+ expect(clock.now).to.equal(500);
22
+ const cancelled = await promise;
23
+ expect(cancelled).to.be.false;
24
+ });
25
+ it("should resolve true when cancelled", async () => {
26
+ const timer = new OverlayTimer({
27
+ warmUpDelay: 500,
28
+ coolDownDelay: 500
29
+ });
30
+ const element = document.createElement("div");
31
+ const promise = timer.openTimer(element);
32
+ clock.tick(10);
33
+ timer.close(element);
34
+ clock.next();
35
+ const cancelled = await promise;
36
+ expect(cancelled).to.be.true;
37
+ });
38
+ it("should resolve cancelled when opening new overlay", async () => {
39
+ const timer = new OverlayTimer({
40
+ warmUpDelay: 500,
41
+ coolDownDelay: 500
42
+ });
43
+ const element1 = document.createElement("div");
44
+ const element2 = document.createElement("div");
45
+ const promise1 = timer.openTimer(element1);
46
+ clock.tick(10);
47
+ const promise2 = timer.openTimer(element2);
48
+ clock.tick(10);
49
+ let cancelled = await promise1;
50
+ expect(cancelled).to.be.true;
51
+ clock.next();
52
+ cancelled = await promise2;
53
+ expect(cancelled).to.be.false;
54
+ expect(clock.now).to.equal(510);
55
+ });
56
+ it("should cooldown after closing overlay", async () => {
57
+ const timer = new OverlayTimer({
58
+ warmUpDelay: 500,
59
+ coolDownDelay: 500
60
+ });
61
+ const element = document.createElement("div");
62
+ let promise = timer.openTimer(element);
63
+ clock.next();
64
+ timer.close(element);
65
+ clock.next();
66
+ expect(clock.now).to.equal(1e3);
67
+ promise = timer.openTimer(element);
68
+ clock.next();
69
+ const cancelled = await promise;
70
+ expect(cancelled).to.be.false;
71
+ expect(clock.now).to.equal(1500);
72
+ });
73
+ it("should open overlay quickly when hot", async () => {
74
+ const timer = new OverlayTimer({
75
+ warmUpDelay: 500,
76
+ coolDownDelay: 500
77
+ });
78
+ const element = document.createElement("div");
79
+ let promise = timer.openTimer(element);
80
+ clock.next();
81
+ timer.close(element);
82
+ clock.tick(1);
83
+ promise = timer.openTimer(element);
84
+ clock.next();
85
+ const cancelled = await promise;
86
+ expect(cancelled).to.be.false;
87
+ expect(clock.now).to.equal(501);
88
+ });
89
+ it("should cooldown after opening and closing overlay multiple times", async () => {
90
+ const timer = new OverlayTimer({
91
+ warmUpDelay: 500,
92
+ coolDownDelay: 500
93
+ });
94
+ const element = document.createElement("div");
95
+ let promise = timer.openTimer(element);
96
+ clock.next();
97
+ expect(clock.now).to.equal(500);
98
+ timer.close(element);
99
+ clock.tick(1);
100
+ for (let i = 0; i < 10; i++) {
101
+ const element2 = document.createElement("div");
102
+ promise = timer.openTimer(element2);
103
+ clock.next();
104
+ const cancelled2 = await promise;
105
+ expect(cancelled2).to.be.false;
106
+ timer.close(element2);
107
+ clock.tick(1);
108
+ }
109
+ clock.next();
110
+ expect(clock.now).to.equal(1010);
111
+ promise = timer.openTimer(element);
112
+ clock.next();
113
+ const cancelled = await promise;
114
+ expect(cancelled).to.be.false;
115
+ expect(clock.now).to.equal(1510);
116
+ });
117
+ });
118
+ //# sourceMappingURL=overlay-timer.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["overlay-timer.test.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { SinonFakeTimers, useFakeTimers } from 'sinon';\nimport { OverlayTimer } from '@spectrum-web-components/overlay/src/overlay-timer.js';\nimport { expect } from '@open-wc/testing';\n\ndescribe('Overlays timer', () => {\n let clock: SinonFakeTimers;\n\n beforeEach(() => {\n clock = useFakeTimers();\n });\n\n afterEach(() => {\n clock.restore();\n });\n\n it('should resolve after warmup', async () => {\n const timer = new OverlayTimer({\n warmUpDelay: 500,\n coolDownDelay: 500,\n });\n const element = document.createElement('div');\n const promise = timer.openTimer(element);\n clock.next();\n expect(clock.now).to.equal(500);\n const cancelled = await promise;\n expect(cancelled).to.be.false;\n });\n\n it('should resolve true when cancelled', async () => {\n const timer = new OverlayTimer({\n warmUpDelay: 500,\n coolDownDelay: 500,\n });\n const element = document.createElement('div');\n const promise = timer.openTimer(element);\n clock.tick(10);\n timer.close(element);\n clock.next();\n const cancelled = await promise;\n expect(cancelled).to.be.true;\n });\n\n it('should resolve cancelled when opening new overlay', async () => {\n const timer = new OverlayTimer({\n warmUpDelay: 500,\n coolDownDelay: 500,\n });\n const element1 = document.createElement('div');\n const element2 = document.createElement('div');\n const promise1 = timer.openTimer(element1);\n clock.tick(10);\n const promise2 = timer.openTimer(element2);\n clock.tick(10);\n let cancelled = await promise1;\n expect(cancelled).to.be.true;\n clock.next();\n cancelled = await promise2;\n expect(cancelled).to.be.false;\n expect(clock.now).to.equal(510);\n });\n\n it('should cooldown after closing overlay', async () => {\n const timer = new OverlayTimer({\n warmUpDelay: 500,\n coolDownDelay: 500,\n });\n const element = document.createElement('div');\n let promise = timer.openTimer(element);\n clock.next();\n timer.close(element);\n clock.next();\n expect(clock.now).to.equal(1000);\n promise = timer.openTimer(element);\n clock.next();\n const cancelled = await promise;\n expect(cancelled).to.be.false;\n expect(clock.now).to.equal(1500);\n });\n\n it('should open overlay quickly when hot', async () => {\n const timer = new OverlayTimer({\n warmUpDelay: 500,\n coolDownDelay: 500,\n });\n const element = document.createElement('div');\n let promise = timer.openTimer(element);\n clock.next();\n timer.close(element);\n clock.tick(1);\n promise = timer.openTimer(element);\n clock.next();\n const cancelled = await promise;\n expect(cancelled).to.be.false;\n expect(clock.now).to.equal(501);\n });\n\n it('should cooldown after opening and closing overlay multiple times', async () => {\n const timer = new OverlayTimer({\n warmUpDelay: 500,\n coolDownDelay: 500,\n });\n const element = document.createElement('div');\n let promise = timer.openTimer(element);\n clock.next();\n expect(clock.now).to.equal(500);\n timer.close(element);\n clock.tick(1);\n\n for (let i = 0; i < 10; i++) {\n const element = document.createElement('div');\n promise = timer.openTimer(element);\n clock.next();\n const cancelled = await promise;\n expect(cancelled).to.be.false;\n timer.close(element);\n clock.tick(1);\n }\n\n // Wait for cooldown\n clock.next();\n expect(clock.now).to.equal(1010);\n promise = timer.openTimer(element);\n clock.next();\n const cancelled = await promise;\n expect(cancelled).to.be.false;\n expect(clock.now).to.equal(1510);\n });\n});\n"],
5
+ "mappings": ";AAYA,SAA0B,qBAAqB;AAC/C,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,SAAS,kBAAkB,MAAM;AAC7B,MAAI;AAEJ,aAAW,MAAM;AACb,YAAQ,cAAc;AAAA,EAC1B,CAAC;AAED,YAAU,MAAM;AACZ,UAAM,QAAQ;AAAA,EAClB,CAAC;AAED,KAAG,+BAA+B,YAAY;AAC1C,UAAM,QAAQ,IAAI,aAAa;AAAA,MAC3B,aAAa;AAAA,MACb,eAAe;AAAA,IACnB,CAAC;AACD,UAAM,UAAU,SAAS,cAAc,KAAK;AAC5C,UAAM,UAAU,MAAM,UAAU,OAAO;AACvC,UAAM,KAAK;AACX,WAAO,MAAM,GAAG,EAAE,GAAG,MAAM,GAAG;AAC9B,UAAM,YAAY,MAAM;AACxB,WAAO,SAAS,EAAE,GAAG,GAAG;AAAA,EAC5B,CAAC;AAED,KAAG,sCAAsC,YAAY;AACjD,UAAM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