@spectrum-web-components/tooltip 0.11.18-overlay.18 → 0.30.1-overlay.30
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 +4 -4
- package/sp-tooltip.dev.js +2 -1
- package/sp-tooltip.dev.js.map +2 -2
- package/sp-tooltip.js +1 -1
- package/sp-tooltip.js.map +3 -3
- package/src/Tooltip.js.map +1 -1
- package/test/tooltip.test.js +10 -4
- package/test/tooltip.test.js.map +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/tooltip",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.1-overlay.30+1df211c75",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"lit-html"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@spectrum-web-components/base": "^0.
|
|
61
|
-
"@spectrum-web-components/overlay": "^0.
|
|
60
|
+
"@spectrum-web-components/base": "^0.30.1-overlay.30+1df211c75",
|
|
61
|
+
"@spectrum-web-components/overlay": "^0.30.1-overlay.30+1df211c75"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@spectrum-css/tooltip": "^4.0.10"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"./sp-*.js",
|
|
70
70
|
"./**/*.dev.js"
|
|
71
71
|
],
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "1df211c7581b6fd6ec624cf2b09bc81aeec29c26"
|
|
73
73
|
}
|
package/sp-tooltip.dev.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { Tooltip } from "./src/Tooltip.dev.js";
|
|
3
|
-
|
|
3
|
+
import { defineElement } from "@spectrum-web-components/base/src/define-element.js";
|
|
4
|
+
defineElement("sp-tooltip", Tooltip);
|
|
4
5
|
//# sourceMappingURL=sp-tooltip.dev.js.map
|
package/sp-tooltip.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sp-tooltip.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Tooltip } from './src/Tooltip.dev.js'\n\
|
|
5
|
-
"mappings": ";AAWA,SAAS,eAAe;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Tooltip } from './src/Tooltip.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-tooltip', Tooltip);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-tooltip': Tooltip;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAE9B,cAAc,cAAc,OAAO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/sp-tooltip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import{Tooltip as o}from"./src/Tooltip.js";
|
|
1
|
+
"use strict";import{Tooltip as o}from"./src/Tooltip.js";import{defineElement as e}from"@spectrum-web-components/base/src/define-element.js";e("sp-tooltip",o);
|
|
2
2
|
//# sourceMappingURL=sp-tooltip.js.map
|
package/sp-tooltip.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sp-tooltip.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Tooltip } from './src/Tooltip.js';\n\
|
|
5
|
-
"mappings": "aAWA,OAAS,WAAAA,MAAe,
|
|
6
|
-
"names": ["Tooltip"]
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Tooltip } from './src/Tooltip.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-tooltip', Tooltip);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-tooltip': Tooltip;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,WAAAA,MAAe,mBACxB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,aAAcD,CAAO",
|
|
6
|
+
"names": ["Tooltip", "defineElement"]
|
|
7
7
|
}
|
package/src/Tooltip.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Tooltip.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 CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport type { Placement } from '@spectrum-web-components/overlay';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\n\nimport tooltipStyles from './tooltip.css.js';\n\nclass TooltipOpenable extends HTMLElement {\n static get observedAttributes(): string[] {\n return ['open', 'placement'];\n }\n attributeChangedCallback(\n name: 'open' | 'placement',\n _oldValue: string,\n newValue: 'string'\n ): void {\n switch (name) {\n case 'open':\n this.open = newValue !== null;\n break;\n case 'placement':\n this.placement = newValue as Placement;\n break;\n }\n }\n set open(open: boolean) {\n this._open = open;\n const tooltip = (this.getRootNode() as ShadowRoot).host as Tooltip;\n tooltip.open = open;\n }\n get open(): boolean {\n return this._open;\n }\n private _open = false;\n set placement(placement: Placement) {\n this._placement = placement;\n const tooltip = (this.getRootNode() as ShadowRoot).host as Tooltip;\n tooltip.placement = placement;\n }\n get placement(): Placement {\n return this._placement;\n }\n private _placement: Placement = 'top';\n}\n\nif (!customElements.get('sp-tooltip-openable')) {\n customElements.define('sp-tooltip-openable', TooltipOpenable);\n}\n\n/**\n * @element sp-tooltip\n *\n * @slot icon - the icon element appearing at the start of the label\n * @slot - the text label of the Tooltip\n */\n\nexport class Tooltip extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [tooltipStyles];\n }\n\n /**\n * @private\n */\n static instanceCount = 0;\n\n @property({ type: Boolean, attribute: 'self-managed' })\n public selfManaged = false;\n\n @property({ type: Number, reflect: true })\n public offset = 6;\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 = 'top';\n\n @query('#tip')\n public tipElement!: HTMLSpanElement;\n\n /* Ensure that a '' value for `variant` removes the attribute instead of a blank value */\n private _variant = '';\n\n @property({ type: String })\n public get variant(): string {\n return this._variant;\n }\n public set variant(variant: string) {\n if (variant === this.variant) {\n return;\n }\n if (['info', 'positive', 'negative'].includes(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n return;\n }\n this.removeAttribute('variant');\n this._variant = '';\n }\n\n private handleOpenOverlay = (): void => {\n this.open = true;\n };\n\n protected handleCloseOverlay = (): void => {\n this.open = false;\n };\n\n protected handleTransitionrun(event: TransitionEvent): void {\n this.dispatchEvent(\n new TransitionEvent('transitionrun', {\n bubbles: true,\n composed: true,\n propertyName: event.propertyName,\n })\n );\n }\n\n protected handleTransitionend(event: TransitionEvent): void {\n this.dispatchEvent(\n new TransitionEvent('transitionend', {\n bubbles: true,\n composed: true,\n propertyName: event.propertyName,\n })\n );\n }\n\n override render(): TemplateResult {\n const tooltip = html`\n <sp-tooltip-openable\n id=\"tooltip\"\n @transitionrun=${this.handleTransitionrun}\n @transitionend=${this.handleTransitionend}\n >\n <slot name=\"icon\"></slot>\n <span id=\"label\"><slot></slot></span>\n <span id=\"tip\"></span>\n </sp-tooltip-openable>\n `;\n if (this.selfManaged) {\n return html`\n <sp-overlay\n ?open=${this.open}\n offset=${this.offset}\n type=\"hint\"\n .placement=${this.placement}\n .triggerElement=${this.parentElement}\n .triggerInteraction=${'hover'}\n @sp-opened=${this.handleOpenOverlay}\n @sp-closed=${this.handleCloseOverlay}\n >\n ${tooltip}\n </sp-overlay>\n `;\n } else {\n return tooltip;\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,EACA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDAEP,MAAO,iDAEP,OAAOC,MAAmB,mBAE1B,MAAMC,UAAwB,WAAY,CAA1C,kCA0BI,KAAQ,MAAQ,GAShB,KAAQ,WAAwB,MAlChC,WAAW,oBAA+B,CACtC,MAAO,CAAC,OAAQ,WAAW,CAC/B,CACA,yBACIC,EACAC,EACAC,EACI,CACJ,OAAQF,EAAM,CACV,IAAK,OACD,KAAK,KAAOE,IAAa,KACzB,MACJ,IAAK,YACD,KAAK,UAAYA,EACjB,KACR,CACJ,CACA,IAAI,KAAKC,EAAe,CACpB,KAAK,MAAQA,EACb,MAAMC,EAAW,KAAK,YAAY,EAAiB,KACnDA,EAAQ,KAAOD,CACnB,CACA,IAAI,MAAgB,CAChB,OAAO,KAAK,KAChB,CAEA,IAAI,UAAUE,EAAsB,CAChC,KAAK,WAAaA,EAClB,MAAMD,EAAW,KAAK,YAAY,EAAiB,KACnDA,EAAQ,UAAYC,CACxB,CACA,IAAI,WAAuB,CACvB,OAAO,KAAK,UAChB,CAEJ,CAEK,eAAe,IAAI,qBAAqB,GACzC,eAAe,OAAO,sBAAuBN,CAAe,EAUzD,aAAM,gBAAgBJ,CAAgB,CAAtC,kCAWH,KAAO,YAAc,GAGrB,KAAO,OAAS,EAGhB,KAAO,KAAO,GAOd,KAAO,UAAuB,MAM9B,KAAQ,SAAW,GAmBnB,KAAQ,kBAAoB,IAAY,CACpC,KAAK,KAAO,EAChB,EAEA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AAK,CAAC,GAhBjC,QAiBF,oBAOAY,EAAA,CADNZ,EAAS,CAAE,QAAS,EAAK,CAAC,GAvBlB,QAwBF,yBAGAY,EAAA,CADNX,EAAM,MAAM,GA1BJ,QA2BF,0BAMIW,EAAA,CADVZ,EAAS,CAAE,KAAM,MAAO,CAAC,GAhCjB,QAiCE",
|
|
6
6
|
"names": ["html", "SpectrumElement", "property", "query", "tooltipStyles", "TooltipOpenable", "name", "_oldValue", "newValue", "open", "tooltip", "placement", "variant", "event", "__decorateClass"]
|
|
7
7
|
}
|
package/test/tooltip.test.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "@open-wc/testing";
|
|
10
10
|
import "@spectrum-web-components/button/sp-button.js";
|
|
11
11
|
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
12
|
+
import { sendMouse } from "../../../test/plugins/browser.js";
|
|
12
13
|
describe("Tooltip", () => {
|
|
13
14
|
testForLitDevWarnings(
|
|
14
15
|
async () => await fixture(
|
|
@@ -27,6 +28,14 @@ describe("Tooltip", () => {
|
|
|
27
28
|
await expect(el).to.be.accessible();
|
|
28
29
|
});
|
|
29
30
|
it("self manages", async () => {
|
|
31
|
+
await sendMouse({
|
|
32
|
+
steps: [
|
|
33
|
+
{
|
|
34
|
+
type: "move",
|
|
35
|
+
position: [1, 1]
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
});
|
|
30
39
|
const button = await fixture(
|
|
31
40
|
html`
|
|
32
41
|
<sp-button>
|
|
@@ -41,13 +50,11 @@ describe("Tooltip", () => {
|
|
|
41
50
|
const opened = oneEvent(button, "sp-opened");
|
|
42
51
|
button.focus();
|
|
43
52
|
await opened;
|
|
44
|
-
await elementUpdated(el);
|
|
45
53
|
expect(el.open).to.be.true;
|
|
46
54
|
await expect(button).to.be.accessible();
|
|
47
55
|
const closed = oneEvent(button, "sp-closed");
|
|
48
56
|
button.blur();
|
|
49
57
|
await closed;
|
|
50
|
-
await elementUpdated(el);
|
|
51
58
|
expect(el.open).to.be.false;
|
|
52
59
|
});
|
|
53
60
|
it("cleans up when self manages", async () => {
|
|
@@ -72,7 +79,7 @@ describe("Tooltip", () => {
|
|
|
72
79
|
await closed;
|
|
73
80
|
expect(el.open).to.be.false;
|
|
74
81
|
});
|
|
75
|
-
|
|
82
|
+
it("cleans up when self managed and removed", async () => {
|
|
76
83
|
const button = await fixture(
|
|
77
84
|
html`
|
|
78
85
|
<sp-button>
|
|
@@ -87,7 +94,6 @@ describe("Tooltip", () => {
|
|
|
87
94
|
const opened = oneEvent(button, "sp-opened");
|
|
88
95
|
button.focus();
|
|
89
96
|
await opened;
|
|
90
|
-
await elementUpdated(el);
|
|
91
97
|
expect(el.open).to.be.true;
|
|
92
98
|
const closed = oneEvent(button, "sp-closed");
|
|
93
99
|
button.remove();
|
package/test/tooltip.test.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 {\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
|
|
5
|
-
"mappings": ";AAYA,OAAO;AAEP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AACP,SAAS,6BAA6B;
|
|
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 {\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';\nimport { sendMouse } from '../../../test/plugins/browser.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 await sendMouse({\n steps: [\n {\n type: 'move',\n position: [1, 1],\n },\n ],\n });\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\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\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 expect(el.open).to.be.false;\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\n const closed = oneEvent(button, 'sp-closed');\n button.blur();\n await closed;\n\n expect(el.open).to.be.false;\n });\n it('cleans up when self managed and removed', 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 expect(el.open).to.be.false;\n const opened = oneEvent(button, 'sp-opened');\n button.focus();\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(button, 'sp-closed');\n button.remove();\n await closed;\n\n expect(el.open).to.be.false;\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('surfaces tip element', 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 expect(typeof el.tipElement).to.not.equal('undefined');\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,OAAO;AAEP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AACP,SAAS,6BAA6B;AACtC,SAAS,iBAAiB;AAE1B,SAAS,WAAW,MAAM;AACtB;AAAA,IACI,YACI,MAAM;AAAA,MACF;AAAA;AAAA;AAAA,IAGJ;AAAA,EACR;AACA,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,gBAAgB,YAAY;AAC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