@spectrum-web-components/popover 0.11.0 → 0.11.1
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 +21 -6
- package/package.json +5 -5
- package/src/Popover.d.ts +8 -2
- package/src/Popover.js +11 -2
- package/src/Popover.js.map +1 -1
- package/test/popover.test-vrt.js +0 -15
- package/test/popover.test-vrt.js.map +0 -1
- package/test/popover.test.js +0 -72
- package/test/popover.test.js.map +0 -1
package/custom-elements.json
CHANGED
|
@@ -32,6 +32,18 @@
|
|
|
32
32
|
}
|
|
33
33
|
],
|
|
34
34
|
"members": [
|
|
35
|
+
{
|
|
36
|
+
"kind": "field",
|
|
37
|
+
"name": "dialog",
|
|
38
|
+
"type": {
|
|
39
|
+
"text": "boolean"
|
|
40
|
+
},
|
|
41
|
+
"privacy": "public",
|
|
42
|
+
"default": "false",
|
|
43
|
+
"description": "Whether the popover should manage the application\nof padding to its content or not.",
|
|
44
|
+
"attribute": "dialog",
|
|
45
|
+
"reflects": true
|
|
46
|
+
},
|
|
35
47
|
{
|
|
36
48
|
"kind": "field",
|
|
37
49
|
"name": "open",
|
|
@@ -40,6 +52,7 @@
|
|
|
40
52
|
},
|
|
41
53
|
"privacy": "public",
|
|
42
54
|
"default": "false",
|
|
55
|
+
"description": "Whether the popover is visible or not.",
|
|
43
56
|
"attribute": "open",
|
|
44
57
|
"reflects": true
|
|
45
58
|
},
|
|
@@ -105,20 +118,22 @@
|
|
|
105
118
|
"attribute": "placement"
|
|
106
119
|
},
|
|
107
120
|
{
|
|
121
|
+
"name": "dialog",
|
|
108
122
|
"type": {
|
|
109
123
|
"text": "boolean"
|
|
110
124
|
},
|
|
111
|
-
"description": "The open state of the popover",
|
|
112
|
-
"name": "open",
|
|
113
125
|
"default": "false",
|
|
114
|
-
"
|
|
126
|
+
"description": "Whether the popover should manage the application\nof padding to its content or not.",
|
|
127
|
+
"fieldName": "dialog"
|
|
115
128
|
},
|
|
116
129
|
{
|
|
130
|
+
"name": "open",
|
|
117
131
|
"type": {
|
|
118
|
-
"text": "
|
|
132
|
+
"text": "boolean"
|
|
119
133
|
},
|
|
120
|
-
"
|
|
121
|
-
"
|
|
134
|
+
"default": "false",
|
|
135
|
+
"description": "Whether the popover is visible or not.",
|
|
136
|
+
"fieldName": "open"
|
|
122
137
|
},
|
|
123
138
|
{
|
|
124
139
|
"name": "tip",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/popover",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
"lit-html"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@spectrum-web-components/base": "^0.5.
|
|
48
|
-
"@spectrum-web-components/overlay": "^0.13.
|
|
47
|
+
"@spectrum-web-components/base": "^0.5.1",
|
|
48
|
+
"@spectrum-web-components/overlay": "^0.13.1",
|
|
49
49
|
"tslib": "^2.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@spectrum-css/popover": "^3.0.
|
|
52
|
+
"@spectrum-css/popover": "^3.0.11"
|
|
53
53
|
},
|
|
54
54
|
"types": "./src/index.d.ts",
|
|
55
55
|
"customElements": "custom-elements.json",
|
|
56
56
|
"sideEffects": [
|
|
57
57
|
"./sp-*.js"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "df3f333ee26a45f9fc247716b6e8ef051dca630b"
|
|
60
60
|
}
|
package/src/Popover.d.ts
CHANGED
|
@@ -4,11 +4,17 @@ import { OverlayDisplayQueryDetail, Placement } from '@spectrum-web-components/o
|
|
|
4
4
|
* @element sp-popover
|
|
5
5
|
*
|
|
6
6
|
* @slot - content to display within the Popover
|
|
7
|
-
* @attr {Boolean} open - The open state of the popover
|
|
8
|
-
* @attr {Boolean} dialog - Adds some padding to the popover
|
|
9
7
|
*/
|
|
10
8
|
export declare class Popover extends SpectrumElement {
|
|
11
9
|
static get styles(): CSSResultArray;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the popover should manage the application
|
|
12
|
+
* of padding to its content or not.
|
|
13
|
+
*/
|
|
14
|
+
dialog: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the popover is visible or not.
|
|
17
|
+
*/
|
|
12
18
|
open: boolean;
|
|
13
19
|
/**
|
|
14
20
|
* @type {"auto" | "auto-start" | "auto-end" | "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end" | "none"}
|
package/src/Popover.js
CHANGED
|
@@ -17,12 +17,18 @@ import popoverStyles from './popover.css.js';
|
|
|
17
17
|
* @element sp-popover
|
|
18
18
|
*
|
|
19
19
|
* @slot - content to display within the Popover
|
|
20
|
-
* @attr {Boolean} open - The open state of the popover
|
|
21
|
-
* @attr {Boolean} dialog - Adds some padding to the popover
|
|
22
20
|
*/
|
|
23
21
|
export class Popover extends SpectrumElement {
|
|
24
22
|
constructor() {
|
|
25
23
|
super(...arguments);
|
|
24
|
+
/**
|
|
25
|
+
* Whether the popover should manage the application
|
|
26
|
+
* of padding to its content or not.
|
|
27
|
+
*/
|
|
28
|
+
this.dialog = false;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the popover is visible or not.
|
|
31
|
+
*/
|
|
26
32
|
this.open = false;
|
|
27
33
|
/**
|
|
28
34
|
* @type {"auto" | "auto-start" | "auto-end" | "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end" | "none"}
|
|
@@ -78,6 +84,9 @@ export class Popover extends SpectrumElement {
|
|
|
78
84
|
`;
|
|
79
85
|
}
|
|
80
86
|
}
|
|
87
|
+
__decorate([
|
|
88
|
+
property({ type: Boolean, reflect: true })
|
|
89
|
+
], Popover.prototype, "dialog", void 0);
|
|
81
90
|
__decorate([
|
|
82
91
|
property({ type: Boolean, reflect: true })
|
|
83
92
|
], Popover.prototype, "open", void 0);
|
package/src/Popover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["Popover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EACJ,OAAO,EACP,eAAe,GAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAK3E,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["Popover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EACJ,OAAO,EACP,eAAe,GAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAK3E,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,OAAO,OAAQ,SAAQ,eAAe;IAA5C;;QAKI;;;WAGG;QAEI,WAAM,GAAG,KAAK,CAAC;QAEtB;;WAEG;QAEI,SAAI,GAAG,KAAK,CAAC;QAEpB;;;WAGG;QAEI,cAAS,GAAc,MAAM,CAAC;QAG9B,QAAG,GAAG,KAAK,CAAC;IAiDvB,CAAC;IA1EU,MAAM,KAAK,MAAM;QACpB,OAAO,CAAC,aAAa,CAAC,CAAC;IAC3B,CAAC;IAyBS,SAAS;QACf,OAAO,IAAI,CAAA;;;;;;;;;;;;;SAaV,CAAC;IACN,CAAC;IAEM,iBAAiB;QACpB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACnE,CAAC;IAEM,oBAAoB;QACvB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACtE,CAAC;IAEM,cAAc,CAAC,KAA6C;QAC/D,oBAAoB;QACpB,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,OAAO;QAE1B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAc,CAAC;QACpC,oBAAoB;QACpB,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO;QAE5B,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAgB,CAAC;QACxE,IAAI,UAAU,EAAE;YACZ,KAAK,CAAC,MAAM,CAAC,wBAAwB,GAAG,UAAU,CAAC;SACtD;IACL,CAAC;IAES,MAAM;QACZ,OAAO,IAAI,CAAA;;cAEL,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO;SAC1C,CAAC;IACN,CAAC;CACJ;AAjEG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCACrB;AAMtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qCACvB;AAOpB;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CACS;AAGrC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oCACxB","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport {\n OverlayDisplayQueryDetail,\n Placement,\n} from '@spectrum-web-components/overlay';\nimport popoverStyles from './popover.css.js';\n\n/**\n * @element sp-popover\n *\n * @slot - content to display within the Popover\n */\nexport class Popover extends SpectrumElement {\n public static get styles(): CSSResultArray {\n return [popoverStyles];\n }\n\n /**\n * Whether the popover should manage the application\n * of padding to its content or not.\n */\n @property({ type: Boolean, reflect: true })\n public dialog = false;\n\n /**\n * Whether the popover is visible or not.\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * @type {\"auto\" | \"auto-start\" | \"auto-end\" | \"top\" | \"bottom\" | \"right\" | \"left\" | \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"right-start\" | \"right-end\" | \"left-start\" | \"left-end\" | \"none\"}\n * @attr\n */\n @property({ reflect: true })\n public placement: Placement = 'none';\n\n @property({ type: Boolean, reflect: true })\n public tip = false;\n\n protected renderTip(): TemplateResult {\n return html`\n <div id=\"tip\">\n <svg\n xmlns=\"http://www.w3.org/svg/2000\"\n class=\"tip\"\n viewBox=\"0 0 24 12\"\n >\n <path\n class=\"triangle\"\n d=\"M 0.7071067811865476 0 L 11.414213562373096 10.707106781186548 L 22.121320343559645 0\"\n ></path>\n </svg>\n </div>\n `;\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('sp-overlay-query', this.onOverlayQuery);\n }\n\n public disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('sp-overlay-query', this.onOverlayQuery);\n }\n\n public onOverlayQuery(event: CustomEvent<OverlayDisplayQueryDetail>): void {\n /* c8 ignore next */\n if (!event.target) return;\n\n const target = event.target as Node;\n /* c8 ignore next */\n if (target !== this) return;\n\n const tipElement = this.shadowRoot.querySelector('#tip') as HTMLElement;\n if (tipElement) {\n event.detail.overlayContentTipElement = tipElement;\n }\n }\n\n protected render(): TemplateResult {\n return html`\n <slot></slot>\n ${this.tip ? this.renderTip() : nothing}\n `;\n }\n}\n"]}
|
package/test/popover.test-vrt.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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/popover.stories.js';
|
|
13
|
-
import { regressVisuals } from '../../../test/visual/test.js';
|
|
14
|
-
regressVisuals('PopoverStories', stories);
|
|
15
|
-
//# sourceMappingURL=popover.test-vrt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popover.test-vrt.js","sourceRoot":"","sources":["popover.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,gBAAgB,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/popover.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('PopoverStories', stories);\n"]}
|
package/test/popover.test.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
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 '../sp-popover.js';
|
|
13
|
-
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
|
|
14
|
-
describe('popover', () => {
|
|
15
|
-
let popover;
|
|
16
|
-
beforeEach(async () => {
|
|
17
|
-
popover = await fixture(html `
|
|
18
|
-
<sp-popover variant="dialog" placement="top" open>
|
|
19
|
-
<div id="title">Popover Title</div>
|
|
20
|
-
<div id="content">
|
|
21
|
-
Cupcake ipsum dolor sit amet jelly beans. Chocolate
|
|
22
|
-
jelly caramels. Icing soufflé chupa chups donut
|
|
23
|
-
cheesecake. Jelly-o chocolate cake sweet roll cake
|
|
24
|
-
danish candy biscuit halvah
|
|
25
|
-
</div>
|
|
26
|
-
</sp-popover>
|
|
27
|
-
`);
|
|
28
|
-
await elementUpdated(popover);
|
|
29
|
-
});
|
|
30
|
-
it('loads', async () => {
|
|
31
|
-
expect(popover).to.not.equal(undefined);
|
|
32
|
-
expect(popover.textContent).to.include('Popover Title');
|
|
33
|
-
await expect(popover).to.be.accessible();
|
|
34
|
-
});
|
|
35
|
-
it('tip exists only when tip attribute is true', async () => {
|
|
36
|
-
if (!popover.shadowRoot)
|
|
37
|
-
throw new Error('No shadowRoot');
|
|
38
|
-
expect(popover.getAttribute('tip')).to.equal(null);
|
|
39
|
-
let tip = popover.shadowRoot.querySelector('tip');
|
|
40
|
-
expect(tip).to.equal(null);
|
|
41
|
-
popover.setAttribute('tip', 'true');
|
|
42
|
-
tip = popover.shadowRoot.querySelector('tip');
|
|
43
|
-
expect(tip).to.not.equal(undefined);
|
|
44
|
-
});
|
|
45
|
-
it('answers tip query', async () => {
|
|
46
|
-
const el = await fixture(html `
|
|
47
|
-
<sp-popover variant="dialog" placement="top" tip open>
|
|
48
|
-
<div id="title">Popover Title</div>
|
|
49
|
-
<div id="content">
|
|
50
|
-
Cupcake ipsum dolor sit amet jelly beans. Chocolate
|
|
51
|
-
jelly caramels. Icing soufflé chupa chups donut
|
|
52
|
-
cheesecake. Jelly-o chocolate cake sweet roll cake
|
|
53
|
-
danish candy biscuit halvah
|
|
54
|
-
</div>
|
|
55
|
-
</sp-popover>
|
|
56
|
-
`);
|
|
57
|
-
await elementUpdated(el);
|
|
58
|
-
const overlayDetailQuery = {};
|
|
59
|
-
const queryOverlayDetailEvent = new CustomEvent('sp-overlay-query', {
|
|
60
|
-
bubbles: true,
|
|
61
|
-
composed: true,
|
|
62
|
-
detail: overlayDetailQuery,
|
|
63
|
-
cancelable: true,
|
|
64
|
-
});
|
|
65
|
-
el.dispatchEvent(queryOverlayDetailEvent);
|
|
66
|
-
expect(overlayDetailQuery.overlayContentTipElement).to.exist;
|
|
67
|
-
if (overlayDetailQuery.overlayContentTipElement) {
|
|
68
|
-
expect(overlayDetailQuery.overlayContentTipElement.id).to.equal('tip');
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
//# sourceMappingURL=popover.test.js.map
|
package/test/popover.test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popover.test.js","sourceRoot":"","sources":["popover.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGzE,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACrB,IAAI,OAAiB,CAAC;IAEtB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,GAAG,MAAM,OAAO,CACnB,IAAI,CAAA;;;;;;;;;;aAUH,CACJ,CAAC;QACF,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;QACnB,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACxC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAExD,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;QACxD,IAAI,CAAC,OAAO,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QAC1D,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEnD,IAAI,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAgB,CAAC;QACjE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE3B,OAAO,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAEpC,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAgB,CAAC;QAC7D,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;;;;;;;;;aAUH,CACJ,CAAC;QAEF,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,kBAAkB,GAA8B,EAAE,CAAC;QACzD,MAAM,uBAAuB,GACzB,IAAI,WAAW,CAA4B,kBAAkB,EAAE;YAC3D,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,kBAAkB;YAC1B,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;QACP,EAAE,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC;QAE1C,MAAM,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAC7D,IAAI,kBAAkB,CAAC,wBAAwB,EAAE;YAC7C,MAAM,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAC3D,KAAK,CACR,CAAC;SACL;IACL,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*/\nimport '../sp-popover.js';\nimport { Popover } from '../';\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport { OverlayDisplayQueryDetail } from '@spectrum-web-components/overlay';\n\ndescribe('popover', () => {\n let popover!: Popover;\n\n beforeEach(async () => {\n popover = await fixture<Popover>(\n html`\n <sp-popover variant=\"dialog\" placement=\"top\" open>\n <div id=\"title\">Popover Title</div>\n <div id=\"content\">\n Cupcake ipsum dolor sit amet jelly beans. Chocolate\n jelly caramels. Icing soufflé chupa chups donut\n cheesecake. Jelly-o chocolate cake sweet roll cake\n danish candy biscuit halvah\n </div>\n </sp-popover>\n `\n );\n await elementUpdated(popover);\n });\n\n it('loads', async () => {\n expect(popover).to.not.equal(undefined);\n expect(popover.textContent).to.include('Popover Title');\n\n await expect(popover).to.be.accessible();\n });\n it('tip exists only when tip attribute is true', async () => {\n if (!popover.shadowRoot) throw new Error('No shadowRoot');\n expect(popover.getAttribute('tip')).to.equal(null);\n\n let tip = popover.shadowRoot.querySelector('tip') as HTMLElement;\n expect(tip).to.equal(null);\n\n popover.setAttribute('tip', 'true');\n\n tip = popover.shadowRoot.querySelector('tip') as HTMLElement;\n expect(tip).to.not.equal(undefined);\n });\n\n it('answers tip query', async () => {\n const el = await fixture<Popover>(\n html`\n <sp-popover variant=\"dialog\" placement=\"top\" tip open>\n <div id=\"title\">Popover Title</div>\n <div id=\"content\">\n Cupcake ipsum dolor sit amet jelly beans. Chocolate\n jelly caramels. Icing soufflé chupa chups donut\n cheesecake. Jelly-o chocolate cake sweet roll cake\n danish candy biscuit halvah\n </div>\n </sp-popover>\n `\n );\n\n await elementUpdated(el);\n\n const overlayDetailQuery: OverlayDisplayQueryDetail = {};\n const queryOverlayDetailEvent =\n new CustomEvent<OverlayDisplayQueryDetail>('sp-overlay-query', {\n bubbles: true,\n composed: true,\n detail: overlayDetailQuery,\n cancelable: true,\n });\n el.dispatchEvent(queryOverlayDetailEvent);\n\n expect(overlayDetailQuery.overlayContentTipElement).to.exist;\n if (overlayDetailQuery.overlayContentTipElement) {\n expect(overlayDetailQuery.overlayContentTipElement.id).to.equal(\n 'tip'\n );\n }\n });\n});\n"]}
|