@spectrum-web-components/tooltip 0.11.0-slim.10 → 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 +5 -62
- package/package.json +24 -10
- package/sp-tooltip.dev.js +3 -0
- package/sp-tooltip.dev.js.map +7 -0
- package/sp-tooltip.js +2 -14
- package/sp-tooltip.js.map +7 -1
- package/src/Tooltip.dev.js +206 -0
- package/src/Tooltip.dev.js.map +7 -0
- package/src/Tooltip.js +3 -214
- package/src/Tooltip.js.map +7 -1
- package/src/index.dev.js +2 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -13
- package/src/index.js.map +7 -1
- package/src/spectrum-tooltip.css.dev.js +92 -0
- package/src/spectrum-tooltip.css.dev.js.map +7 -0
- package/src/spectrum-tooltip.css.js +4 -17
- package/src/spectrum-tooltip.css.js.map +7 -1
- package/src/tooltip.css.dev.js +102 -0
- package/src/tooltip.css.dev.js.map +7 -0
- package/src/tooltip.css.js +5 -18
- package/src/tooltip.css.js.map +7 -1
- package/stories/tooltip.stories.js +28 -269
- package/stories/tooltip.stories.js.map +7 -1
- package/test/benchmark/test-basic.js +2 -16
- package/test/benchmark/test-basic.js.map +7 -1
- package/test/tooltip.test-vrt.js +2 -15
- package/test/tooltip.test-vrt.js.map +7 -1
- package/test/tooltip.test.js +10 -110
- package/test/tooltip.test.js.map +7 -1
|
@@ -1,18 +1,4 @@
|
|
|
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/tooltip/sp-tooltip.js';
|
|
13
|
-
import { html } from 'lit';
|
|
14
|
-
import { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';
|
|
15
|
-
measureFixtureCreation(html `
|
|
1
|
+
import"@spectrum-web-components/tooltip/sp-tooltip.js";import{html as o}from"lit";import{measureFixtureCreation as t}from"../../../../test/benchmark/helpers.js";t(o`
|
|
16
2
|
<sp-tooltip open>Tip me!</sp-tooltip>
|
|
17
3
|
`);
|
|
18
|
-
//# sourceMappingURL=test-basic.js.map
|
|
4
|
+
//# sourceMappingURL=test-basic.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["test-basic.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 '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-tooltip open>Tip me!</sp-tooltip>\n`);\n"],
|
|
5
|
+
"mappings": "AAYA,uDACA,2BACA,+EAEA,EAAuB;AAAA;AAAA,CAEtB",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/test/tooltip.test-vrt.js
CHANGED
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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/tooltip.stories.js';
|
|
13
|
-
import { regressVisuals } from '../../../test/visual/test.js';
|
|
14
|
-
regressVisuals('TooltipStories', stories);
|
|
15
|
-
//# sourceMappingURL=tooltip.test-vrt.js.map
|
|
1
|
+
import*as o from"../stories/tooltip.stories.js";import{regressVisuals as r}from"../../../test/visual/test.js";r("TooltipStories",o);
|
|
2
|
+
//# sourceMappingURL=tooltip.test-vrt.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tooltip.test-vrt.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 * as stories from '../stories/tooltip.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('TooltipStories', stories);\n"],
|
|
5
|
+
"mappings": "AAYA,gDACA,8DAEA,EAAe,iBAAkB,CAAO",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/test/tooltip.test.js
CHANGED
|
@@ -1,122 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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-tooltip.js';
|
|
13
|
-
import { elementUpdated, expect, fixture, html, oneEvent, } from '@open-wc/testing';
|
|
14
|
-
import '@spectrum-web-components/button/sp-button.js';
|
|
15
|
-
describe('Tooltip', () => {
|
|
16
|
-
it('loads', async () => {
|
|
17
|
-
const el = await fixture(html `
|
|
1
|
+
import"@spectrum-web-components/tooltip/sp-tooltip.js";import{elementUpdated as o,expect as e,fixture as i,html as l,oneEvent as p}from"@open-wc/testing";import"@spectrum-web-components/button/sp-button.js";import{testForLitDevWarnings as u}from"../../../test/testing-helpers.js";describe("Tooltip",()=>{u(async()=>await i(l`
|
|
2
|
+
<sp-tooltip>Help text.</sp-tooltip>
|
|
3
|
+
`)),it("loads",async()=>{const t=await i(l`
|
|
18
4
|
<sp-tooltip>Help text.</sp-tooltip>
|
|
19
|
-
`);
|
|
20
|
-
await elementUpdated(el);
|
|
21
|
-
await expect(el).to.be.accessible();
|
|
22
|
-
});
|
|
23
|
-
it('self manages', async () => {
|
|
24
|
-
const button = await fixture(html `
|
|
5
|
+
`);await o(t),await e(t).to.be.accessible()}),it("self manages",async()=>{const t=await i(l`
|
|
25
6
|
<sp-button>
|
|
26
7
|
This is a button.
|
|
27
8
|
<sp-tooltip self-managed>Help text.</sp-tooltip>
|
|
28
9
|
</sp-button>
|
|
29
|
-
`);
|
|
30
|
-
const el = button.querySelector('sp-tooltip');
|
|
31
|
-
await elementUpdated(el);
|
|
32
|
-
await expect(button).to.be.accessible();
|
|
33
|
-
const opened = oneEvent(button, 'sp-opened');
|
|
34
|
-
button.focus();
|
|
35
|
-
await opened;
|
|
36
|
-
await elementUpdated(el);
|
|
37
|
-
expect(el.open).to.be.true;
|
|
38
|
-
await expect(button).to.be.accessible();
|
|
39
|
-
const closed = oneEvent(button, 'sp-closed');
|
|
40
|
-
button.blur();
|
|
41
|
-
await closed;
|
|
42
|
-
await elementUpdated(el);
|
|
43
|
-
expect(el.open).to.be.false;
|
|
44
|
-
});
|
|
45
|
-
it('cleans up when self manages', async () => {
|
|
46
|
-
const button = await fixture(html `
|
|
10
|
+
`),a=t.querySelector("sp-tooltip");await o(a),await e(t).to.be.accessible();const n=p(t,"sp-opened");t.focus(),await n,await o(a),e(a.open).to.be.true,await e(t).to.be.accessible();const s=p(t,"sp-closed");t.blur(),await s,await o(a),e(a.open).to.be.false}),it("cleans up when self manages",async()=>{const t=await i(l`
|
|
47
11
|
<sp-button>
|
|
48
12
|
This is a button.
|
|
49
13
|
<sp-tooltip self-managed>Help text.</sp-tooltip>
|
|
50
14
|
</sp-button>
|
|
51
|
-
`);
|
|
52
|
-
const el = button.querySelector('sp-tooltip');
|
|
53
|
-
await elementUpdated(el);
|
|
54
|
-
const opened = oneEvent(button, 'sp-opened');
|
|
55
|
-
button.focus();
|
|
56
|
-
await opened;
|
|
57
|
-
await elementUpdated(el);
|
|
58
|
-
expect(el.open).to.be.true;
|
|
59
|
-
let activeOverlay = document.querySelector('active-overlay');
|
|
60
|
-
expect(activeOverlay).to.not.be.null;
|
|
61
|
-
const closed = oneEvent(button, 'sp-closed');
|
|
62
|
-
button.remove();
|
|
63
|
-
await closed;
|
|
64
|
-
activeOverlay = document.querySelector('active-overlay');
|
|
65
|
-
expect(activeOverlay).to.be.null;
|
|
66
|
-
});
|
|
67
|
-
it('accepts variants', async () => {
|
|
68
|
-
const el = await fixture(html `
|
|
15
|
+
`),a=t.querySelector("sp-tooltip");await o(a);const n=p(t,"sp-opened");t.focus(),await n,await o(a),e(a.open).to.be.true;let s=document.querySelector("active-overlay");e(s).to.not.be.null;const r=p(t,"sp-closed");t.remove(),await r,s=document.querySelector("active-overlay"),e(s).to.be.null}),it("accepts variants",async()=>{const t=await i(l`
|
|
69
16
|
<sp-tooltip variant="negative">Help text.</sp-tooltip>
|
|
70
|
-
`);
|
|
71
|
-
await elementUpdated(el);
|
|
72
|
-
expect(el.variant).to.equal('negative');
|
|
73
|
-
expect(el.getAttribute('variant')).to.equal('negative');
|
|
74
|
-
el.variant = 'info';
|
|
75
|
-
await elementUpdated(el);
|
|
76
|
-
expect(el.variant).to.equal('info');
|
|
77
|
-
expect(el.getAttribute('variant')).to.equal('info');
|
|
78
|
-
el.setAttribute('variant', 'positive');
|
|
79
|
-
await elementUpdated(el);
|
|
80
|
-
expect(el.variant).to.equal('positive');
|
|
81
|
-
expect(el.getAttribute('variant')).to.equal('positive');
|
|
82
|
-
el.removeAttribute('variant');
|
|
83
|
-
await elementUpdated(el);
|
|
84
|
-
expect(el.variant).to.equal('');
|
|
85
|
-
expect(el.hasAttribute('variant')).to.be.false;
|
|
86
|
-
});
|
|
87
|
-
it('validates variants', async () => {
|
|
88
|
-
const el = await fixture(html `
|
|
17
|
+
`);await o(t),e(t.variant).to.equal("negative"),e(t.getAttribute("variant")).to.equal("negative"),t.variant="info",await o(t),e(t.variant).to.equal("info"),e(t.getAttribute("variant")).to.equal("info"),t.setAttribute("variant","positive"),await o(t),e(t.variant).to.equal("positive"),e(t.getAttribute("variant")).to.equal("positive"),t.removeAttribute("variant"),await o(t),e(t.variant).to.equal(""),e(t.hasAttribute("variant")).to.be.false}),it("validates variants",async()=>{const t=await i(l`
|
|
89
18
|
<sp-tooltip variant="other">Help text.</sp-tooltip>
|
|
90
|
-
`);
|
|
91
|
-
await elementUpdated(el);
|
|
92
|
-
expect(el.variant).to.equal('');
|
|
93
|
-
expect(el.hasAttribute('variant')).to.be.false;
|
|
94
|
-
el.variant = 'info';
|
|
95
|
-
await elementUpdated(el);
|
|
96
|
-
expect(el.variant).to.equal('info');
|
|
97
|
-
expect(el.getAttribute('variant')).to.equal('info');
|
|
98
|
-
el.variant = 'info';
|
|
99
|
-
await elementUpdated(el);
|
|
100
|
-
expect(el.variant).to.equal('info');
|
|
101
|
-
expect(el.getAttribute('variant')).to.equal('info');
|
|
102
|
-
});
|
|
103
|
-
it('answers tip query', async () => {
|
|
104
|
-
const el = await fixture(html `
|
|
19
|
+
`);await o(t),e(t.variant).to.equal(""),e(t.hasAttribute("variant")).to.be.false,t.variant="info",await o(t),e(t.variant).to.equal("info"),e(t.getAttribute("variant")).to.equal("info"),t.variant="info",await o(t),e(t.variant).to.equal("info"),e(t.getAttribute("variant")).to.equal("info")}),it("answers tip query",async()=>{const t=await i(l`
|
|
105
20
|
<sp-tooltip placement="top">Help text.</sp-tooltip>
|
|
106
|
-
`);
|
|
107
|
-
|
|
108
|
-
const overlayDetailQuery = {};
|
|
109
|
-
const queryOverlayDetailEvent = new CustomEvent('sp-overlay-query', {
|
|
110
|
-
bubbles: true,
|
|
111
|
-
composed: true,
|
|
112
|
-
detail: overlayDetailQuery,
|
|
113
|
-
cancelable: true,
|
|
114
|
-
});
|
|
115
|
-
el.dispatchEvent(queryOverlayDetailEvent);
|
|
116
|
-
expect(overlayDetailQuery.overlayContentTipElement).to.exist;
|
|
117
|
-
if (overlayDetailQuery.overlayContentTipElement) {
|
|
118
|
-
expect(overlayDetailQuery.overlayContentTipElement.id).to.equal('tip');
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
//# sourceMappingURL=tooltip.test.js.map
|
|
21
|
+
`);await o(t);const a={},n=new CustomEvent("sp-overlay-query",{bubbles:!0,composed:!0,detail:a,cancelable:!0});t.dispatchEvent(n),e(a.overlayContentTipElement).to.exist,a.overlayContentTipElement&&e(a.overlayContentTipElement.id).to.equal("tip")})});
|
|
22
|
+
//# sourceMappingURL=tooltip.test.js.map
|
package/test/tooltip.test.js.map
CHANGED
|
@@ -1 +1,7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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*/\n\nimport '../sp-tooltip.js';\nimport { Tooltip } from '../';\nimport { OverlayDisplayQueryDetail } from '@spectrum-web-components/overlay';\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n oneEvent,\n} from '@open-wc/testing';\nimport { Button } from '@spectrum-web-components/button';\nimport '@spectrum-web-components/button/sp-button.js';\n\ndescribe('Tooltip', () => {\n it('loads', async () => {\n const el = await fixture<Tooltip>(\n html`\n <sp-tooltip>Help text.</sp-tooltip>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('self manages', async () => {\n const button = await fixture<Button>(\n html`\n <sp-button>\n This is a button.\n <sp-tooltip self-managed>Help text.</sp-tooltip>\n </sp-button>\n `\n );\n\n const el = button.querySelector('sp-tooltip') as Tooltip;\n\n await elementUpdated(el);\n await expect(button).to.be.accessible();\n\n const opened = oneEvent(button, 'sp-opened');\n button.focus();\n await opened;\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n await expect(button).to.be.accessible();\n\n const closed = oneEvent(button, 'sp-closed');\n button.blur();\n await closed;\n await elementUpdated(el);\n\n expect(el.open).to.be.false;\n });\n it('cleans up when self manages', async () => {\n const button = await fixture<Button>(\n html`\n <sp-button>\n This is a button.\n <sp-tooltip self-managed>Help text.</sp-tooltip>\n </sp-button>\n `\n );\n\n const el = button.querySelector('sp-tooltip') as Tooltip;\n\n await elementUpdated(el);\n\n const opened = oneEvent(button, 'sp-opened');\n button.focus();\n await opened;\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n let activeOverlay = document.querySelector('active-overlay');\n expect(activeOverlay).to.not.be.null;\n\n const closed = oneEvent(button, 'sp-closed');\n button.remove();\n await closed;\n\n activeOverlay = document.querySelector('active-overlay');\n expect(activeOverlay).to.be.null;\n });\n it('accepts variants', async () => {\n const el = await fixture<Tooltip>(\n html`\n <sp-tooltip variant=\"negative\">Help text.</sp-tooltip>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('negative');\n expect(el.getAttribute('variant')).to.equal('negative');\n\n el.variant = 'info';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('info');\n expect(el.getAttribute('variant')).to.equal('info');\n\n el.setAttribute('variant', 'positive');\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('positive');\n expect(el.getAttribute('variant')).to.equal('positive');\n\n el.removeAttribute('variant');\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('');\n expect(el.hasAttribute('variant')).to.be.false;\n });\n it('validates variants', async () => {\n const el = await fixture<Tooltip>(\n html`\n <sp-tooltip variant=\"other\">Help text.</sp-tooltip>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('');\n expect(el.hasAttribute('variant')).to.be.false;\n\n el.variant = 'info';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('info');\n expect(el.getAttribute('variant')).to.equal('info');\n\n el.variant = 'info';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('info');\n expect(el.getAttribute('variant')).to.equal('info');\n });\n\n it('answers tip query', async () => {\n const el = await fixture<Tooltip>(\n html`\n <sp-tooltip placement=\"top\">Help text.</sp-tooltip>\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"]}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tooltip.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 '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport { Tooltip } from '@spectrum-web-components/tooltip';\nimport { OverlayDisplayQueryDetail } from '@spectrum-web-components/overlay';\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n oneEvent,\n} from '@open-wc/testing';\nimport { Button } from '@spectrum-web-components/button';\nimport '@spectrum-web-components/button/sp-button.js';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Tooltip', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<Tooltip>(\n html`\n <sp-tooltip>Help text.</sp-tooltip>\n `\n )\n );\n it('loads', async () => {\n const el = await fixture<Tooltip>(\n html`\n <sp-tooltip>Help text.</sp-tooltip>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('self manages', async () => {\n const button = await fixture<Button>(\n html`\n <sp-button>\n This is a button.\n <sp-tooltip self-managed>Help text.</sp-tooltip>\n </sp-button>\n `\n );\n\n const el = button.querySelector('sp-tooltip') as Tooltip;\n\n await elementUpdated(el);\n await expect(button).to.be.accessible();\n\n const opened = oneEvent(button, 'sp-opened');\n button.focus();\n await opened;\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n await expect(button).to.be.accessible();\n\n const closed = oneEvent(button, 'sp-closed');\n button.blur();\n await closed;\n await elementUpdated(el);\n\n expect(el.open).to.be.false;\n });\n it('cleans up when self manages', async () => {\n const button = await fixture<Button>(\n html`\n <sp-button>\n This is a button.\n <sp-tooltip self-managed>Help text.</sp-tooltip>\n </sp-button>\n `\n );\n\n const el = button.querySelector('sp-tooltip') as Tooltip;\n\n await elementUpdated(el);\n\n const opened = oneEvent(button, 'sp-opened');\n button.focus();\n await opened;\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n let activeOverlay = document.querySelector('active-overlay');\n expect(activeOverlay).to.not.be.null;\n\n const closed = oneEvent(button, 'sp-closed');\n button.remove();\n await closed;\n\n activeOverlay = document.querySelector('active-overlay');\n expect(activeOverlay).to.be.null;\n });\n it('accepts variants', async () => {\n const el = await fixture<Tooltip>(\n html`\n <sp-tooltip variant=\"negative\">Help text.</sp-tooltip>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('negative');\n expect(el.getAttribute('variant')).to.equal('negative');\n\n el.variant = 'info';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('info');\n expect(el.getAttribute('variant')).to.equal('info');\n\n el.setAttribute('variant', 'positive');\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('positive');\n expect(el.getAttribute('variant')).to.equal('positive');\n\n el.removeAttribute('variant');\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('');\n expect(el.hasAttribute('variant')).to.be.false;\n });\n it('validates variants', async () => {\n const el = await fixture<Tooltip>(\n html`\n <sp-tooltip variant=\"other\">Help text.</sp-tooltip>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('');\n expect(el.hasAttribute('variant')).to.be.false;\n\n el.variant = 'info';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('info');\n expect(el.getAttribute('variant')).to.equal('info');\n\n el.variant = 'info';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('info');\n expect(el.getAttribute('variant')).to.equal('info');\n });\n\n it('answers tip query', async () => {\n const el = await fixture<Tooltip>(\n html`\n <sp-tooltip placement=\"top\">Help text.</sp-tooltip>\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"],
|
|
5
|
+
"mappings": "AAYA,uDAGA,mGAQA,qDACA,yEAEA,SAAS,UAAW,IAAM,CACtB,EACI,SACI,KAAM,GACF;AAAA;AAAA,iBAGJ,CACR,EACA,GAAG,QAAS,SAAY,CACpB,KAAM,GAAK,KAAM,GACb;AAAA;AAAA,aAGJ,EAEA,KAAM,GAAe,CAAE,EAEvB,KAAM,GAAO,CAAE,EAAE,GAAG,GAAG,WAAW,CACtC,CAAC,EACD,GAAG,eAAgB,SAAY,CAC3B,KAAM,GAAS,KAAM,GACjB;AAAA;AAAA;AAAA;AAAA;A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