@spectrum-web-components/dialog 0.11.0-devmode.0 → 0.11.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 +2 -0
- package/package.json +10 -10
- package/sp-dialog-wrapper.js +1 -2
- package/sp-dialog-wrapper.js.map +1 -1
- package/sp-dialog.js +1 -2
- package/sp-dialog.js.map +1 -1
- package/src/Dialog.js +15 -205
- package/src/Dialog.js.map +1 -1
- package/src/DialogWrapper.d.ts +3 -0
- package/src/DialogWrapper.dev.js.map +2 -2
- package/src/DialogWrapper.js +20 -214
- package/src/DialogWrapper.js.map +2 -2
- package/src/dialog.css.js +2 -4
- package/src/dialog.css.js.map +1 -1
- package/src/index.js +1 -2
- package/src/index.js.map +1 -1
- package/src/spectrum-dialog.css.js +2 -4
- package/src/spectrum-dialog.css.js.map +1 -1
- package/stories/dialog-wrapper.stories.js +56 -165
- package/stories/dialog-wrapper.stories.js.map +2 -2
- package/stories/dialog.stories.js +14 -60
- package/stories/dialog.stories.js.map +1 -1
- package/stories/images.js +1 -2
- package/stories/images.js.map +1 -1
- package/test/benchmark/basic-test.js +1 -4
- package/test/benchmark/basic-test.js.map +1 -1
- package/test/dialog-wrapper.test-vrt.js +1 -3
- package/test/dialog-wrapper.test-vrt.js.map +1 -1
- package/test/dialog-wrapper.test.js +3 -164
- package/test/dialog-wrapper.test.js.map +1 -1
- package/test/dialog.test-vrt.js +1 -3
- package/test/dialog.test-vrt.js.map +1 -1
- package/test/dialog.test.js +13 -136
- package/test/dialog.test.js.map +1 -1
|
@@ -1,167 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
elementUpdated,
|
|
3
|
-
expect,
|
|
4
|
-
fixture,
|
|
5
|
-
nextFrame,
|
|
6
|
-
oneEvent
|
|
7
|
-
} from "@open-wc/testing";
|
|
8
|
-
import { spy } from "sinon";
|
|
9
|
-
import "@spectrum-web-components/theme/sp-theme.js";
|
|
10
|
-
import "@spectrum-web-components/theme/src/themes.js";
|
|
11
|
-
import "@spectrum-web-components/dialog/sp-dialog-wrapper.js";
|
|
12
|
-
import {
|
|
13
|
-
longContent,
|
|
14
|
-
wrapperButtons,
|
|
15
|
-
wrapperButtonsUnderlay,
|
|
16
|
-
wrapperDismissable,
|
|
17
|
-
wrapperDismissableUnderlayError,
|
|
18
|
-
wrapperFullscreen,
|
|
19
|
-
wrapperLabeledHero
|
|
20
|
-
} from "../stories/dialog-wrapper.stories.js";
|
|
21
|
-
import { html } from "@spectrum-web-components/base";
|
|
22
|
-
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
23
|
-
async function styledFixture(story) {
|
|
24
|
-
const test = await fixture(html`
|
|
1
|
+
import{elementUpdated as o,expect as t,fixture as f,nextFrame as h,oneEvent as p}from"@open-wc/testing";import{spy as r}from"sinon";import"@spectrum-web-components/theme/sp-theme.js";import"@spectrum-web-components/theme/src/themes.js";import"@spectrum-web-components/dialog/sp-dialog-wrapper.js";import{longContent as v,wrapperButtons as u,wrapperButtonsUnderlay as m,wrapperDismissable as d,wrapperDismissableUnderlayError as D,wrapperFullscreen as R,wrapperLabeledHero as E}from"../stories/dialog-wrapper.stories.js";import{html as S}from"@spectrum-web-components/base";import{testForLitDevWarnings as q}from"../../../test/testing-helpers.js";async function n(e){return(await f(S`
|
|
25
2
|
<sp-theme theme="classic" scale="medium" color="dark">
|
|
26
|
-
${
|
|
3
|
+
${e}
|
|
27
4
|
</sp-theme>
|
|
28
|
-
`);
|
|
29
|
-
return test.children[0];
|
|
30
|
-
}
|
|
31
|
-
describe("Dialog Wrapper", () => {
|
|
32
|
-
testForLitDevWarnings(async () => await styledFixture(wrapperDismissable()));
|
|
33
|
-
it("loads wrapped dialog accessibly", async () => {
|
|
34
|
-
const el = await styledFixture(wrapperDismissable());
|
|
35
|
-
await elementUpdated(el);
|
|
36
|
-
await expect(el).to.be.accessible();
|
|
37
|
-
});
|
|
38
|
-
it("loads labeled hero dialog accessibly", async () => {
|
|
39
|
-
const el = await styledFixture(wrapperLabeledHero());
|
|
40
|
-
await elementUpdated(el);
|
|
41
|
-
await expect(el).to.be.accessible();
|
|
42
|
-
});
|
|
43
|
-
it("loads fullscreen wrapped dialog accessibly", async () => {
|
|
44
|
-
const el = await styledFixture(wrapperFullscreen());
|
|
45
|
-
await elementUpdated(el);
|
|
46
|
-
await expect(el).to.be.accessible();
|
|
47
|
-
});
|
|
48
|
-
xit("loads with underlay and no headline accessibly", async () => {
|
|
49
|
-
const el = await styledFixture(wrapperButtonsUnderlay());
|
|
50
|
-
await elementUpdated(el);
|
|
51
|
-
el.headline = "";
|
|
52
|
-
await elementUpdated(el);
|
|
53
|
-
await expect(el).to.be.accessible();
|
|
54
|
-
});
|
|
55
|
-
it("opens and closes", async () => {
|
|
56
|
-
const closeSpy = spy();
|
|
57
|
-
const test = await styledFixture(longContent());
|
|
58
|
-
const el = test.querySelector("sp-dialog-wrapper");
|
|
59
|
-
el.addEventListener("close", () => closeSpy());
|
|
60
|
-
await elementUpdated(el);
|
|
61
|
-
const opened = oneEvent(test, "sp-opened");
|
|
62
|
-
test.open = "click";
|
|
63
|
-
await opened;
|
|
64
|
-
expect(el.open).to.be.true;
|
|
65
|
-
const closed = oneEvent(test, "sp-closed");
|
|
66
|
-
test.open = void 0;
|
|
67
|
-
await closed;
|
|
68
|
-
await nextFrame();
|
|
69
|
-
expect(el.open).to.be.false;
|
|
70
|
-
expect(closeSpy.callCount).to.equal(1);
|
|
71
|
-
});
|
|
72
|
-
it("dismisses via clicking the underlay when [dismissable]", async () => {
|
|
73
|
-
const test = await styledFixture(wrapperDismissableUnderlayError());
|
|
74
|
-
const el = test.querySelector("sp-dialog-wrapper");
|
|
75
|
-
await elementUpdated(el);
|
|
76
|
-
expect(el.open).to.be.true;
|
|
77
|
-
el.dismissable = true;
|
|
78
|
-
const underlay = el.shadowRoot.querySelector("sp-underlay");
|
|
79
|
-
underlay.click();
|
|
80
|
-
await elementUpdated(el);
|
|
81
|
-
expect(el.open).to.be.false;
|
|
82
|
-
});
|
|
83
|
-
it("does not dismiss via clicking the underlay :not([dismissable])", async () => {
|
|
84
|
-
const el = await styledFixture(wrapperButtonsUnderlay());
|
|
85
|
-
await elementUpdated(el);
|
|
86
|
-
expect(el.open).to.be.true;
|
|
87
|
-
const underlay = el.shadowRoot.querySelector("sp-underlay");
|
|
88
|
-
underlay.click();
|
|
89
|
-
await elementUpdated(el);
|
|
90
|
-
expect(el.open).to.be.true;
|
|
91
|
-
});
|
|
92
|
-
it("dismisses", async () => {
|
|
93
|
-
const el = await styledFixture(wrapperDismissable());
|
|
94
|
-
await elementUpdated(el);
|
|
95
|
-
expect(el.open).to.be.true;
|
|
96
|
-
const root = el.shadowRoot ? el.shadowRoot : el;
|
|
97
|
-
const dialog = root.querySelector("sp-dialog");
|
|
98
|
-
const dialogRoot = dialog.shadowRoot ? dialog.shadowRoot : dialog;
|
|
99
|
-
const dismissButton = dialogRoot.querySelector(".close-button");
|
|
100
|
-
dismissButton.click();
|
|
101
|
-
await elementUpdated(el);
|
|
102
|
-
expect(el.open).to.be.false;
|
|
103
|
-
});
|
|
104
|
-
it("manages entry focus - dismissable", async () => {
|
|
105
|
-
const el = await styledFixture(wrapperDismissable());
|
|
106
|
-
await elementUpdated(el);
|
|
107
|
-
expect(el.open).to.be.true;
|
|
108
|
-
expect(document.activeElement !== el, "no focused").to.be.true;
|
|
109
|
-
const dialog = el.shadowRoot.querySelector("sp-dialog");
|
|
110
|
-
const dialogRoot = dialog.shadowRoot ? dialog.shadowRoot : dialog;
|
|
111
|
-
const dismissButton = dialogRoot.querySelector(".close-button");
|
|
112
|
-
el.focus();
|
|
113
|
-
await elementUpdated(el);
|
|
114
|
-
expect(document.activeElement === el, `focused generally, ${document.activeElement}`).to.be.true;
|
|
115
|
-
expect(dismissButton.getRootNode().activeElement !== dismissButton, `does not focus specifically, ${dismissButton.getRootNode().activeElement}`).to.be.true;
|
|
116
|
-
dismissButton.click();
|
|
117
|
-
await elementUpdated(el);
|
|
118
|
-
expect(el.open).to.be.false;
|
|
119
|
-
});
|
|
120
|
-
it("manages entry focus - buttons", async () => {
|
|
121
|
-
var _a;
|
|
122
|
-
const el = await styledFixture(wrapperButtons());
|
|
123
|
-
await elementUpdated(el);
|
|
124
|
-
expect(el.open).to.be.true;
|
|
125
|
-
expect(document.activeElement !== el, "no focused").to.be.true;
|
|
126
|
-
const button = el.shadowRoot.querySelector("sp-button");
|
|
127
|
-
el.focus();
|
|
128
|
-
await elementUpdated(el);
|
|
129
|
-
expect(document.activeElement === el, `focused generally, ${document.activeElement}`).to.be.true;
|
|
130
|
-
expect(button.getRootNode().activeElement === button, `focused specifically, ${(_a = button.getRootNode().activeElement) == null ? void 0 : _a.outerHTML}`).to.be.true;
|
|
131
|
-
});
|
|
132
|
-
it("dispatches `confirm`, `cancel` and `secondary`", async () => {
|
|
133
|
-
const confirmSpy = spy();
|
|
134
|
-
const cancelSpy = spy();
|
|
135
|
-
const secondarySpy = spy();
|
|
136
|
-
const handleConfirm = () => confirmSpy();
|
|
137
|
-
const handleCancel = () => cancelSpy();
|
|
138
|
-
const handleSecondary = () => secondarySpy();
|
|
139
|
-
const el = await styledFixture(wrapperButtons());
|
|
140
|
-
el.addEventListener("confirm", handleConfirm);
|
|
141
|
-
el.addEventListener("cancel", handleCancel);
|
|
142
|
-
el.addEventListener("secondary", handleSecondary);
|
|
143
|
-
await elementUpdated(el);
|
|
144
|
-
expect(confirmSpy.called).to.be.false;
|
|
145
|
-
expect(cancelSpy.called).to.be.false;
|
|
146
|
-
expect(secondarySpy.called).to.be.false;
|
|
147
|
-
const accentButton = el.shadowRoot.querySelector('[variant="accent"]');
|
|
148
|
-
const primaryButton = el.shadowRoot.querySelector('[variant="primary"]');
|
|
149
|
-
const secondaryButton = el.shadowRoot.querySelector('[variant="secondary"]');
|
|
150
|
-
accentButton.click();
|
|
151
|
-
await elementUpdated(el);
|
|
152
|
-
expect(confirmSpy.called, "dispatched `confirm`").to.be.true;
|
|
153
|
-
expect(secondarySpy.called).to.be.false;
|
|
154
|
-
expect(cancelSpy.called).to.be.false;
|
|
155
|
-
primaryButton.click();
|
|
156
|
-
await elementUpdated(el);
|
|
157
|
-
expect(confirmSpy.callCount).to.equal(1);
|
|
158
|
-
expect(secondarySpy.called, "dispatched `cancel`").to.be.true;
|
|
159
|
-
expect(cancelSpy.called).to.be.false;
|
|
160
|
-
secondaryButton.click();
|
|
161
|
-
await elementUpdated(el);
|
|
162
|
-
expect(confirmSpy.callCount).to.equal(1);
|
|
163
|
-
expect(secondarySpy.callCount).to.equal(1);
|
|
164
|
-
expect(cancelSpy.called, "dispatched `secondary`").to.be.true;
|
|
165
|
-
});
|
|
166
|
-
});
|
|
5
|
+
`)).children[0]}describe("Dialog Wrapper",()=>{q(async()=>await n(d())),it("loads wrapped dialog accessibly",async()=>{const e=await n(d());await o(e),await t(e).to.be.accessible()}),it("loads labeled hero dialog accessibly",async()=>{const e=await n(E());await o(e),await t(e).to.be.accessible()}),it("loads fullscreen wrapped dialog accessibly",async()=>{const e=await n(R());await o(e),await t(e).to.be.accessible()}),xit("loads with underlay and no headline accessibly",async()=>{const e=await n(m());await o(e),e.headline="",await o(e),await t(e).to.be.accessible()}),it("opens and closes",async()=>{const e=r(),a=await n(v()),s=a.querySelector("sp-dialog-wrapper");s.addEventListener("close",()=>e()),await o(s);const l=p(a,"sp-opened");a.open="click",await l,t(s.open).to.be.true;const c=p(a,"sp-closed");a.open=void 0,await c,await h(),t(s.open).to.be.false,t(e.callCount).to.equal(1)}),it("dismisses via clicking the underlay when [dismissable]",async()=>{const a=(await n(D())).querySelector("sp-dialog-wrapper");await o(a),t(a.open).to.be.true,a.dismissable=!0,a.shadowRoot.querySelector("sp-underlay").click(),await o(a),t(a.open).to.be.false}),it("does not dismiss via clicking the underlay :not([dismissable])",async()=>{const e=await n(m());await o(e),t(e.open).to.be.true,e.shadowRoot.querySelector("sp-underlay").click(),await o(e),t(e.open).to.be.true}),it("dismisses",async()=>{const e=await n(d());await o(e),t(e.open).to.be.true;const s=(e.shadowRoot?e.shadowRoot:e).querySelector("sp-dialog");(s.shadowRoot?s.shadowRoot:s).querySelector(".close-button").click(),await o(e),t(e.open).to.be.false}),it("manages entry focus - dismissable",async()=>{const e=await n(d());await o(e),t(e.open).to.be.true,t(document.activeElement!==e,"no focused").to.be.true;const a=e.shadowRoot.querySelector("sp-dialog"),l=(a.shadowRoot?a.shadowRoot:a).querySelector(".close-button");e.focus(),await o(e),t(document.activeElement===e,`focused generally, ${document.activeElement}`).to.be.true,t(l.getRootNode().activeElement!==l,`does not focus specifically, ${l.getRootNode().activeElement}`).to.be.true,l.click(),await o(e),t(e.open).to.be.false}),it("manages entry focus - buttons",async()=>{var s;const e=await n(u());await o(e),t(e.open).to.be.true,t(document.activeElement!==e,"no focused").to.be.true;const a=e.shadowRoot.querySelector("sp-button");e.focus(),await o(e),t(document.activeElement===e,`focused generally, ${document.activeElement}`).to.be.true,t(a.getRootNode().activeElement===a,`focused specifically, ${(s=a.getRootNode().activeElement)==null?void 0:s.outerHTML}`).to.be.true}),it("dispatches `confirm`, `cancel` and `secondary`",async()=>{const e=r(),a=r(),s=r(),l=()=>e(),c=()=>a(),w=()=>s(),i=await n(u());i.addEventListener("confirm",l),i.addEventListener("cancel",c),i.addEventListener("secondary",w),await o(i),t(e.called).to.be.false,t(a.called).to.be.false,t(s.called).to.be.false;const y=i.shadowRoot.querySelector('[variant="accent"]'),b=i.shadowRoot.querySelector('[variant="primary"]'),g=i.shadowRoot.querySelector('[variant="secondary"]');y.click(),await o(i),t(e.called,"dispatched `confirm`").to.be.true,t(s.called).to.be.false,t(a.called).to.be.false,b.click(),await o(i),t(e.callCount).to.equal(1),t(s.called,"dispatched `cancel`").to.be.true,t(a.called).to.be.false,g.click(),await o(i),t(e.callCount).to.equal(1),t(s.callCount).to.equal(1),t(a.called,"dispatched `secondary`").to.be.true})});
|
|
167
6
|
//# sourceMappingURL=dialog-wrapper.test.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["dialog-wrapper.test.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n elementUpdated,\n expect,\n fixture,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\nimport { spy } from 'sinon';\n\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport '@spectrum-web-components/dialog/sp-dialog-wrapper.js';\nimport { Dialog, DialogWrapper } from '@spectrum-web-components/dialog';\nimport { ActionButton } from '@spectrum-web-components/action-button';\nimport { Button } from '@spectrum-web-components/button';\nimport { Underlay } from '@spectrum-web-components/underlay';\nimport {\n longContent,\n wrapperButtons,\n wrapperButtonsUnderlay,\n wrapperDismissable,\n wrapperDismissableUnderlayError,\n wrapperFullscreen,\n wrapperLabeledHero,\n} from '../stories/dialog-wrapper.stories.js';\nimport { OverlayTrigger } from '@spectrum-web-components/overlay';\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { Theme } from '@spectrum-web-components/theme';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\nasync function styledFixture<T extends Element>(\n story: TemplateResult\n): Promise<T> {\n const test = await fixture<Theme>(html`\n <sp-theme theme=\"classic\" scale=\"medium\" color=\"dark\">\n ${story}\n </sp-theme>\n `);\n return test.children[0] as T;\n}\n\ndescribe('Dialog Wrapper', () => {\n testForLitDevWarnings(\n async () => await styledFixture<DialogWrapper>(wrapperDismissable())\n );\n it('loads wrapped dialog accessibly', async () => {\n const el = await styledFixture<DialogWrapper>(wrapperDismissable());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads labeled hero dialog accessibly', async () => {\n const el = await styledFixture<DialogWrapper>(wrapperLabeledHero());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads fullscreen wrapped dialog accessibly', async () => {\n const el = await styledFixture<DialogWrapper>(wrapperFullscreen());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n xit('loads with underlay and no headline accessibly', async () => {\n const el = await styledFixture<DialogWrapper>(wrapperButtonsUnderlay());\n await elementUpdated(el);\n el.headline = '';\n await elementUpdated(el);\n await expect(el).to.be.accessible();\n });\n it('opens and closes', async () => {\n const closeSpy = spy();\n const test = await styledFixture<OverlayTrigger>(longContent());\n const el = test.querySelector('sp-dialog-wrapper') as DialogWrapper;\n el.addEventListener('close', () => closeSpy());\n\n await elementUpdated(el);\n\n const opened = oneEvent(test, 'sp-opened');\n test.open = 'click';\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(test, 'sp-closed');\n test.open = undefined;\n await closed;\n await nextFrame();\n\n expect(el.open).to.be.false;\n expect(closeSpy.callCount).to.equal(1);\n });\n it('dismisses via clicking the underlay when [dismissable]', async () => {\n const test = await styledFixture<DialogWrapper>(\n wrapperDismissableUnderlayError()\n );\n const el = test.querySelector('sp-dialog-wrapper') as DialogWrapper;\n await elementUpdated(el);\n expect(el.open).to.be.true;\n el.dismissable = true;\n const underlay = el.shadowRoot.querySelector('sp-underlay') as Underlay;\n underlay.click();\n await elementUpdated(el);\n expect(el.open).to.be.false;\n });\n it('does not dismiss via clicking the underlay :not([dismissable])', async () => {\n const el = await styledFixture<DialogWrapper>(wrapperButtonsUnderlay());\n await elementUpdated(el);\n expect(el.open).to.be.true;\n const underlay = el.shadowRoot.querySelector('sp-underlay') as Underlay;\n underlay.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n });\n it('dismisses', async () => {\n const el = await styledFixture<DialogWrapper>(wrapperDismissable());\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n\n const root = el.shadowRoot ? el.shadowRoot : el;\n const dialog = root.querySelector('sp-dialog') as Dialog;\n const dialogRoot = dialog.shadowRoot ? dialog.shadowRoot : dialog;\n const dismissButton = dialogRoot.querySelector(\n '.close-button'\n ) as HTMLButtonElement;\n dismissButton.click();\n\n await elementUpdated(el);\n expect(el.open).to.be.false;\n });\n it('manages entry focus - dismissable', async () => {\n const el = await styledFixture<DialogWrapper>(wrapperDismissable());\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(document.activeElement !== el, 'no focused').to.be.true;\n\n const dialog = el.shadowRoot.querySelector('sp-dialog') as Dialog;\n const dialogRoot = dialog.shadowRoot ? dialog.shadowRoot : dialog;\n const dismissButton = dialogRoot.querySelector(\n '.close-button'\n ) as ActionButton;\n\n el.focus();\n await elementUpdated(el);\n expect(\n document.activeElement === el,\n `focused generally, ${document.activeElement}`\n ).to.be.true;\n expect(\n (dismissButton.getRootNode() as Document).activeElement !==\n dismissButton,\n `does not focus specifically, ${\n (dismissButton.getRootNode() as Document).activeElement\n }`\n ).to.be.true;\n\n dismissButton.click();\n await elementUpdated(el);\n expect(el.open).to.be.false;\n });\n it('manages entry focus - buttons', async () => {\n const el = await styledFixture<DialogWrapper>(wrapperButtons());\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(document.activeElement !== el, 'no focused').to.be.true;\n\n const button = el.shadowRoot.querySelector('sp-button') as Button;\n\n el.focus();\n await elementUpdated(el);\n expect(\n document.activeElement === el,\n `focused generally, ${document.activeElement}`\n ).to.be.true;\n expect(\n (button.getRootNode() as Document).activeElement === button,\n `focused specifically, ${\n (button.getRootNode() as Document).activeElement?.outerHTML\n }`\n ).to.be.true;\n });\n it('dispatches `confirm`, `cancel` and `secondary`', async () => {\n const confirmSpy = spy();\n const cancelSpy = spy();\n const secondarySpy = spy();\n const handleConfirm = (): void => confirmSpy();\n const handleCancel = (): void => cancelSpy();\n const handleSecondary = (): void => secondarySpy();\n const el = await styledFixture<DialogWrapper>(wrapperButtons());\n el.addEventListener('confirm', handleConfirm);\n el.addEventListener('cancel', handleCancel);\n el.addEventListener('secondary', handleSecondary);\n\n await elementUpdated(el);\n expect(confirmSpy.called).to.be.false;\n expect(cancelSpy.called).to.be.false;\n expect(secondarySpy.called).to.be.false;\n\n const accentButton = el.shadowRoot.querySelector(\n '[variant=\"accent\"]'\n ) as Button;\n const primaryButton = el.shadowRoot.querySelector(\n '[variant=\"primary\"]'\n ) as Button;\n const secondaryButton = el.shadowRoot.querySelector(\n '[variant=\"secondary\"]'\n ) as Button;\n\n accentButton.click();\n\n await elementUpdated(el);\n expect(confirmSpy.called, 'dispatched `confirm`').to.be.true;\n expect(secondarySpy.called).to.be.false;\n expect(cancelSpy.called).to.be.false;\n\n primaryButton.click();\n\n await elementUpdated(el);\n expect(confirmSpy.callCount).to.equal(1);\n expect(secondarySpy.called, 'dispatched `cancel`').to.be.true;\n expect(cancelSpy.called).to.be.false;\n\n secondaryButton.click();\n\n await elementUpdated(el);\n expect(confirmSpy.callCount).to.equal(1);\n expect(secondarySpy.callCount).to.equal(1);\n expect(cancelSpy.called, 'dispatched `secondary`').to.be.true;\n });\n});\n"],
|
|
5
|
-
"mappings": "AAYA
|
|
5
|
+
"mappings": "AAYA,wGAOA,4BAEA,mDACA,qDACA,6DAKA,+NAUA,qDAEA,yEAEA,iBACI,EACU,CAMV,MAAO,AALM,MAAM,GAAe;AAAA;AAAA,cAExB;AAAA;AAAA,KAET,GACW,SAAS,EACzB,CAEA,SAAS,iBAAkB,IAAM,CAC7B,EACI,SAAY,KAAM,GAA6B,EAAmB,CAAC,CACvE,EACA,GAAG,kCAAmC,SAAY,CAC9C,KAAM,GAAK,KAAM,GAA6B,EAAmB,CAAC,EAElE,KAAM,GAAe,CAAE,EAEvB,KAAM,GAAO,CAAE,EAAE,GAAG,GAAG,WAAW,CACtC,CAAC,EACD,GAAG,uCAAwC,SAAY,CACnD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AM,EAAE,GAAG,GAAG,MAE/B,EAAc,MAAM,EAEpB,KAAM,GAAe,CAAE,EACvB,EAAO,EAAW,SAAS,EAAE,GAAG,MAAM,CAAC,EACvC,EAAO,EAAa,OAAQ,qBAAqB,EAAE,GAAG,GAAG,KACzD,EAAO,EAAU,MAAM,EAAE,GAAG,GAAG,MAE/B,EAAgB,MAAM,EAEtB,KAAM,GAAe,CAAE,EACvB,EAAO,EAAW,SAAS,EAAE,GAAG,MAAM,CAAC,EACvC,EAAO,EAAa,SAAS,EAAE,GAAG,MAAM,CAAC,EACzC,EAAO,EAAU,OAAQ,wBAAwB,EAAE,GAAG,GAAG,IAC7D,CAAC,CACL,CAAC",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/dialog.test-vrt.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { regressVisuals } from "../../../test/visual/test.js";
|
|
3
|
-
regressVisuals("DialogStories", stories);
|
|
1
|
+
import*as r from"../stories/dialog.stories.js";import{regressVisuals as s}from"../../../test/visual/test.js";s("DialogStories",r);
|
|
4
2
|
//# sourceMappingURL=dialog.test-vrt.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["dialog.test-vrt.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/dialog.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('DialogStories', stories);\n"],
|
|
5
|
-
"mappings": "AAYA
|
|
5
|
+
"mappings": "AAYA,+CACA,8DAEA,EAAe,gBAAiB,CAAO",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/dialog.test.js
CHANGED
|
@@ -1,149 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "@spectrum-web-components/dialog/sp-dialog.js";
|
|
3
|
-
import { Dialog } from "@spectrum-web-components/dialog";
|
|
4
|
-
import {
|
|
5
|
-
alertError,
|
|
6
|
-
dismissable,
|
|
7
|
-
fullscreen,
|
|
8
|
-
small
|
|
9
|
-
} from "../stories/dialog.stories.js";
|
|
10
|
-
import { spy } from "sinon";
|
|
11
|
-
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
12
|
-
describe("Dialog", () => {
|
|
13
|
-
testForLitDevWarnings(async () => await fixture(small()));
|
|
14
|
-
it("loads `[size=small]` dialog accessibly", async () => {
|
|
15
|
-
const el = await fixture(small());
|
|
16
|
-
await elementUpdated(el);
|
|
17
|
-
await expect(el).to.be.accessible();
|
|
18
|
-
});
|
|
19
|
-
it("loads `[size=alert]` dialog accessibly", async () => {
|
|
20
|
-
const el = await fixture(alertError());
|
|
21
|
-
await elementUpdated(el);
|
|
22
|
-
await expect(el).to.be.accessible();
|
|
23
|
-
});
|
|
24
|
-
it("loads `[dismissable]` dialog accessibly", async () => {
|
|
25
|
-
const el = await fixture(dismissable());
|
|
26
|
-
await elementUpdated(el);
|
|
27
|
-
await expect(el).to.be.accessible();
|
|
28
|
-
});
|
|
29
|
-
it("loads `[mode=fullscreen]` dialog accessibly", async () => {
|
|
30
|
-
const el = await fixture(fullscreen());
|
|
31
|
-
await elementUpdated(el);
|
|
32
|
-
await expect(el).to.be.accessible();
|
|
33
|
-
});
|
|
34
|
-
it("loads dialog without footer accessibly", async () => {
|
|
35
|
-
const el = await fixture(small());
|
|
36
|
-
await elementUpdated(el);
|
|
37
|
-
await expect(el).to.be.accessible();
|
|
38
|
-
});
|
|
39
|
-
it("closes", async () => {
|
|
40
|
-
const closeSpy = spy();
|
|
41
|
-
const el = await fixture(dismissable());
|
|
42
|
-
el.addEventListener("close", () => closeSpy());
|
|
43
|
-
await elementUpdated(el);
|
|
44
|
-
const closeButton = el.shadowRoot ? el.shadowRoot.querySelector(".close-button") : el.querySelector(".close-button ");
|
|
45
|
-
closeButton.click();
|
|
46
|
-
await elementUpdated(el);
|
|
47
|
-
expect(closeSpy.calledOnce).to.be.true;
|
|
48
|
-
});
|
|
49
|
-
it("allows hero override", async () => {
|
|
50
|
-
class Override extends Dialog {
|
|
51
|
-
get hasHero() {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
renderHero() {
|
|
55
|
-
return html`
|
|
1
|
+
import{elementUpdated as s,expect as a,fixture as t,html as r}from"@open-wc/testing";import"@spectrum-web-components/dialog/sp-dialog.js";import{Dialog as n}from"@spectrum-web-components/dialog";import{alertError as u,dismissable as d,fullscreen as m,small as c}from"../stories/dialog.stories.js";import{spy as g}from"sinon";import{testForLitDevWarnings as w}from"../../../test/testing-helpers.js";describe("Dialog",()=>{w(async()=>await t(c())),it("loads `[size=small]` dialog accessibly",async()=>{const e=await t(c());await s(e),await a(e).to.be.accessible()}),it("loads `[size=alert]` dialog accessibly",async()=>{const e=await t(u());await s(e),await a(e).to.be.accessible()}),it("loads `[dismissable]` dialog accessibly",async()=>{const e=await t(d());await s(e),await a(e).to.be.accessible()}),it("loads `[mode=fullscreen]` dialog accessibly",async()=>{const e=await t(m());await s(e),await a(e).to.be.accessible()}),it("loads dialog without footer accessibly",async()=>{const e=await t(c());await s(e),await a(e).to.be.accessible()}),it("closes",async()=>{const e=g(),o=await t(d());o.addEventListener("close",()=>e()),await s(o),(o.shadowRoot?o.shadowRoot.querySelector(".close-button"):o.querySelector(".close-button ")).click(),await s(o),a(e.calledOnce).to.be.true}),it("allows hero override",async()=>{class e extends n{get hasHero(){return!0}renderHero(){return r`
|
|
56
2
|
<div id="hero-container"></div>
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
customElements.define("hero-dialog", Override);
|
|
61
|
-
const el = await fixture(html`
|
|
3
|
+
`}}customElements.define("hero-dialog",e);const i=(await t(r`
|
|
62
4
|
<hero-dialog></hero-dialog>
|
|
63
|
-
`);
|
|
64
|
-
const container = el.shadowRoot.querySelector("#hero-container");
|
|
65
|
-
expect(container).to.not.be.null;
|
|
66
|
-
});
|
|
67
|
-
it("allows heading override", async () => {
|
|
68
|
-
class Override extends Dialog {
|
|
69
|
-
renderHeading() {
|
|
70
|
-
return html`
|
|
5
|
+
`)).shadowRoot.querySelector("#hero-container");a(i).to.not.be.null}),it("allows heading override",async()=>{class e extends n{renderHeading(){return r`
|
|
71
6
|
<h2 id="heading-container">Test</h2>
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
customElements.define("heading-dialog", Override);
|
|
76
|
-
const el = await fixture(html`
|
|
7
|
+
`}}customElements.define("heading-dialog",e);const i=(await t(r`
|
|
77
8
|
<heading-dialog></heading-dialog>
|
|
78
|
-
`);
|
|
79
|
-
const container = el.shadowRoot.querySelector("#heading-container");
|
|
80
|
-
expect(container).to.not.be.null;
|
|
81
|
-
});
|
|
82
|
-
it("allows content override", async () => {
|
|
83
|
-
class Override extends Dialog {
|
|
84
|
-
renderContent() {
|
|
85
|
-
return html`
|
|
9
|
+
`)).shadowRoot.querySelector("#heading-container");a(i).to.not.be.null}),it("allows content override",async()=>{class e extends n{renderContent(){return r`
|
|
86
10
|
<p id="content-container">Test</p>
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
customElements.define("content-dialog", Override);
|
|
91
|
-
const el = await fixture(html`
|
|
11
|
+
`}}customElements.define("content-dialog",e);const i=(await t(r`
|
|
92
12
|
<content-dialog></content-dialog>
|
|
93
|
-
`);
|
|
94
|
-
const container = el.shadowRoot.querySelector("#content-container");
|
|
95
|
-
expect(container).to.not.be.null;
|
|
96
|
-
});
|
|
97
|
-
it("allows footer override", async () => {
|
|
98
|
-
class Override extends Dialog {
|
|
99
|
-
get hasFooter() {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
renderFooter() {
|
|
103
|
-
return html`
|
|
13
|
+
`)).shadowRoot.querySelector("#content-container");a(i).to.not.be.null}),it("allows footer override",async()=>{class e extends n{get hasFooter(){return!0}renderFooter(){return r`
|
|
104
14
|
<p id="footer-container">Test</p>
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
customElements.define("footer-dialog", Override);
|
|
109
|
-
const el = await fixture(html`
|
|
15
|
+
`}}customElements.define("footer-dialog",e);const i=(await t(r`
|
|
110
16
|
<footer-dialog></footer-dialog>
|
|
111
|
-
`);
|
|
112
|
-
const container = el.shadowRoot.querySelector("#footer-container");
|
|
113
|
-
expect(container).to.not.be.null;
|
|
114
|
-
});
|
|
115
|
-
it("allows button override", async () => {
|
|
116
|
-
class Override extends Dialog {
|
|
117
|
-
get hasButtons() {
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
renderButtons() {
|
|
121
|
-
return html`
|
|
17
|
+
`)).shadowRoot.querySelector("#footer-container");a(i).to.not.be.null}),it("allows button override",async()=>{class e extends n{get hasButtons(){return!0}renderButtons(){return r`
|
|
122
18
|
<p id="button-container">Test</p>
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
customElements.define("button-dialog", Override);
|
|
127
|
-
const el = await fixture(html`
|
|
19
|
+
`}}customElements.define("button-dialog",e);const i=(await t(r`
|
|
128
20
|
<button-dialog></button-dialog>
|
|
129
|
-
`);
|
|
130
|
-
const container = el.shadowRoot.querySelector("#button-container");
|
|
131
|
-
expect(container).to.not.be.null;
|
|
132
|
-
});
|
|
133
|
-
it("allows dismiss override", async () => {
|
|
134
|
-
class Override extends Dialog {
|
|
135
|
-
renderDismiss() {
|
|
136
|
-
return html`
|
|
21
|
+
`)).shadowRoot.querySelector("#button-container");a(i).to.not.be.null}),it("allows dismiss override",async()=>{class e extends n{renderDismiss(){return r`
|
|
137
22
|
<p id="dismiss-container">Test</p>
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
customElements.define("dismiss-dialog", Override);
|
|
142
|
-
const el = await fixture(html`
|
|
23
|
+
`}}customElements.define("dismiss-dialog",e);const i=(await t(r`
|
|
143
24
|
<dismiss-dialog dismissable></dismiss-dialog>
|
|
144
|
-
`);
|
|
145
|
-
const container = el.shadowRoot.querySelector("#dismiss-container");
|
|
146
|
-
expect(container).to.not.be.null;
|
|
147
|
-
});
|
|
148
|
-
});
|
|
25
|
+
`)).shadowRoot.querySelector("#dismiss-container");a(i).to.not.be.null})});
|
|
149
26
|
//# sourceMappingURL=dialog.test.js.map
|
package/test/dialog.test.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["dialog.test.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport { TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport { Dialog } from '@spectrum-web-components/dialog';\nimport {\n alertError,\n dismissable,\n fullscreen,\n small,\n} from '../stories/dialog.stories.js';\nimport { spy } from 'sinon';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Dialog', () => {\n testForLitDevWarnings(async () => await fixture<Dialog>(small()));\n it('loads `[size=small]` dialog accessibly', async () => {\n const el = await fixture<Dialog>(small());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads `[size=alert]` dialog accessibly', async () => {\n const el = await fixture<Dialog>(alertError());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads `[dismissable]` dialog accessibly', async () => {\n const el = await fixture<Dialog>(dismissable());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads `[mode=fullscreen]` dialog accessibly', async () => {\n const el = await fixture<Dialog>(fullscreen());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads dialog without footer accessibly', async () => {\n const el = await fixture<Dialog>(small());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('closes', async () => {\n const closeSpy = spy();\n const el = await fixture<Dialog>(dismissable());\n el.addEventListener('close', () => closeSpy());\n await elementUpdated(el);\n\n const closeButton = (\n el.shadowRoot\n ? el.shadowRoot.querySelector('.close-button')\n : el.querySelector('.close-button ')\n ) as HTMLElement;\n\n closeButton.click();\n\n await elementUpdated(el);\n expect(closeSpy.calledOnce).to.be.true;\n });\n it('allows hero override', async () => {\n class Override extends Dialog {\n protected override get hasHero(): boolean {\n return true;\n }\n protected override renderHero(): TemplateResult {\n return html`\n <div id=\"hero-container\"></div>\n `;\n }\n }\n\n customElements.define('hero-dialog', Override);\n\n const el = await fixture<Override>(\n html`\n <hero-dialog></hero-dialog>\n `\n );\n\n const container = el.shadowRoot.querySelector('#hero-container');\n expect(container).to.not.be.null;\n });\n it('allows heading override', async () => {\n class Override extends Dialog {\n protected override renderHeading(): TemplateResult {\n return html`\n <h2 id=\"heading-container\">Test</h2>\n `;\n }\n }\n\n customElements.define('heading-dialog', Override);\n\n const el = await fixture<Override>(\n html`\n <heading-dialog></heading-dialog>\n `\n );\n\n const container = el.shadowRoot.querySelector('#heading-container');\n expect(container).to.not.be.null;\n });\n it('allows content override', async () => {\n class Override extends Dialog {\n protected override renderContent(): TemplateResult {\n return html`\n <p id=\"content-container\">Test</p>\n `;\n }\n }\n\n customElements.define('content-dialog', Override);\n\n const el = await fixture<Override>(\n html`\n <content-dialog></content-dialog>\n `\n );\n\n const container = el.shadowRoot.querySelector('#content-container');\n expect(container).to.not.be.null;\n });\n it('allows footer override', async () => {\n class Override extends Dialog {\n protected override get hasFooter(): boolean {\n return true;\n }\n protected override renderFooter(): TemplateResult {\n return html`\n <p id=\"footer-container\">Test</p>\n `;\n }\n }\n\n customElements.define('footer-dialog', Override);\n\n const el = await fixture<Override>(\n html`\n <footer-dialog></footer-dialog>\n `\n );\n\n const container = el.shadowRoot.querySelector('#footer-container');\n expect(container).to.not.be.null;\n });\n it('allows button override', async () => {\n class Override extends Dialog {\n protected override get hasButtons(): boolean {\n return true;\n }\n protected override renderButtons(): TemplateResult {\n return html`\n <p id=\"button-container\">Test</p>\n `;\n }\n }\n\n customElements.define('button-dialog', Override);\n\n const el = await fixture<Override>(\n html`\n <button-dialog></button-dialog>\n `\n );\n\n const container = el.shadowRoot.querySelector('#button-container');\n expect(container).to.not.be.null;\n });\n it('allows dismiss override', async () => {\n class Override extends Dialog {\n protected override renderDismiss(): TemplateResult {\n return html`\n <p id=\"dismiss-container\">Test</p>\n `;\n }\n }\n\n customElements.define('dismiss-dialog', Override);\n\n const el = await fixture<Override>(\n html`\n <dismiss-dialog dismissable></dismiss-dialog>\n `\n );\n\n const container = el.shadowRoot.querySelector('#dismiss-container');\n expect(container).to.not.be.null;\n });\n});\n"],
|
|
5
|
-
"mappings": "AAYA
|
|
5
|
+
"mappings": "AAYA,qFAGA,qDACA,yDACA,sGAMA,4BACA,yEAEA,SAAS,SAAU,IAAM,CACrB,EAAsB,SAAY,KAAM,GAAgB,EAAM,CAAC,CAAC,EAChE,GAAG,yCAA0C,SAAY,CACrD,KAAM,GAAK,KAAM,GAAgB,EAAM,CAAC,EAExC,KAAM,GAAe,CAAE,EAEvB,KAAM,GAAO,CAAE,EAAE,GAAG,GAAG,WAAW,CACtC,CAAC,EACD,GAAG,yCAA0C,SAAY,CACrD,KAAM,GAA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