@spectrum-web-components/alert-banner 0.44.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/LICENSE +201 -0
- package/README.md +99 -0
- package/custom-elements.json +262 -0
- package/package.json +74 -0
- package/sp-alert-banner.d.ts +6 -0
- package/sp-alert-banner.dev.js +5 -0
- package/sp-alert-banner.dev.js.map +7 -0
- package/sp-alert-banner.js +2 -0
- package/sp-alert-banner.js.map +7 -0
- package/src/AlertBanner.d.ts +46 -0
- package/src/AlertBanner.dev.js +139 -0
- package/src/AlertBanner.dev.js.map +7 -0
- package/src/AlertBanner.js +26 -0
- package/src/AlertBanner.js.map +7 -0
- package/src/alert-banner.css.d.ts +2 -0
- package/src/alert-banner.css.dev.js +7 -0
- package/src/alert-banner.css.dev.js.map +7 -0
- package/src/alert-banner.css.js +4 -0
- package/src/alert-banner.css.js.map +7 -0
- package/src/index.d.ts +1 -0
- package/src/index.dev.js +3 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/spectrum-alert-banner.css.d.ts +2 -0
- package/src/spectrum-alert-banner.css.dev.js +7 -0
- package/src/spectrum-alert-banner.css.dev.js.map +7 -0
- package/src/spectrum-alert-banner.css.js +4 -0
- package/src/spectrum-alert-banner.css.js.map +7 -0
- package/src/spectrum-config.js +48 -0
- package/stories/alert-banner.stories.js +47 -0
- package/stories/alert-banner.stories.js.map +7 -0
- package/stories/args.js +51 -0
- package/stories/args.js.map +7 -0
- package/stories/index.js +23 -0
- package/stories/index.js.map +7 -0
- package/stories/template.js +4 -0
- package/stories/template.js.map +7 -0
- package/test/alert-banner-memory.test.js +5 -0
- package/test/alert-banner-memory.test.js.map +7 -0
- package/test/alert-banner.test-vrt.js +5 -0
- package/test/alert-banner.test-vrt.js.map +7 -0
- package/test/alert-banner.test.js +162 -0
- package/test/alert-banner.test.js.map +7 -0
- package/test/benchmark/basic-test.js +8 -0
- package/test/benchmark/basic-test.js.map +7 -0
package/stories/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import "@spectrum-web-components/alert-banner/sp-alert-banner.js";
|
|
4
|
+
import "@spectrum-web-components/button/sp-button.js";
|
|
5
|
+
export const AlertBannerMarkup = ({
|
|
6
|
+
text = "Your trial has expired",
|
|
7
|
+
variant = "neutral",
|
|
8
|
+
dismissible = true,
|
|
9
|
+
open = false,
|
|
10
|
+
actionLabel = "Action"
|
|
11
|
+
}) => html`
|
|
12
|
+
<sp-alert-banner
|
|
13
|
+
variant=${variant}
|
|
14
|
+
?dismissible=${dismissible}
|
|
15
|
+
?open=${open}
|
|
16
|
+
>
|
|
17
|
+
${text}
|
|
18
|
+
<sp-button treatment="outline" static="white" slot="action">
|
|
19
|
+
${actionLabel}
|
|
20
|
+
</sp-button>
|
|
21
|
+
</sp-alert-banner>
|
|
22
|
+
`;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport { AlertBannerVariants } from '@spectrum-web-components/alert-banner';\nimport '@spectrum-web-components/alert-banner/sp-alert-banner.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nexport const AlertBannerMarkup = ({\n text = 'Your trial has expired',\n variant = 'neutral',\n dismissible = true,\n open = false,\n actionLabel = 'Action',\n}): TemplateResult => html`\n <sp-alert-banner\n variant=${variant as AlertBannerVariants}\n ?dismissible=${dismissible}\n ?open=${open}\n >\n ${text}\n <sp-button treatment=\"outline\" static=\"white\" slot=\"action\">\n ${actionLabel}\n </sp-button>\n </sp-alert-banner>\n`;\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,YAA4B;AAGrC,OAAO;AACP,OAAO;AAEA,aAAM,oBAAoB,CAAC;AAAA,EAC9B,OAAO;AAAA,EACP,UAAU;AAAA,EACV,cAAc;AAAA,EACd,OAAO;AAAA,EACP,cAAc;AAClB,MAAsB;AAAA;AAAA,kBAEJ,OAA8B;AAAA,uBACzB,WAAW;AAAA,gBAClB,IAAI;AAAA;AAAA,UAEV,IAAI;AAAA;AAAA,cAEA,WAAW;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["template.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { AlertBannerMarkup } from './';\n\nexport const Template = AlertBannerMarkup;\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,yBAAyB;AAE3B,aAAM,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["alert-banner-memory.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 Props, { Default } from '../stories/alert-banner.stories.js';\nimport { testForMemoryLeaks } from '../../../test/testing-helpers.js';\n\ntestForMemoryLeaks(Default(Props.args));\n"],
|
|
5
|
+
"mappings": ";AAYA,OAAO,SAAS,eAAe;AAC/B,SAAS,0BAA0B;AAEnC,mBAAmB,QAAQ,MAAM,IAAI,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["alert-banner.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/alert-banner.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('AlertBannerStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,sBAAsB,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
|
|
3
|
+
import { sendKeys } from "@web/test-runner-commands";
|
|
4
|
+
import { spy, stub } from "sinon";
|
|
5
|
+
import "@spectrum-web-components/alert-banner/sp-alert-banner.js";
|
|
6
|
+
import "@spectrum-web-components/button/sp-button.js";
|
|
7
|
+
import {
|
|
8
|
+
escapeEvent,
|
|
9
|
+
testForLitDevWarnings
|
|
10
|
+
} from "../../../test/testing-helpers.js";
|
|
11
|
+
describe("AlertBanner", () => {
|
|
12
|
+
testForLitDevWarnings(
|
|
13
|
+
async () => await fixture(html`
|
|
14
|
+
<sp-alert-banner>Your trial will expire soon</sp-alert-banner>
|
|
15
|
+
`)
|
|
16
|
+
);
|
|
17
|
+
it("loads default alert-banner accessibly", async () => {
|
|
18
|
+
const el = await fixture(html`
|
|
19
|
+
<sp-alert-banner open>Your trial will expire soon</sp-alert-banner>
|
|
20
|
+
`);
|
|
21
|
+
await elementUpdated(el);
|
|
22
|
+
await expect(el).to.be.accessible();
|
|
23
|
+
});
|
|
24
|
+
it("accepts variants", async () => {
|
|
25
|
+
const el = await fixture(html`
|
|
26
|
+
<sp-alert-banner open variant="info">
|
|
27
|
+
Your trial will expire soon
|
|
28
|
+
</sp-alert-banner>
|
|
29
|
+
`);
|
|
30
|
+
await elementUpdated(el);
|
|
31
|
+
expect(el.getAttribute("variant")).to.equal("info");
|
|
32
|
+
expect(el.shadowRoot.querySelector("sp-icon-info")).to.exist;
|
|
33
|
+
el.variant = "negative";
|
|
34
|
+
await elementUpdated(el);
|
|
35
|
+
expect(el.getAttribute("variant")).to.equal("negative");
|
|
36
|
+
expect(el.shadowRoot.querySelector("sp-icon-alert")).to.exist;
|
|
37
|
+
});
|
|
38
|
+
it("removes variant attribute when given invalid variant", async () => {
|
|
39
|
+
const el = await fixture(html`
|
|
40
|
+
<sp-alert-banner open variant="inexistent">
|
|
41
|
+
Your trial will expire soon
|
|
42
|
+
</sp-alert-banner>
|
|
43
|
+
`);
|
|
44
|
+
await elementUpdated(el);
|
|
45
|
+
expect(el.getAttribute("variant")).to.be.null;
|
|
46
|
+
});
|
|
47
|
+
it("calls corresponding handler using Space or Enter key for actionable alerts", async () => {
|
|
48
|
+
const actionSpy = spy();
|
|
49
|
+
const el = await fixture(html`
|
|
50
|
+
<sp-alert-banner open>
|
|
51
|
+
Your trial will expire soon
|
|
52
|
+
<sp-button slot="action" @click=${() => actionSpy()}>
|
|
53
|
+
Buy now
|
|
54
|
+
</sp-button>
|
|
55
|
+
</sp-alert-banner>
|
|
56
|
+
`);
|
|
57
|
+
await elementUpdated(el);
|
|
58
|
+
const buttonEl = el.querySelector("sp-button");
|
|
59
|
+
expect(buttonEl).to.exist;
|
|
60
|
+
buttonEl == null ? void 0 : buttonEl.focus();
|
|
61
|
+
await sendKeys({ press: "Enter" });
|
|
62
|
+
await elementUpdated(el);
|
|
63
|
+
expect(actionSpy).to.be.calledOnce;
|
|
64
|
+
buttonEl == null ? void 0 : buttonEl.focus();
|
|
65
|
+
await sendKeys({ press: "Space" });
|
|
66
|
+
await elementUpdated(el);
|
|
67
|
+
expect(actionSpy).to.be.calledTwice;
|
|
68
|
+
});
|
|
69
|
+
describe("dismiss behavior", () => {
|
|
70
|
+
it("can be dismissed by clicking the close button", async () => {
|
|
71
|
+
const el = await fixture(html`
|
|
72
|
+
<sp-alert-banner open dismissible>
|
|
73
|
+
Your trial will expire soon
|
|
74
|
+
</sp-alert-banner>
|
|
75
|
+
`);
|
|
76
|
+
await elementUpdated(el);
|
|
77
|
+
const closeButton = el.shadowRoot.querySelector("sp-close-button");
|
|
78
|
+
expect(closeButton).to.exist;
|
|
79
|
+
expect(el.open).to.be.true;
|
|
80
|
+
closeButton == null ? void 0 : closeButton.click();
|
|
81
|
+
await elementUpdated(el);
|
|
82
|
+
expect(el.open).to.be.false;
|
|
83
|
+
});
|
|
84
|
+
it("can be dismissed using close button", async () => {
|
|
85
|
+
const el = await fixture(html`
|
|
86
|
+
<sp-alert-banner open>
|
|
87
|
+
Your trial will expire soon
|
|
88
|
+
</sp-alert-banner>
|
|
89
|
+
`);
|
|
90
|
+
await elementUpdated(el);
|
|
91
|
+
const closeButton = el.shadowRoot.querySelector("sp-close-button");
|
|
92
|
+
expect(closeButton).to.not.exist;
|
|
93
|
+
expect(el.open).to.be.true;
|
|
94
|
+
el.close();
|
|
95
|
+
await elementUpdated(el);
|
|
96
|
+
expect(el.open).to.be.false;
|
|
97
|
+
});
|
|
98
|
+
it("prevent close", async () => {
|
|
99
|
+
const closeSpy = spy();
|
|
100
|
+
const el = await fixture(html`
|
|
101
|
+
<sp-alert-banner
|
|
102
|
+
open
|
|
103
|
+
dismissible
|
|
104
|
+
@close=${(event) => {
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
closeSpy();
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
Your trial will expire soon
|
|
110
|
+
</sp-alert-banner>
|
|
111
|
+
`);
|
|
112
|
+
await elementUpdated(el);
|
|
113
|
+
const closeButton = el.shadowRoot.querySelector("sp-close-button");
|
|
114
|
+
expect(el.open).to.be.true;
|
|
115
|
+
closeButton == null ? void 0 : closeButton.click();
|
|
116
|
+
await elementUpdated(el);
|
|
117
|
+
expect(el.open).to.be.true;
|
|
118
|
+
expect(closeSpy).to.be.calledOnce;
|
|
119
|
+
});
|
|
120
|
+
it("can be closed using Escape key", async () => {
|
|
121
|
+
const closeSpy = spy();
|
|
122
|
+
const el = await fixture(html`
|
|
123
|
+
<sp-alert-banner open dismissible @close=${() => closeSpy()}>
|
|
124
|
+
Your trial will expire soon
|
|
125
|
+
</sp-alert-banner>
|
|
126
|
+
`);
|
|
127
|
+
await elementUpdated(el);
|
|
128
|
+
expect(el.open).to.be.true;
|
|
129
|
+
el.dispatchEvent(escapeEvent());
|
|
130
|
+
await elementUpdated(el);
|
|
131
|
+
expect(el.open).to.be.false;
|
|
132
|
+
expect(closeSpy).to.be.calledOnce;
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
describe("dev mode", () => {
|
|
136
|
+
let consoleStub;
|
|
137
|
+
before(() => {
|
|
138
|
+
window.__swc.verbose = true;
|
|
139
|
+
consoleStub = stub(console, "warn");
|
|
140
|
+
});
|
|
141
|
+
after(() => {
|
|
142
|
+
window.__swc.verbose = false;
|
|
143
|
+
consoleStub.restore();
|
|
144
|
+
});
|
|
145
|
+
it("should log dev warning when given invalid variant", async () => {
|
|
146
|
+
const el = await fixture(html`
|
|
147
|
+
<sp-alert-banner open variant="inexistent">
|
|
148
|
+
Your trial will expire soon
|
|
149
|
+
</sp-alert-banner>
|
|
150
|
+
`);
|
|
151
|
+
await elementUpdated(el);
|
|
152
|
+
const warning = consoleStub.getCall(0).args.at(0);
|
|
153
|
+
const expectedContent = `<sp-alert-banner> element expects the "variant" attribute to be one of the following`;
|
|
154
|
+
expect(consoleStub).to.be.calledOnce;
|
|
155
|
+
expect(warning.includes(expectedContent)).to.be.true;
|
|
156
|
+
expect(warning.includes("neutral")).to.be.true;
|
|
157
|
+
expect(warning.includes("info")).to.be.true;
|
|
158
|
+
expect(warning.includes("negative")).to.be.true;
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
//# sourceMappingURL=alert-banner.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["alert-banner.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { SinonStub, spy, stub } from 'sinon';\n\nimport '@spectrum-web-components/alert-banner/sp-alert-banner.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport { AlertBanner } from '@spectrum-web-components/alert-banner';\nimport {\n escapeEvent,\n testForLitDevWarnings,\n} from '../../../test/testing-helpers.js';\n\ndescribe('AlertBanner', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<AlertBanner>(html`\n <sp-alert-banner>Your trial will expire soon</sp-alert-banner>\n `)\n );\n it('loads default alert-banner accessibly', async () => {\n const el = await fixture<AlertBanner>(html`\n <sp-alert-banner open>Your trial will expire soon</sp-alert-banner>\n `);\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('accepts variants', async () => {\n const el = await fixture<AlertBanner>(html`\n <sp-alert-banner open variant=\"info\">\n Your trial will expire soon\n </sp-alert-banner>\n `);\n\n await elementUpdated(el);\n\n expect(el.getAttribute('variant')).to.equal('info');\n expect(el.shadowRoot.querySelector('sp-icon-info')).to.exist;\n\n el.variant = 'negative';\n await elementUpdated(el);\n\n expect(el.getAttribute('variant')).to.equal('negative');\n expect(el.shadowRoot.querySelector('sp-icon-alert')).to.exist;\n });\n it('removes variant attribute when given invalid variant', async () => {\n const el = await fixture<AlertBanner>(html`\n <sp-alert-banner open variant=\"inexistent\">\n Your trial will expire soon\n </sp-alert-banner>\n `);\n\n await elementUpdated(el);\n\n expect(el.getAttribute('variant')).to.be.null;\n });\n it('calls corresponding handler using Space or Enter key for actionable alerts', async () => {\n const actionSpy = spy();\n const el = await fixture<AlertBanner>(html`\n <sp-alert-banner open>\n Your trial will expire soon\n <sp-button slot=\"action\" @click=${() => actionSpy()}>\n Buy now\n </sp-button>\n </sp-alert-banner>\n `);\n await elementUpdated(el);\n\n const buttonEl = el.querySelector('sp-button');\n expect(buttonEl).to.exist;\n\n buttonEl?.focus();\n await sendKeys({ press: 'Enter' });\n await elementUpdated(el);\n\n expect(actionSpy).to.be.calledOnce;\n\n buttonEl?.focus();\n await sendKeys({ press: 'Space' });\n await elementUpdated(el);\n\n expect(actionSpy).to.be.calledTwice;\n });\n\n describe('dismiss behavior', () => {\n it('can be dismissed by clicking the close button', async () => {\n const el = await fixture<AlertBanner>(html`\n <sp-alert-banner open dismissible>\n Your trial will expire soon\n </sp-alert-banner>\n `);\n\n await elementUpdated(el);\n\n const closeButton = el.shadowRoot.querySelector('sp-close-button');\n\n expect(closeButton).to.exist;\n expect(el.open).to.be.true;\n\n closeButton?.click();\n await elementUpdated(el);\n\n expect(el.open).to.be.false;\n });\n it('can be dismissed using close button', async () => {\n const el = await fixture<AlertBanner>(html`\n <sp-alert-banner open>\n Your trial will expire soon\n </sp-alert-banner>\n `);\n\n await elementUpdated(el);\n\n const closeButton = el.shadowRoot.querySelector('sp-close-button');\n\n expect(closeButton).to.not.exist;\n expect(el.open).to.be.true;\n\n el.close();\n await elementUpdated(el);\n\n expect(el.open).to.be.false;\n });\n it('prevent close', async () => {\n const closeSpy = spy();\n const el = await fixture<AlertBanner>(html`\n <sp-alert-banner\n open\n dismissible\n @close=${(event: CustomEvent) => {\n event.preventDefault();\n closeSpy();\n }}\n >\n Your trial will expire soon\n </sp-alert-banner>\n `);\n\n await elementUpdated(el);\n\n const closeButton = el.shadowRoot.querySelector('sp-close-button');\n expect(el.open).to.be.true;\n\n closeButton?.click();\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n expect(closeSpy).to.be.calledOnce;\n });\n it('can be closed using Escape key', async () => {\n const closeSpy = spy();\n const el = await fixture<AlertBanner>(html`\n <sp-alert-banner open dismissible @close=${() => closeSpy()}>\n Your trial will expire soon\n </sp-alert-banner>\n `);\n\n await elementUpdated(el);\n expect(el.open).to.be.true;\n\n el.dispatchEvent(escapeEvent());\n await elementUpdated(el);\n\n expect(el.open).to.be.false;\n expect(closeSpy).to.be.calledOnce;\n });\n });\n\n describe('dev mode', () => {\n let consoleStub: SinonStub;\n before(() => {\n window.__swc.verbose = true;\n consoleStub = stub(console, 'warn');\n });\n\n after(() => {\n window.__swc.verbose = false;\n consoleStub.restore();\n });\n\n it('should log dev warning when given invalid variant', async () => {\n const el = await fixture<AlertBanner>(html`\n <sp-alert-banner open variant=\"inexistent\">\n Your trial will expire soon\n </sp-alert-banner>\n `);\n\n await elementUpdated(el);\n\n const warning = consoleStub.getCall(0).args.at(0);\n const expectedContent = `<sp-alert-banner> element expects the \"variant\" attribute to be one of the following`;\n\n expect(consoleStub).to.be.calledOnce;\n expect(warning.includes(expectedContent)).to.be.true;\n expect(warning.includes('neutral')).to.be.true;\n expect(warning.includes('info')).to.be.true;\n expect(warning.includes('negative')).to.be.true;\n });\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AACtD,SAAS,gBAAgB;AACzB,SAAoB,KAAK,YAAY;AAErC,OAAO;AACP,OAAO;AAEP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEP,SAAS,eAAe,MAAM;AAC1B;AAAA,IACI,YACI,MAAM,QAAqB;AAAA;AAAA,aAE1B;AAAA,EACT;AACA,KAAG,yCAAyC,YAAY;AACpD,UAAM,KAAK,MAAM,QAAqB;AAAA;AAAA,SAErC;AAED,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,oBAAoB,YAAY;AAC/B,UAAM,KAAK,MAAM,QAAqB;AAAA;AAAA;AAAA;AAAA,SAIrC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,aAAa,SAAS,CAAC,EAAE,GAAG,MAAM,MAAM;AAClD,WAAO,GAAG,WAAW,cAAc,cAAc,CAAC,EAAE,GAAG;AAEvD,OAAG,UAAU;AACb,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,aAAa,SAAS,CAAC,EAAE,GAAG,MAAM,UAAU;AACtD,WAAO,GAAG,WAAW,cAAc,eAAe,CAAC,EAAE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D,YAAY;AAChE,YAAM,KAAK,MAAM,QAAqB;AAAA;AAAA;AAAA;AAAA,aAIrC;AAED,YAAM,eAAe,EAAE;AAEvB,YAAM,UAAU,YAAY,QAAQ,CAAC,EAAE,KAAK,GAAG,CAAC;AAChD,YAAM,kBAAkB;AAExB,aAAO,WAAW,EAAE,GAAG,GAAG;AAC1B,aAAO,QAAQ,SAAS,eAAe,CAAC,EAAE,GAAG,GAAG;AAChD,aAAO,QAAQ,SAAS,SAAS,CAAC,EAAE,GAAG,GAAG;AAC1C,aAAO,QAAQ,SAAS,MAAM,CAAC,EAAE,GAAG,GAAG;AACvC,aAAO,QAAQ,SAAS,UAAU,CAAC,EAAE,GAAG,GAAG;AAAA,IAC/C,CAAC;AAAA,EACL,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/alert-banner/sp-alert-banner.js";
|
|
3
|
+
import { html } from "@spectrum-web-components/base";
|
|
4
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
5
|
+
measureFixtureCreation(html`
|
|
6
|
+
<sp-alert-banner open>Sample content</sp-alert-banner>
|
|
7
|
+
`);
|
|
8
|
+
//# sourceMappingURL=basic-test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["basic-test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 '@spectrum-web-components/alert-banner/sp-alert-banner.js';\nimport { html } from '@spectrum-web-components/base';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-alert-banner open>Sample content</sp-alert-banner>\n`);\n"],
|
|
5
|
+
"mappings": ";AAWA,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA,CAEtB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|