@spectrum-web-components/badge 0.1.3 → 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.
@@ -1,20 +1,20 @@
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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';
13
- import '../sp-badge.js';
14
- import '../../icons-workflow/icons/sp-icon-checkmark-circle.js';
15
- describe('Badge', () => {
16
- it('loads default badge accessibly', async () => {
17
- const el = await fixture(html `
1
+ import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
2
+ import "@spectrum-web-components/badge/sp-badge.js";
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";
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
+ `));
15
+ it("loads default badge accessibly", async () => {
16
+ const consoleWarnStub = stub(console, "warn");
17
+ const el = await fixture(html`
18
18
  <sp-badge>
19
19
  <sp-icon-checkmark-circle
20
20
  slot="icon"
@@ -22,8 +22,33 @@ describe('Badge', () => {
22
22
  Icon and label
23
23
  </sp-badge>
24
24
  `);
25
- await elementUpdated(el);
26
- await expect(el).to.be.accessible();
25
+ await elementUpdated(el);
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
+ }
27
50
  });
51
+ consoleWarnStub.restore();
52
+ });
28
53
  });
29
- //# sourceMappingURL=badge.test.js.map
54
+ //# sourceMappingURL=badge.test.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"badge.test.js","sourceRoot":"","sources":["badge.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,gBAAgB,CAAC;AACxB,OAAO,wDAAwD,CAAC;AAGhE,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACnB,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;;;;;;aAOH,CACJ,CAAC;QAEF,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IACxC,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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport '../sp-badge.js';\nimport '../../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"]}
1
+ {
2
+ "version": 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;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
+ "names": []
7
+ }
@@ -1,22 +1,11 @@
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/badge/sp-badge.js';
13
- import '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';
14
- import { html } from '@spectrum-web-components/base';
15
- import { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';
16
- measureFixtureCreation(html `
1
+ import "@spectrum-web-components/badge/sp-badge.js";
2
+ import "@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js";
3
+ import { html } from "@spectrum-web-components/base";
4
+ import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
5
+ measureFixtureCreation(html`
17
6
  <sp-badge>
18
7
  <sp-icon-checkmark-circle slot="icon"></sp-icon-checkmark-circle>
19
8
  Icon and label
20
9
  </sp-badge>
21
10
  `);
22
- //# sourceMappingURL=basic-test.js.map
11
+ //# sourceMappingURL=basic-test.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"basic-test.js","sourceRoot":"","sources":["basic-test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,4CAA4C,CAAC;AACpD,OAAO,2EAA2E,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,sBAAsB,CAAC,IAAI,CAAA;;;;;CAK1B,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 '@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"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["basic-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/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;AACA;AACA;AACA;AAEA,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,CAKtB;",
6
+ "names": []
7
+ }