@spectrum-web-components/badge 0.1.4-devmode.7 → 0.2.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 +4 -4
- package/package.json +4 -4
- package/src/Badge.dev.js +3 -1
- package/src/Badge.dev.js.map +2 -2
- package/src/Badge.js +3 -1
- package/src/Badge.js.map +2 -2
- package/test/badge.test.js +36 -0
- package/test/badge.test.js.map +2 -2
package/custom-elements.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"modules": [
|
|
5
5
|
{
|
|
6
6
|
"kind": "javascript-module",
|
|
7
|
-
"path": "sp-badge.
|
|
7
|
+
"path": "sp-badge.js",
|
|
8
8
|
"declarations": [],
|
|
9
9
|
"exports": [
|
|
10
10
|
{
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"kind": "javascript-module",
|
|
22
|
-
"path": "src/Badge.
|
|
22
|
+
"path": "src/Badge.js",
|
|
23
23
|
"declarations": [
|
|
24
24
|
{
|
|
25
25
|
"kind": "variable",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"name": "BADGE_VARIANTS",
|
|
91
91
|
"declaration": {
|
|
92
92
|
"name": "BADGE_VARIANTS",
|
|
93
|
-
"module": "src/Badge.
|
|
93
|
+
"module": "src/Badge.js"
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
{
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"name": "Badge",
|
|
99
99
|
"declaration": {
|
|
100
100
|
"name": "Badge",
|
|
101
|
-
"module": "src/Badge.
|
|
101
|
+
"module": "src/Badge.js"
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/badge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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/shared": "^0.14.5
|
|
60
|
+
"@spectrum-web-components/base": "^0.6.0",
|
|
61
|
+
"@spectrum-web-components/shared": "^0.14.5",
|
|
62
62
|
"tslib": "^2.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"sideEffects": [
|
|
70
70
|
"./sp-*.js"
|
|
71
71
|
],
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "50cac779bbb0d6735c2061f1eceb86b9daf9b22b"
|
|
73
73
|
}
|
package/src/Badge.dev.js
CHANGED
|
@@ -40,7 +40,9 @@ export class Badge extends SizedMixin(ObserveSlotText(SpectrumElement, "")) {
|
|
|
40
40
|
render() {
|
|
41
41
|
if (true) {
|
|
42
42
|
if (!BADGE_VARIANTS.includes(this.variant)) {
|
|
43
|
-
window.__swc.
|
|
43
|
+
window.__swc.warn(this, `<${this.localName}> element expect the "variant" attribute to be one of the following:`, "https://opensource.adobe.com/spectrum-web-components/components/badge/#variants", {
|
|
44
|
+
issues: [...BADGE_VARIANTS]
|
|
45
|
+
});
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
return html`
|
package/src/Badge.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Badge.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 {\n CSSResultArray,\n html,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport styles from './badge.css.js';\n\nexport const BADGE_VARIANTS = [\n 'neutral',\n 'informative',\n 'positive',\n 'negative',\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n] as const;\nexport type BadgeVariant = typeof BADGE_VARIANTS[number];\n\n/**\n * @element sp-badge\n *\n * @slot - Text label of the badge\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport class Badge extends SizedMixin(ObserveSlotText(SpectrumElement, '')) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'informative';\n\n protected override render(): TemplateResult {\n if (window.__swc.DEBUG) {\n if (!BADGE_VARIANTS.includes(this.variant)) {\n window.__swc.
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAAA;AAOA;AAEA;AACA;AAEO,aAAM,iBAAiB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AASO,aAAM,cAAc,WAAW,gBAAgB,iBAAiB,EAAE,CAAC,EAAE;AAAA,EAArE;AAAA;AAMI,mBAAwB;AAAA;AAAA,aALJ,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAKmB,SAAyB;AACxC,QAAI,MAAoB;AACpB,UAAI,CAAC,eAAe,SAAS,KAAK,OAAO,GAAG;AACxC,eAAO,MAAM,
|
|
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 SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport styles from './badge.css.js';\n\nexport const BADGE_VARIANTS = [\n 'neutral',\n 'informative',\n 'positive',\n 'negative',\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n] as const;\nexport type BadgeVariant = typeof BADGE_VARIANTS[number];\n\n/**\n * @element sp-badge\n *\n * @slot - Text label of the badge\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport class Badge extends SizedMixin(ObserveSlotText(SpectrumElement, '')) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'informative';\n\n protected override render(): TemplateResult {\n if (window.__swc.DEBUG) {\n if (!BADGE_VARIANTS.includes(this.variant)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expect the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...BADGE_VARIANTS]\n },\n );\n }\n }\n return html`\n <slot name=\"icon\" ?icon-only=${!this.slotHasContent}></slot>\n <div id=\"label\">\n <slot></slot>\n </div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAAA;AAOA;AAEA;AACA;AAEO,aAAM,iBAAiB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AASO,aAAM,cAAc,WAAW,gBAAgB,iBAAiB,EAAE,CAAC,EAAE;AAAA,EAArE;AAAA;AAMI,mBAAwB;AAAA;AAAA,aALJ,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAKmB,SAAyB;AACxC,QAAI,MAAoB;AACpB,UAAI,CAAC,eAAe,SAAS,KAAK,OAAO,GAAG;AACxC,eAAO,MAAM,KACT,MACA,IAAI,KAAK,iFACT,mFACA;AAAA,UACI,QAAQ,CAAC,GAAG,cAAc;AAAA,QAC9B,CACJ;AAAA,MACJ;AAAA,IACJ;AACA,WAAO;AAAA,2CAC4B,CAAC,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7C;AACJ;AAtBW;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAClC,AANJ,MAMI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Badge.js
CHANGED
|
@@ -40,7 +40,9 @@ export class Badge extends SizedMixin(ObserveSlotText(SpectrumElement, "")) {
|
|
|
40
40
|
render() {
|
|
41
41
|
if (false) {
|
|
42
42
|
if (!BADGE_VARIANTS.includes(this.variant)) {
|
|
43
|
-
window.__swc.
|
|
43
|
+
window.__swc.warn(this, `<${this.localName}> element expect the "variant" attribute to be one of the following:`, "https://opensource.adobe.com/spectrum-web-components/components/badge/#variants", {
|
|
44
|
+
issues: [...BADGE_VARIANTS]
|
|
45
|
+
});
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
return html`
|
package/src/Badge.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Badge.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 {\n CSSResultArray,\n html,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport styles from './badge.css.js';\n\nexport const BADGE_VARIANTS = [\n 'neutral',\n 'informative',\n 'positive',\n 'negative',\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n] as const;\nexport type BadgeVariant = typeof BADGE_VARIANTS[number];\n\n/**\n * @element sp-badge\n *\n * @slot - Text label of the badge\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport class Badge extends SizedMixin(ObserveSlotText(SpectrumElement, '')) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'informative';\n\n protected override render(): TemplateResult {\n if (window.__swc.DEBUG) {\n if (!BADGE_VARIANTS.includes(this.variant)) {\n window.__swc.
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAAA;AAOA;AAEA;AACA;AAEO,aAAM,iBAAiB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AASO,aAAM,cAAc,WAAW,gBAAgB,iBAAiB,EAAE,CAAC,EAAE;AAAA,EAArE;AAAA;AAMI,mBAAwB;AAAA;AAAA,aALJ,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAKmB,SAAyB;AACxC,QAAI,OAAoB;AACpB,UAAI,CAAC,eAAe,SAAS,KAAK,OAAO,GAAG;AACxC,eAAO,MAAM,
|
|
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 SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport styles from './badge.css.js';\n\nexport const BADGE_VARIANTS = [\n 'neutral',\n 'informative',\n 'positive',\n 'negative',\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n] as const;\nexport type BadgeVariant = typeof BADGE_VARIANTS[number];\n\n/**\n * @element sp-badge\n *\n * @slot - Text label of the badge\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport class Badge extends SizedMixin(ObserveSlotText(SpectrumElement, '')) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'informative';\n\n protected override render(): TemplateResult {\n if (window.__swc.DEBUG) {\n if (!BADGE_VARIANTS.includes(this.variant)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expect the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...BADGE_VARIANTS]\n },\n );\n }\n }\n return html`\n <slot name=\"icon\" ?icon-only=${!this.slotHasContent}></slot>\n <div id=\"label\">\n <slot></slot>\n </div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAAA;AAOA;AAEA;AACA;AAEO,aAAM,iBAAiB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AASO,aAAM,cAAc,WAAW,gBAAgB,iBAAiB,EAAE,CAAC,EAAE;AAAA,EAArE;AAAA;AAMI,mBAAwB;AAAA;AAAA,aALJ,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAKmB,SAAyB;AACxC,QAAI,OAAoB;AACpB,UAAI,CAAC,eAAe,SAAS,KAAK,OAAO,GAAG;AACxC,eAAO,MAAM,KACT,MACA,IAAI,KAAK,iFACT,mFACA;AAAA,UACI,QAAQ,CAAC,GAAG,cAAc;AAAA,QAC9B,CACJ;AAAA,MACJ;AAAA,IACJ;AACA,WAAO;AAAA,2CAC4B,CAAC,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7C;AACJ;AAtBW;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAClC,AANJ,MAMI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/badge.test.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
|
|
2
2
|
import "@spectrum-web-components/badge/sp-badge.js";
|
|
3
3
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js";
|
|
4
|
+
import { stub } from "sinon";
|
|
5
|
+
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
4
6
|
describe("Badge", () => {
|
|
7
|
+
testForLitDevWarnings(async () => await fixture(html`
|
|
8
|
+
<sp-badge>
|
|
9
|
+
<sp-icon-checkmark-circle
|
|
10
|
+
slot="icon"
|
|
11
|
+
></sp-icon-checkmark-circle>
|
|
12
|
+
Icon and label
|
|
13
|
+
</sp-badge>
|
|
14
|
+
`));
|
|
5
15
|
it("loads default badge accessibly", async () => {
|
|
16
|
+
const consoleWarnStub = stub(console, "warn");
|
|
6
17
|
const el = await fixture(html`
|
|
7
18
|
<sp-badge>
|
|
8
19
|
<sp-icon-checkmark-circle
|
|
@@ -13,6 +24,31 @@ describe("Badge", () => {
|
|
|
13
24
|
`);
|
|
14
25
|
await elementUpdated(el);
|
|
15
26
|
await expect(el).to.be.accessible();
|
|
27
|
+
expect(consoleWarnStub.called).to.be.false;
|
|
28
|
+
consoleWarnStub.restore();
|
|
29
|
+
});
|
|
30
|
+
it("warns in Dev Mode when sent an incorrect `variant`", async () => {
|
|
31
|
+
const consoleWarnStub = stub(console, "warn");
|
|
32
|
+
const el = await fixture(html`
|
|
33
|
+
<sp-badge variant="other">
|
|
34
|
+
<sp-icon-checkmark-circle
|
|
35
|
+
slot="icon"
|
|
36
|
+
></sp-icon-checkmark-circle>
|
|
37
|
+
Icon and label
|
|
38
|
+
</sp-badge>
|
|
39
|
+
`);
|
|
40
|
+
await elementUpdated(el);
|
|
41
|
+
expect(consoleWarnStub.called).to.be.true;
|
|
42
|
+
const spyCall = consoleWarnStub.getCall(0);
|
|
43
|
+
expect(spyCall.args.at(0).includes('"variant"'), "confirm variant-centric message").to.be.true;
|
|
44
|
+
expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({
|
|
45
|
+
data: {
|
|
46
|
+
localName: "sp-badge",
|
|
47
|
+
type: "api",
|
|
48
|
+
level: "default"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
consoleWarnStub.restore();
|
|
16
52
|
});
|
|
17
53
|
});
|
|
18
54
|
//# sourceMappingURL=badge.test.js.map
|
package/test/badge.test.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["badge.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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport '@spectrum-web-components/badge/sp-badge.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';\nimport { Badge } from '../src/Badge.js';\n\ndescribe('Badge', () => {\n it('loads default badge accessibly', async () => {\n const el = await fixture<Badge>(\n html`\n <sp-badge>\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Icon and label\n </sp-badge>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n});\n"],
|
|
5
|
-
"mappings": "AAYA;AAEA;AACA;
|
|
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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport '@spectrum-web-components/badge/sp-badge.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';\nimport { stub } from 'sinon';\nimport { Badge } from '../src/Badge.js';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Badge', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<Badge>(\n html`\n <sp-badge>\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Icon and label\n </sp-badge>\n `\n )\n );\n it('loads default badge accessibly', async () => {\n const consoleWarnStub = stub(console, 'warn');\n const el = await fixture<Badge>(\n html`\n <sp-badge>\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Icon and label\n </sp-badge>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n expect(consoleWarnStub.called).to.be.false;\n consoleWarnStub.restore();\n });\n it('warns in Dev Mode when sent an incorrect `variant`', async () => {\n const consoleWarnStub = stub(console, 'warn');\n const el = await fixture<Badge>(\n html`\n <sp-badge variant=\"other\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Icon and label\n </sp-badge>\n `\n );\n\n await elementUpdated(el);\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n expect(\n spyCall.args.at(0).includes('\"variant\"'),\n 'confirm variant-centric message'\n ).to.be.true;\n expect(spyCall.args.at(-1), 'confirm `data` shape').to.deep.equal({\n data: {\n localName: 'sp-badge',\n type: 'api',\n level: 'default',\n },\n });\n consoleWarnStub.restore();\n });\n});\n"],
|
|
5
|
+
"mappings": "AAYA;AAEA;AACA;AACA;AAEA;AAEA,SAAS,SAAS,MAAM;AACpB,wBACI,YACI,MAAM,QACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAQJ,CACR;AACA,KAAG,kCAAkC,YAAY;AAC7C,UAAM,kBAAkB,KAAK,SAAS,MAAM;AAC5C,UAAM,KAAK,MAAM,QACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAQJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAClC,WAAO,gBAAgB,MAAM,EAAE,GAAG,GAAG;AACrC,oBAAgB,QAAQ;AAAA,EAC5B,CAAC;AACD,KAAG,sDAAsD,YAAY;AACjE,UAAM,kBAAkB,KAAK,SAAS,MAAM;AAC5C,UAAM,KAAK,MAAM,QACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAQJ;AAEA,UAAM,eAAe,EAAE;AAEvB,WAAO,gBAAgB,MAAM,EAAE,GAAG,GAAG;AACrC,UAAM,UAAU,gBAAgB,QAAQ,CAAC;AACzC,WACI,QAAQ,KAAK,GAAG,CAAC,EAAE,SAAS,WAAW,GACvC,iCACJ,EAAE,GAAG,GAAG;AACR,WAAO,QAAQ,KAAK,GAAG,EAAE,GAAG,sBAAsB,EAAE,GAAG,KAAK,MAAM;AAAA,MAC9D,MAAM;AAAA,QACF,WAAW;AAAA,QACX,MAAM;AAAA,QACN,OAAO;AAAA,MACX;AAAA,IACJ,CAAC;AACD,oBAAgB,QAAQ;AAAA,EAC5B,CAAC;AACL,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|