@spectrum-web-components/badge 0.3.0 → 0.4.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["badge.stories.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/badge/sp-badge.js';\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';\n\nexport default {\n title: 'Badge',\n component: 'sp-badge',\n};\n\nexport const Default = (): TemplateResult => {\n return html`\n <sp-badge>Badge</sp-badge>\n `;\n};\n\nexport const Icons = (): TemplateResult => {\n return html`\n <sp-badge>No icon</sp-badge>\n\n <sp-badge>\n <sp-icon-checkmark-circle slot=\"icon\"></sp-icon-checkmark-circle>\n Icon and label\n </sp-badge>\n\n <sp-badge>\n <sp-icon-checkmark-circle slot=\"icon\"></sp-icon-checkmark-circle>\n </sp-badge>\n `;\n};\n\nexport const Sizes = (): TemplateResult => {\n return html`\n <div style=\"display: flex; align-items: center; gap: 8px;\">\n <sp-badge size=\"s\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Small\n </sp-badge>\n <sp-badge size=\"m\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Medium\n </sp-badge>\n <sp-badge size=\"l\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Large\n </sp-badge>\n <sp-badge size=\"xl\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Extra-large\n </sp-badge>\n <sp-badge style=\"max-width: 180px\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n This long content automatically wraps, but shows no more than\n two lines\n </sp-badge>\n </div>\n `;\n};\n\nexport const Semantic = (): TemplateResult => {\n return html`\n <sp-badge variant=\"positive\">Positive</sp-badge>\n <sp-badge variant=\"informative\">Informative</sp-badge>\n <sp-badge variant=\"negative\">Negative</sp-badge>\n <sp-badge variant=\"neutral\">Neutral</sp-badge>\n `;\n};\n\nexport const NonSemantic = (): TemplateResult => {\n return html`\n <sp-badge variant=\"seafoam\">Seafoam</sp-badge>\n <sp-badge variant=\"indigo\">Indigo</sp-badge>\n <sp-badge variant=\"purple\">Purple</sp-badge>\n <sp-badge variant=\"fuchsia\">Fuchsia</sp-badge>\n <sp-badge variant=\"magenta\">Magenta</sp-badge>\n <sp-badge variant=\"yellow\">Yellow</sp-badge>\n `;\n};\n\nexport const Inline = (): TemplateResult => {\n return html`\n Badge is a simple\n <sp-badge variant=\"positive\" size=\"s\">inline</sp-badge>\n element that should\n <sp-badge variant=\"magenta\" size=\"s\">flow</sp-badge>\n with the rest of the page:\n <sp-badge variant=\"negative\">Missing</sp-badge>\n <sp-badge variant=\"positive\">Successful</sp-badge>\n <sp-badge variant=\"purple\">Purple</sp-badge>\n `;\n};\n\nexport const Fixed = (): TemplateResult => {\n return html`\n <div\n style=\"position: relative; width: 400px; height: 200px; background: #eee\"\n >\n <sp-badge>None</sp-badge>\n <sp-badge\n fixed=\"top\"\n style=\"position: absolute; top: 0; left: 200px;\"\n >\n Top\n </sp-badge>\n <sp-badge\n fixed=\"right\"\n style=\"position: absolute; right: 0; top: 100px;\"\n >\n Right\n </sp-badge>\n <sp-badge\n fixed=\"bottom\"\n style=\"position: absolute; bottom: 0; left: 200px;\"\n >\n Bottom\n </sp-badge>\n <sp-badge\n fixed=\"left\"\n style=\"position: absolute; left: 0; top: 100px;\"\n >\n Left\n </sp-badge>\n </div>\n `;\n};\n"],
5
- "mappings": "AAYA,mDACA,qDACA,kFAEA,cAAe,CACX,MAAO,QACP,UAAW,UACf,EAEO,YAAM,SAAU,IACZ;AAAA;AAAA,MAKE,MAAQ,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAcE,MAAQ,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAqCE,SAAW,IACb;AAAA;AAAA;AAAA;AAAA;AAAA,MAQE,YAAc,IAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAUE,OAAS,IACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAYE,MAAQ,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
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/badge/sp-badge.js';\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';\n\nexport default {\n title: 'Badge',\n component: 'sp-badge',\n};\n\nexport const Default = (): TemplateResult => {\n return html`\n <sp-badge>Badge</sp-badge>\n `;\n};\n\nexport const Icons = (): TemplateResult => {\n return html`\n <sp-badge>No icon</sp-badge>\n\n <sp-badge>\n <sp-icon-checkmark-circle slot=\"icon\"></sp-icon-checkmark-circle>\n Icon and label\n </sp-badge>\n\n <sp-badge>\n <sp-icon-checkmark-circle slot=\"icon\"></sp-icon-checkmark-circle>\n </sp-badge>\n `;\n};\n\nexport const Sizes = (): TemplateResult => {\n return html`\n <div style=\"display: flex; align-items: center; gap: 8px;\">\n <sp-badge size=\"s\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Small\n </sp-badge>\n <sp-badge size=\"m\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Medium\n </sp-badge>\n <sp-badge size=\"l\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Large\n </sp-badge>\n <sp-badge size=\"xl\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Extra-large\n </sp-badge>\n <sp-badge style=\"max-width: 180px\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n This long content automatically wraps, but shows no more than\n two lines\n </sp-badge>\n </div>\n `;\n};\n\nexport const Semantic = (): TemplateResult => {\n return html`\n <sp-badge variant=\"accent\">Accent</sp-badge>\n <sp-badge variant=\"positive\">Positive</sp-badge>\n <sp-badge variant=\"informative\">Informative</sp-badge>\n <sp-badge variant=\"negative\">Negative</sp-badge>\n <sp-badge variant=\"neutral\">Neutral</sp-badge>\n `;\n};\n\nexport const NonSemantic = (): TemplateResult => {\n return html`\n <sp-badge\n variant=\"seafoam\"\n style=\"--mod-badge-background-color-default: var(--spectrum-global-color-static-seafoam-600)\"\n >\n Seafoam\n </sp-badge>\n <sp-badge\n variant=\"indigo\"\n style=\"--mod-badge-background-color-default: var(--spectrum-global-color-static-indigo-600)\"\n >\n Indigo\n </sp-badge>\n <sp-badge\n variant=\"purple\"\n style=\"--mod-badge-background-color-default: var(--spectrum-global-color-static-purple-600)\"\n >\n Purple\n </sp-badge>\n <sp-badge\n variant=\"fuchsia\"\n style=\"--mod-badge-background-color-default: var(--spectrum-global-color-static-fuchsia-600)\"\n >\n Fuchsia\n </sp-badge>\n <sp-badge\n variant=\"magenta\"\n style=\"--mod-badge-background-color-default: var(--spectrum-global-color-static-magenta-600)\"\n >\n Magenta\n </sp-badge>\n <sp-badge\n variant=\"yellow\"\n style=\"--mod-badge-background-color-default: var(--spectrum-alias-background-color-yellow-default); --mod-badge-label-icon-color-white: var(--spectrum-global-color-static-black);\"\n >\n Yellow\n </sp-badge>\n `;\n};\n\nexport const Inline = (): TemplateResult => {\n return html`\n Badge is a simple\n <sp-badge variant=\"positive\" size=\"s\">inline</sp-badge>\n element that should\n <sp-badge variant=\"neutral\" size=\"s\">flow</sp-badge>\n with the rest of the page:\n <sp-badge variant=\"negative\">Missing</sp-badge>\n <sp-badge variant=\"positive\">Successful</sp-badge>\n <sp-badge variant=\"accent\">Accent</sp-badge>\n `;\n};\n\nexport const Fixed = (): TemplateResult => {\n return html`\n <div\n style=\"position: relative; width: 400px; height: 200px; background: #eee\"\n >\n <sp-badge>None</sp-badge>\n <sp-badge\n fixed=\"block-start\"\n style=\"position: absolute; top: 0; left: 200px;\"\n >\n block-start\n </sp-badge>\n <sp-badge\n fixed=\"inline-end\"\n style=\"position: absolute; right: 0; top: 100px;\"\n >\n inline-end\n </sp-badge>\n <sp-badge\n fixed=\"block-end\"\n style=\"position: absolute; bottom: 0; left: 200px;\"\n >\n block-end\n </sp-badge>\n <sp-badge\n fixed=\"inline-start\"\n style=\"position: absolute; left: 0; top: 100px;\"\n >\n inline-start\n </sp-badge>\n </div>\n `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-1,2 +1,5 @@
1
- import*as r from"../stories/badge.stories.js";import{regressVisuals as s}from"../../../test/visual/test.js";s("BadgeStories",r);
1
+ "use strict";
2
+ import * as stories from "../stories/badge.stories.js";
3
+ import { regressVisuals } from "../../../test/visual/test.js";
4
+ regressVisuals("BadgeStories", stories);
2
5
  //# sourceMappingURL=badge.test-vrt.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["badge.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/badge.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('BadgeStories', stories);\n"],
5
- "mappings": "AAYA,8CACA,8DAEA,EAAe,eAAgB,CAAO",
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/badge.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('BadgeStories', stories as unknown as TestsType);\n"],
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,gBAAgB,OAA+B;",
6
6
  "names": []
7
7
  }
@@ -1,23 +1,120 @@
1
- import{elementUpdated as s,expect as a,fixture as t,html as o}from"@open-wc/testing";import"@spectrum-web-components/badge/sp-badge.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js";import{stub as n}from"sinon";import{testForLitDevWarnings as i}from"../../../test/testing-helpers.js";describe("Badge",()=>{i(async()=>await t(o`
1
+ "use strict";
2
+ import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
3
+ import "@spectrum-web-components/badge/sp-badge.js";
4
+ import "@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js";
5
+ import { stub } from "sinon";
6
+ import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
7
+ describe("Badge", () => {
8
+ testForLitDevWarnings(
9
+ async () => await fixture(
10
+ html`
2
11
  <sp-badge>
3
12
  <sp-icon-checkmark-circle
4
13
  slot="icon"
5
14
  ></sp-icon-checkmark-circle>
6
15
  Icon and label
7
16
  </sp-badge>
8
- `)),it("loads default badge accessibly",async()=>{const e=n(console,"warn"),c=await t(o`
9
- <sp-badge>
10
- <sp-icon-checkmark-circle
11
- slot="icon"
12
- ></sp-icon-checkmark-circle>
13
- Icon and label
14
- </sp-badge>
15
- `);await s(c),await a(c).to.be.accessible(),a(e.called).to.be.false,e.restore()}),it("warns in Dev Mode when sent an incorrect `variant`",async()=>{const e=n(console,"warn"),c=await t(o`
16
- <sp-badge variant="other">
17
- <sp-icon-checkmark-circle
18
- slot="icon"
19
- ></sp-icon-checkmark-circle>
20
- Icon and label
21
- </sp-badge>
22
- `);await s(c),a(e.called).to.be.true;const r=e.getCall(0);a(r.args.at(0).includes('"variant"'),"confirm variant-centric message").to.be.true,a(r.args.at(-1),"confirm `data` shape").to.deep.equal({data:{localName:"sp-badge",type:"api",level:"default"}}),e.restore()})});
17
+ `
18
+ )
19
+ );
20
+ it("manages `fixed` attribute", async () => {
21
+ const el = await fixture(
22
+ html`
23
+ <sp-badge>Label only</sp-badge>
24
+ `
25
+ );
26
+ expect(el.fixed).to.be.undefined;
27
+ const textFixedValue = "inline-start";
28
+ el.fixed = textFixedValue;
29
+ await elementUpdated(el);
30
+ expect(el.fixed).to.equal(textFixedValue);
31
+ el.fixed = textFixedValue;
32
+ await elementUpdated(el);
33
+ expect(el.fixed).to.equal(textFixedValue);
34
+ el.fixed = void 0;
35
+ await elementUpdated(el);
36
+ expect(el.hasAttribute("fixed")).to.be.false;
37
+ });
38
+ describe("dev mode", () => {
39
+ let consoleWarnStub;
40
+ before(() => {
41
+ window.__swc.verbose = true;
42
+ consoleWarnStub = stub(console, "warn");
43
+ });
44
+ afterEach(() => {
45
+ consoleWarnStub.resetHistory();
46
+ });
47
+ after(() => {
48
+ window.__swc.verbose = false;
49
+ consoleWarnStub.restore();
50
+ });
51
+ it("loads default badge accessibly", async () => {
52
+ const el = await fixture(
53
+ html`
54
+ <sp-badge>
55
+ <sp-icon-checkmark-circle
56
+ slot="icon"
57
+ ></sp-icon-checkmark-circle>
58
+ Icon and label
59
+ </sp-badge>
60
+ `
61
+ );
62
+ await elementUpdated(el);
63
+ await expect(el).to.be.accessible();
64
+ expect(consoleWarnStub.called).to.be.false;
65
+ });
66
+ it("warns in Dev Mode when sent an incorrect `variant`", async () => {
67
+ const el = await fixture(
68
+ html`
69
+ <sp-badge variant="other">
70
+ <sp-icon-checkmark-circle
71
+ slot="icon"
72
+ ></sp-icon-checkmark-circle>
73
+ Icon and label
74
+ </sp-badge>
75
+ `
76
+ );
77
+ await elementUpdated(el);
78
+ expect(consoleWarnStub.called).to.be.true;
79
+ const spyCall = consoleWarnStub.getCall(0);
80
+ expect(
81
+ spyCall.args.at(0).includes('"variant"'),
82
+ "confirm variant-centric message"
83
+ ).to.be.true;
84
+ expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({
85
+ data: {
86
+ localName: "sp-badge",
87
+ type: "api",
88
+ level: "default"
89
+ }
90
+ });
91
+ });
92
+ it("warns in Dev Mode when sent a deprecated value for `fixed`", async () => {
93
+ const el = await fixture(
94
+ html`
95
+ <sp-badge fixed="top">
96
+ <sp-icon-checkmark-circle
97
+ slot="icon"
98
+ ></sp-icon-checkmark-circle>
99
+ Icon and label
100
+ </sp-badge>
101
+ `
102
+ );
103
+ await elementUpdated(el);
104
+ expect(consoleWarnStub.called).to.be.true;
105
+ const spyCall = consoleWarnStub.getCall(0);
106
+ expect(
107
+ spyCall.args.at(0).includes('"fixed"'),
108
+ "confirm fixed-centric message"
109
+ ).to.be.true;
110
+ expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({
111
+ data: {
112
+ localName: "sp-badge",
113
+ type: "api",
114
+ level: "default"
115
+ }
116
+ });
117
+ });
118
+ });
119
+ });
23
120
  //# sourceMappingURL=badge.test.js.map
@@ -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 { 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,qFAEA,mDACA,kFACA,6BAEA,yEAEA,SAAS,QAAS,IAAM,CACpB,EACI,SACI,KAAM,GACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAQJ,CACR,EACA,GAAG,iCAAkC,SAAY,CAC7C,KAAM,GAAkB,EAAK,QAAS,MAAM,EACtC,EAAK,KAAM,GACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAQJ,EAEA,KAAM,GAAe,CAAE,EAEvB,KAAM,GAAO,CAAE,EAAE,GAAG,GAAG,WAAW,EAClC,EAAO,EAAgB,MAAM,EAAE,GAAG,GAAG,MACrC,EAAgB,QAAQ,CAC5B,CAAC,EACD,GAAG,qDAAsD,SAAY,CACjE,KAAM,GAAkB,EAAK,QAAS,MAAM,EACtC,EAAK,KAAM,GACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAQJ,EAEA,KAAM,GAAe,CAAE,EAEvB,EAAO,EAAgB,MAAM,EAAE,GAAG,GAAG,KACrC,KAAM,GAAU,EAAgB,QAAQ,CAAC,EACzC,EACI,EAAQ,KAAK,GAAG,CAAC,EAAE,SAAS,WAAW,EACvC,iCACJ,EAAE,GAAG,GAAG,KACR,EAAO,EAAQ,KAAK,GAAG,EAAE,EAAG,sBAAsB,EAAE,GAAG,KAAK,MAAM,CAC9D,KAAM,CACF,UAAW,WACX,KAAM,MACN,MAAO,SACX,CACJ,CAAC,EACD,EAAgB,QAAQ,CAC5B,CAAC,CACL,CAAC",
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('manages `fixed` attribute', async () => {\n const el = await fixture<Badge>(\n html`\n <sp-badge>Label only</sp-badge>\n `\n );\n\n expect(el.fixed).to.be.undefined;\n\n const textFixedValue = 'inline-start';\n\n el.fixed = textFixedValue;\n\n await elementUpdated(el);\n\n expect(el.fixed).to.equal(textFixedValue);\n\n el.fixed = textFixedValue;\n\n await elementUpdated(el);\n\n expect(el.fixed).to.equal(textFixedValue);\n\n el.fixed = undefined;\n\n await elementUpdated(el);\n\n expect(el.hasAttribute('fixed')).to.be.false;\n });\n describe('dev mode', () => {\n let consoleWarnStub!: ReturnType<typeof stub>;\n before(() => {\n window.__swc.verbose = true;\n consoleWarnStub = stub(console, 'warn');\n });\n afterEach(() => {\n consoleWarnStub.resetHistory();\n });\n after(() => {\n window.__swc.verbose = false;\n consoleWarnStub.restore();\n });\n\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 expect(consoleWarnStub.called).to.be.false;\n });\n it('warns in Dev Mode when sent an incorrect `variant`', async () => {\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) as string).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 });\n it('warns in Dev Mode when sent a deprecated value for `fixed`', async () => {\n const el = await fixture<Badge>(\n html`\n <sp-badge fixed=\"top\">\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) as string).includes('\"fixed\"'),\n 'confirm fixed-centric message'\n ).to.be.true;\n expect(spyC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ons-workflow/icons/sp-icon-checkmark-circle.js";import{html as r}from"@spectrum-web-components/base";import{measureFixtureCreation as c}from"../../../../test/benchmark/helpers.js";c(r`
1
+ "use strict";
2
+ import "@spectrum-web-components/badge/sp-badge.js";
3
+ import "@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js";
4
+ import { html } from "@spectrum-web-components/base";
5
+ import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
6
+ measureFixtureCreation(html`
2
7
  <sp-badge>
3
8
  <sp-icon-checkmark-circle slot="icon"></sp-icon-checkmark-circle>
4
9
  Icon and label
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["basic-test.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 '@spectrum-web-components/badge/sp-badge.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';\nimport { html } from '@spectrum-web-components/base';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-badge>\n <sp-icon-checkmark-circle slot=\"icon\"></sp-icon-checkmark-circle>\n Icon and label\n </sp-badge>\n`);\n"],
5
- "mappings": "AAYA,mDACA,kFACA,qDACA,+EAEA,EAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,CAKtB",
5
+ "mappings": ";AAYA,OAAO;AACP,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,CAKtB;",
6
6
  "names": []
7
7
  }