@spectrum-web-components/dialog 0.10.1 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/dialog",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -46,16 +46,16 @@
46
46
  "lit-html"
47
47
  ],
48
48
  "dependencies": {
49
- "@spectrum-web-components/action-button": "^0.8.1",
49
+ "@spectrum-web-components/action-button": "^0.8.2",
50
50
  "@spectrum-web-components/base": "^0.5.4",
51
- "@spectrum-web-components/button": "^0.17.1",
51
+ "@spectrum-web-components/button": "^0.17.2",
52
52
  "@spectrum-web-components/button-group": "^0.8.5",
53
53
  "@spectrum-web-components/divider": "^0.4.5",
54
54
  "@spectrum-web-components/icon": "^0.11.5",
55
55
  "@spectrum-web-components/icons-ui": "^0.8.5",
56
56
  "@spectrum-web-components/icons-workflow": "^0.8.5",
57
- "@spectrum-web-components/modal": "^0.6.3",
58
- "@spectrum-web-components/shared": "^0.13.6",
57
+ "@spectrum-web-components/modal": "^0.6.4",
58
+ "@spectrum-web-components/shared": "^0.13.7",
59
59
  "@spectrum-web-components/underlay": "^0.8.5",
60
60
  "tslib": "^2.0.0"
61
61
  },
@@ -67,5 +67,5 @@
67
67
  "sideEffects": [
68
68
  "./sp-*.js"
69
69
  ],
70
- "gitHead": "caf12727e7f91dcf961e1fadacc727eea9ece27b"
70
+ "gitHead": "dd76f9532fdea946880147cc7645f113b998c326"
71
71
  }
@@ -0,0 +1,30 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ import '@spectrum-web-components/dialog/sp-dialog.js';
13
+ import { html } from 'lit';
14
+ import { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';
15
+ measureFixtureCreation(html `
16
+ <sp-dialog size="s">
17
+ <h2 slot="heading">Disclaimer</h2>
18
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
19
+ tempor incididunt ut labore et dolore magna aliqua. Auctor augue mauris
20
+ augue neque gravida. Libero volutpat sed ornare arcu. Quisque egestas
21
+ diam in arcu cursus euismod quis viverra. Posuere ac ut consequat semper
22
+ viverra nam libero justo laoreet. Enim ut tellus elementum sagittis
23
+ vitae et leo duis ut. Neque laoreet suspendisse interdum consectetur
24
+ libero id faucibus nisl. Diam volutpat commodo sed egestas egestas.
25
+ Dolor magna eget est lorem ipsum dolor. Vitae suscipit tellus mauris a
26
+ diam maecenas sed. Turpis in eu mi bibendum neque egestas congue.
27
+ Rhoncus est pellentesque elit ullamcorper dignissim cras lobortis.
28
+ </sp-dialog>
29
+ `);
30
+ //# sourceMappingURL=basic-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic-test.js","sourceRoot":"","sources":["basic-test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,8CAA8C,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,sBAAsB,CAAC,IAAI,CAAA;;;;;;;;;;;;;;CAc1B,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\">Disclaimer</h2>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Auctor augue mauris\n augue neque gravida. Libero volutpat sed ornare arcu. Quisque egestas\n diam in arcu cursus euismod quis viverra. Posuere ac ut consequat semper\n viverra nam libero justo laoreet. Enim ut tellus elementum sagittis\n vitae et leo duis ut. Neque laoreet suspendisse interdum consectetur\n libero id faucibus nisl. Diam volutpat commodo sed egestas egestas.\n Dolor magna eget est lorem ipsum dolor. Vitae suscipit tellus mauris a\n diam maecenas sed. Turpis in eu mi bibendum neque egestas congue.\n Rhoncus est pellentesque elit ullamcorper dignissim cras lobortis.\n </sp-dialog>\n`);\n"]}
@@ -0,0 +1,15 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ import * as stories from '../stories/dialog-wrapper.stories.js';
13
+ import { regressVisuals } from '../../../test/visual/test.js';
14
+ regressVisuals('DialogWrapperStories', stories);
15
+ //# sourceMappingURL=dialog-wrapper.test-vrt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog-wrapper.test-vrt.js","sourceRoot":"","sources":["dialog-wrapper.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC","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-wrapper.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('DialogWrapperStories', stories);\n"]}
@@ -0,0 +1,157 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ import { elementUpdated, expect, fixture, oneEvent } from '@open-wc/testing';
13
+ import { spy } from 'sinon';
14
+ import '@spectrum-web-components/theme/sp-theme.js';
15
+ import '@spectrum-web-components/theme/src/themes.js';
16
+ import '../sp-dialog-wrapper.js';
17
+ import { longContent, wrapperButtons, wrapperButtonsUnderlay, wrapperDismissable, wrapperDismissableUnderlayError, wrapperFullscreen, wrapperLabeledHero, } from '../stories/dialog-wrapper.stories.js';
18
+ import { html } from '@spectrum-web-components/base';
19
+ async function styledFixture(story) {
20
+ const test = await fixture(html `
21
+ <sp-theme scale="medium" color="dark">${story}</sp-theme>
22
+ `);
23
+ return test.children[0];
24
+ }
25
+ describe('Dialog Wrapper', () => {
26
+ it('loads wrapped dialog accessibly', async () => {
27
+ const el = await styledFixture(wrapperDismissable());
28
+ await elementUpdated(el);
29
+ await expect(el).to.be.accessible();
30
+ });
31
+ it('loads labeled hero dialog accessibly', async () => {
32
+ const el = await styledFixture(wrapperLabeledHero());
33
+ await elementUpdated(el);
34
+ await expect(el).to.be.accessible();
35
+ });
36
+ it('loads fullscreen wrapped dialog accessibly', async () => {
37
+ const el = await styledFixture(wrapperFullscreen());
38
+ await elementUpdated(el);
39
+ await expect(el).to.be.accessible();
40
+ });
41
+ xit('loads with underlay and no headline accessibly', async () => {
42
+ const el = await styledFixture(wrapperButtonsUnderlay());
43
+ await elementUpdated(el);
44
+ el.headline = '';
45
+ await elementUpdated(el);
46
+ await expect(el).to.be.accessible();
47
+ });
48
+ it('opens and closes', async () => {
49
+ const test = await styledFixture(longContent());
50
+ const el = test.querySelector('sp-dialog-wrapper');
51
+ await elementUpdated(el);
52
+ const opened = oneEvent(test, 'sp-opened');
53
+ test.open = 'click';
54
+ await opened;
55
+ expect(el.open).to.be.true;
56
+ const closed = oneEvent(test, 'sp-closed');
57
+ test.open = undefined;
58
+ await closed;
59
+ expect(el.open).to.be.false;
60
+ });
61
+ it('dismisses via clicking the underlay when [dismissable]', async () => {
62
+ const test = await styledFixture(wrapperDismissableUnderlayError());
63
+ const el = test.querySelector('sp-dialog-wrapper');
64
+ await elementUpdated(el);
65
+ expect(el.open).to.be.true;
66
+ el.dismissable = true;
67
+ const underlay = el.shadowRoot.querySelector('sp-underlay');
68
+ underlay.click();
69
+ await elementUpdated(el);
70
+ expect(el.open).to.be.false;
71
+ });
72
+ it('does not dismiss via clicking the underlay :not([dismissable])', async () => {
73
+ const el = await styledFixture(wrapperButtonsUnderlay());
74
+ await elementUpdated(el);
75
+ expect(el.open).to.be.true;
76
+ const underlay = el.shadowRoot.querySelector('sp-underlay');
77
+ underlay.click();
78
+ await elementUpdated(el);
79
+ expect(el.open).to.be.true;
80
+ });
81
+ it('dismisses', async () => {
82
+ const el = await styledFixture(wrapperDismissable());
83
+ await elementUpdated(el);
84
+ expect(el.open).to.be.true;
85
+ const root = el.shadowRoot ? el.shadowRoot : el;
86
+ const dialog = root.querySelector('sp-dialog');
87
+ const dialogRoot = dialog.shadowRoot ? dialog.shadowRoot : dialog;
88
+ const dismissButton = dialogRoot.querySelector('.close-button');
89
+ dismissButton.click();
90
+ await elementUpdated(el);
91
+ expect(el.open).to.be.false;
92
+ });
93
+ it('manages entry focus - dismissable', async () => {
94
+ const el = await styledFixture(wrapperDismissable());
95
+ await elementUpdated(el);
96
+ expect(el.open).to.be.true;
97
+ expect(document.activeElement !== el, 'no focused').to.be.true;
98
+ const dialog = el.shadowRoot.querySelector('sp-dialog');
99
+ const dialogRoot = dialog.shadowRoot ? dialog.shadowRoot : dialog;
100
+ const dismissButton = dialogRoot.querySelector('.close-button');
101
+ el.focus();
102
+ await elementUpdated(el);
103
+ expect(document.activeElement === el, `focused generally, ${document.activeElement}`).to.be.true;
104
+ expect(dismissButton.getRootNode().activeElement !==
105
+ dismissButton, `does not focus specifically, ${dismissButton.getRootNode().activeElement}`).to.be.true;
106
+ dismissButton.click();
107
+ await elementUpdated(el);
108
+ expect(el.open).to.be.false;
109
+ });
110
+ it('manages entry focus - buttons', async () => {
111
+ var _a;
112
+ const el = await styledFixture(wrapperButtons());
113
+ await elementUpdated(el);
114
+ expect(el.open).to.be.true;
115
+ expect(document.activeElement !== el, 'no focused').to.be.true;
116
+ const button = el.shadowRoot.querySelector('sp-button');
117
+ el.focus();
118
+ await elementUpdated(el);
119
+ expect(document.activeElement === el, `focused generally, ${document.activeElement}`).to.be.true;
120
+ expect(button.getRootNode().activeElement === button, `focused specifically, ${(_a = button.getRootNode().activeElement) === null || _a === void 0 ? void 0 : _a.outerHTML}`).to.be.true;
121
+ });
122
+ it('dispatches `confirm`, `cancel` and `secondary`', async () => {
123
+ const confirmSpy = spy();
124
+ const cancelSpy = spy();
125
+ const secondarySpy = spy();
126
+ const handleConfirm = () => confirmSpy();
127
+ const handleCancel = () => cancelSpy();
128
+ const handleSecondary = () => secondarySpy();
129
+ const el = await styledFixture(wrapperButtons());
130
+ el.addEventListener('confirm', handleConfirm);
131
+ el.addEventListener('cancel', handleCancel);
132
+ el.addEventListener('secondary', handleSecondary);
133
+ await elementUpdated(el);
134
+ expect(confirmSpy.called).to.be.false;
135
+ expect(cancelSpy.called).to.be.false;
136
+ expect(secondarySpy.called).to.be.false;
137
+ const accentButton = el.shadowRoot.querySelector('[variant="accent"]');
138
+ const primaryButton = el.shadowRoot.querySelector('[variant="primary"]');
139
+ const secondaryButton = el.shadowRoot.querySelector('[variant="secondary"]');
140
+ accentButton.click();
141
+ await elementUpdated(el);
142
+ expect(confirmSpy.called, 'dispatched `confirm`').to.be.true;
143
+ expect(secondarySpy.called).to.be.false;
144
+ expect(cancelSpy.called).to.be.false;
145
+ primaryButton.click();
146
+ await elementUpdated(el);
147
+ expect(confirmSpy.callCount).to.equal(1);
148
+ expect(secondarySpy.called, 'dispatched `cancel`').to.be.true;
149
+ expect(cancelSpy.called).to.be.false;
150
+ secondaryButton.click();
151
+ await elementUpdated(el);
152
+ expect(confirmSpy.callCount).to.equal(1);
153
+ expect(secondarySpy.callCount).to.equal(1);
154
+ expect(cancelSpy.called, 'dispatched `secondary`').to.be.true;
155
+ });
156
+ });
157
+ //# sourceMappingURL=dialog-wrapper.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog-wrapper.test.js","sourceRoot":"","sources":["dialog-wrapper.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,G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AC","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, oneEvent } 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 '../sp-dialog-wrapper.js';\nimport { Dialog, DialogWrapper } from '../';\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';\n\nasync function styledFixture<T extends Element>(\n story: TemplateResult\n): Promise<T> {\n const test = await fixture<Theme>(html`\n <sp-theme scale=\"medium\" color=\"dark\">${story}</sp-theme>\n `);\n return test.children[0] as T;\n}\n\ndescribe('Dialog Wrapper', () => {\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 test = await styledFixture<OverlayTrigger>(longContent());\n const el = test.querySelector('sp-dialog-wrapper') as DialogWrapper;\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\n expect(el.open).to.be.false;\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"]}
@@ -0,0 +1,15 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ import * as stories from '../stories/dialog.stories.js';
13
+ import { regressVisuals } from '../../../test/visual/test.js';
14
+ regressVisuals('DialogStories', stories);
15
+ //# sourceMappingURL=dialog.test-vrt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.test-vrt.js","sourceRoot":"","sources":["dialog.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC","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"]}
@@ -0,0 +1,55 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ import { elementUpdated, expect, fixture } from '@open-wc/testing';
13
+ import '../sp-dialog.js';
14
+ import { alertError, dismissable, fullscreen, small, } from '../stories/dialog.stories.js';
15
+ import { spy } from 'sinon';
16
+ describe('Dialog', () => {
17
+ it('loads `[size=small]` dialog accessibly', async () => {
18
+ const el = await fixture(small());
19
+ await elementUpdated(el);
20
+ await expect(el).to.be.accessible();
21
+ });
22
+ it('loads `[size=alert]` dialog accessibly', async () => {
23
+ const el = await fixture(alertError());
24
+ await elementUpdated(el);
25
+ await expect(el).to.be.accessible();
26
+ });
27
+ it('loads `[dismissable]` dialog accessibly', async () => {
28
+ const el = await fixture(dismissable());
29
+ await elementUpdated(el);
30
+ await expect(el).to.be.accessible();
31
+ });
32
+ it('loads `[mode=fullscreen]` dialog accessibly', async () => {
33
+ const el = await fixture(fullscreen());
34
+ await elementUpdated(el);
35
+ await expect(el).to.be.accessible();
36
+ });
37
+ it('loads dialog without footer accessibly', async () => {
38
+ const el = await fixture(small());
39
+ await elementUpdated(el);
40
+ await expect(el).to.be.accessible();
41
+ });
42
+ it('closes', async () => {
43
+ const closeSpy = spy();
44
+ const el = await fixture(dismissable());
45
+ el.addEventListener('close', () => closeSpy());
46
+ await elementUpdated(el);
47
+ const closeButton = (el.shadowRoot
48
+ ? el.shadowRoot.querySelector('.close-button')
49
+ : el.querySelector('.close-button '));
50
+ closeButton.click();
51
+ await elementUpdated(el);
52
+ expect(closeSpy.calledOnce).to.be.true;
53
+ });
54
+ });
55
+ //# sourceMappingURL=dialog.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.test.js","sourceRoot":"","sources":["dialog.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,iBAAiB,CAAC;AAEzB,OAAO,EACH,UAAU,EACV,WAAW,EACX,UAAU,EACV,KAAK,GACR,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAS,KAAK,EAAE,CAAC,CAAC;QAE1C,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAS,UAAU,EAAE,CAAC,CAAC;QAE/C,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,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CAAC,aAAa,CAAC,eAAe,CAAC;YAC9C,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAC5B,CAAC;QAEjB,WAAW,CAAC,KAAK,EAAE,CAAC;QAEpB,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC3C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","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 } from '@open-wc/testing';\n\nimport '../sp-dialog.js';\nimport { Dialog } from '..';\nimport {\n alertError,\n dismissable,\n fullscreen,\n small,\n} from '../stories/dialog.stories.js';\nimport { spy } from 'sinon';\n\ndescribe('Dialog', () => {\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});\n"]}