@spectrum-web-components/progress-circle 0.4.12-devmode.0 → 0.5.1-devmode.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 +3 -3
- package/package.json +5 -4
- package/src/ProgressCircle.dev.js +8 -5
- package/src/ProgressCircle.dev.js.map +2 -2
- package/src/ProgressCircle.js +8 -5
- package/src/ProgressCircle.js.map +2 -2
- package/stories/progress-circle.stories.js +1 -3
- package/stories/progress-circle.stories.js.map +2 -2
- package/test/progress-circle.test.js +31 -2
- package/test/progress-circle.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-progress-circle.
|
|
7
|
+
"path": "sp-progress-circle.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/ProgressCircle.
|
|
22
|
+
"path": "src/ProgressCircle.js",
|
|
23
23
|
"declarations": [
|
|
24
24
|
{
|
|
25
25
|
"kind": "class",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"name": "ProgressCircle",
|
|
142
142
|
"declaration": {
|
|
143
143
|
"name": "ProgressCircle",
|
|
144
|
-
"module": "src/ProgressCircle.
|
|
144
|
+
"module": "src/ProgressCircle.js"
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/progress-circle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1-devmode.0+1a8b29491",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"lit-html"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@spectrum-web-components/base": "^0.
|
|
60
|
+
"@spectrum-web-components/base": "^0.6.1-devmode.0+1a8b29491",
|
|
61
61
|
"tslib": "^2.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
@@ -66,7 +66,8 @@
|
|
|
66
66
|
"types": "./src/index.d.ts",
|
|
67
67
|
"customElements": "custom-elements.json",
|
|
68
68
|
"sideEffects": [
|
|
69
|
-
"./sp-*.js"
|
|
69
|
+
"./sp-*.js",
|
|
70
|
+
"./**/*.dev.js"
|
|
70
71
|
],
|
|
71
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "1a8b294911ab377fa4f07e16eb016f1e3bf7b517"
|
|
72
73
|
}
|
|
@@ -73,11 +73,14 @@ export class ProgressCircle extends SizedMixin(SpectrumElement, {
|
|
|
73
73
|
}
|
|
74
74
|
if (true) {
|
|
75
75
|
if (!this.label && !this.getAttribute("aria-label") && !this.getAttribute("aria-labelledby")) {
|
|
76
|
-
window.__swc.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
window.__swc.warn(this, "<sp-progress-circle> elements will not be accessible to screen readers without one of the following:", "https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#accessibility", {
|
|
77
|
+
type: "accessibility",
|
|
78
|
+
issues: [
|
|
79
|
+
'value supplied to the "label" attribute, which will be displayed visually as part of the element, or',
|
|
80
|
+
'value supplied to the "aria-label" attribute, which will only be provided to screen readers, or',
|
|
81
|
+
'an element ID reference supplied to the "aria-labelledby" attribute, which will be provided by screen readers and will need to be managed manually by the parent application.'
|
|
82
|
+
]
|
|
83
|
+
});
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ProgressCircle.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 PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport progressCircleStyles from './progress-circle.css.js';\n\n/**\n * @element sp-progress-circle\n */\nexport class ProgressCircle extends SizedMixin(SpectrumElement, {\n validSizes: ['s', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [progressCircleStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String })\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'over-background' })\n public overBackground = false;\n\n @property({ type: Number })\n public progress = 0;\n\n private makeRotation(rotation: number): string | undefined {\n return this.indeterminate\n ? undefined\n : `transform: rotate(${rotation}deg);`;\n }\n\n protected override render(): TemplateResult {\n const styles = [\n this.makeRotation(-180 + (180 / 50) * Math.min(this.progress, 50)),\n this.makeRotation(\n -180 + (180 / 50) * Math.max(this.progress - 50, 0)\n ),\n ];\n const masks = ['Mask1', 'Mask2'];\n return html`\n <div class=\"track\"></div>\n <div class=\"fills\">\n ${masks.map(\n (mask, index) => html`\n <div class=\"fill${mask}\">\n <div\n class=\"fillSub${mask}\"\n style=${ifDefined(styles[index])}\n >\n <div class=\"fill\"></div>\n </div>\n </div>\n `\n )}\n </div>\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'progressbar');\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n } else if (this.hasAttribute('aria-valuenow')) {\n this.removeAttribute('aria-valuenow');\n }\n if (this.label && changes.has('label')) {\n this.setAttribute('aria-label', this.label);\n }\n\n if (window.__swc.DEBUG) {\n if (\n !this.label &&\n !this.getAttribute('aria-label') &&\n !this.getAttribute('aria-labelledby')\n ) {\n window.__swc.
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;AAEA;AAKO,aAAM,uBAAuB,WAAW,iBAAiB;AAAA,EAC5D,YAAY,CAAC,KAAK,KAAK,GAAG;AAC9B,CAAC,EAAE;AAAA,EAFI;AAAA;AAQI,yBAAgB;AAGhB,iBAAQ;AAGR,0BAAiB;AAGjB,oBAAW;AAAA;AAAA,aAdS,SAAyB;AAChD,WAAO,CAAC,oBAAoB;AAAA,EAChC;AAAA,EAcQ,aAAa,UAAsC;AACvD,WAAO,KAAK,gBACN,SACA,qBAAqB;AAAA,EAC/B;AAAA,EAEmB,SAAyB;AACxC,UAAM,SAAS;AAAA,MACX,KAAK,aAAa,OAAQ,MAAM,KAAM,KAAK,IAAI,KAAK,UAAU,EAAE,CAAC;AAAA,MACjE,KAAK,aACD,OAAQ,MAAM,KAAM,KAAK,IAAI,KAAK,WAAW,IAAI,CAAC,CACtD;AAAA,IACJ;AACA,UAAM,QAAQ,CAAC,SAAS,OAAO;AAC/B,WAAO;AAAA;AAAA;AAAA,kBAGG,MAAM,IACJ,CAAC,MAAM,UAAU;AAAA,0CACK;AAAA;AAAA,gDAEM;AAAA,wCACR,UAAU,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,qBAM/C;AAAA;AAAA;AAAA,EAGZ;AAAA,EAEmB,aAAa,SAA+B;AAC3D,UAAM,aAAa,OAAO;AAC1B,QAAI,CAAC,KAAK,aAAa,MAAM,GAAG;AAC5B,WAAK,aAAa,QAAQ,aAAa;AAAA,IAC3C;AAAA,EACJ;AAAA,EAEmB,QAAQ,SAA+B;AACtD,UAAM,QAAQ,OAAO;AACrB,QAAI,CAAC,KAAK,iBAAiB,QAAQ,IAAI,UAAU,GAAG;AAChD,WAAK,aAAa,iBAAiB,KAAK,KAAK,QAAQ;AAAA,IACzD,WAAW,KAAK,aAAa,eAAe,GAAG;AAC3C,WAAK,gBAAgB,eAAe;AAAA,IACxC;AACA,QAAI,KAAK,SAAS,QAAQ,IAAI,OAAO,GAAG;AACpC,WAAK,aAAa,cAAc,KAAK,KAAK;AAAA,IAC9C;AAEA,QAAI,MAAoB;AACpB,UACI,CAAC,KAAK,SACN,CAAC,KAAK,aAAa,YAAY,KAC/B,CAAC,KAAK,aAAa,iBAAiB,GACtC;AACE,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 PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport progressCircleStyles from './progress-circle.css.js';\n\n/**\n * @element sp-progress-circle\n */\nexport class ProgressCircle extends SizedMixin(SpectrumElement, {\n validSizes: ['s', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [progressCircleStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String })\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'over-background' })\n public overBackground = false;\n\n @property({ type: Number })\n public progress = 0;\n\n private makeRotation(rotation: number): string | undefined {\n return this.indeterminate\n ? undefined\n : `transform: rotate(${rotation}deg);`;\n }\n\n protected override render(): TemplateResult {\n const styles = [\n this.makeRotation(-180 + (180 / 50) * Math.min(this.progress, 50)),\n this.makeRotation(\n -180 + (180 / 50) * Math.max(this.progress - 50, 0)\n ),\n ];\n const masks = ['Mask1', 'Mask2'];\n return html`\n <div class=\"track\"></div>\n <div class=\"fills\">\n ${masks.map(\n (mask, index) => html`\n <div class=\"fill${mask}\">\n <div\n class=\"fillSub${mask}\"\n style=${ifDefined(styles[index])}\n >\n <div class=\"fill\"></div>\n </div>\n </div>\n `\n )}\n </div>\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'progressbar');\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n } else if (this.hasAttribute('aria-valuenow')) {\n this.removeAttribute('aria-valuenow');\n }\n if (this.label && changes.has('label')) {\n this.setAttribute('aria-label', this.label);\n }\n\n if (window.__swc.DEBUG) {\n if (\n !this.label &&\n !this.getAttribute('aria-label') &&\n !this.getAttribute('aria-labelledby')\n ) {\n window.__swc.warn(\n this,\n '<sp-progress-circle> elements will not be accessible to screen readers without one of the following:',\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#accessibility',\n {\n type: 'accessibility',\n issues: [\n 'value supplied to the \"label\" attribute, which will be displayed visually as part of the element, or',\n 'value supplied to the \"aria-label\" attribute, which will only be provided to screen readers, or',\n 'an element ID reference supplied to the \"aria-labelledby\" attribute, which will be provided by screen readers and will need to be managed manually by the parent application.',\n ]\n },\n );\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;AAEA;AAKO,aAAM,uBAAuB,WAAW,iBAAiB;AAAA,EAC5D,YAAY,CAAC,KAAK,KAAK,GAAG;AAC9B,CAAC,EAAE;AAAA,EAFI;AAAA;AAQI,yBAAgB;AAGhB,iBAAQ;AAGR,0BAAiB;AAGjB,oBAAW;AAAA;AAAA,aAdS,SAAyB;AAChD,WAAO,CAAC,oBAAoB;AAAA,EAChC;AAAA,EAcQ,aAAa,UAAsC;AACvD,WAAO,KAAK,gBACN,SACA,qBAAqB;AAAA,EAC/B;AAAA,EAEmB,SAAyB;AACxC,UAAM,SAAS;AAAA,MACX,KAAK,aAAa,OAAQ,MAAM,KAAM,KAAK,IAAI,KAAK,UAAU,EAAE,CAAC;AAAA,MACjE,KAAK,aACD,OAAQ,MAAM,KAAM,KAAK,IAAI,KAAK,WAAW,IAAI,CAAC,CACtD;AAAA,IACJ;AACA,UAAM,QAAQ,CAAC,SAAS,OAAO;AAC/B,WAAO;AAAA;AAAA;AAAA,kBAGG,MAAM,IACJ,CAAC,MAAM,UAAU;AAAA,0CACK;AAAA;AAAA,gDAEM;AAAA,wCACR,UAAU,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,qBAM/C;AAAA;AAAA;AAAA,EAGZ;AAAA,EAEmB,aAAa,SAA+B;AAC3D,UAAM,aAAa,OAAO;AAC1B,QAAI,CAAC,KAAK,aAAa,MAAM,GAAG;AAC5B,WAAK,aAAa,QAAQ,aAAa;AAAA,IAC3C;AAAA,EACJ;AAAA,EAEmB,QAAQ,SAA+B;AACtD,UAAM,QAAQ,OAAO;AACrB,QAAI,CAAC,KAAK,iBAAiB,QAAQ,IAAI,UAAU,GAAG;AAChD,WAAK,aAAa,iBAAiB,KAAK,KAAK,QAAQ;AAAA,IACzD,WAAW,KAAK,aAAa,eAAe,GAAG;AAC3C,WAAK,gBAAgB,eAAe;AAAA,IACxC;AACA,QAAI,KAAK,SAAS,QAAQ,IAAI,OAAO,GAAG;AACpC,WAAK,aAAa,cAAc,KAAK,KAAK;AAAA,IAC9C;AAEA,QAAI,MAAoB;AACpB,UACI,CAAC,KAAK,SACN,CAAC,KAAK,aAAa,YAAY,KAC/B,CAAC,KAAK,aAAa,iBAAiB,GACtC;AACE,eAAO,MAAM,KACT,MACA,wGACA,kGACA;AAAA,UACI,MAAM;AAAA,UACN,QAAQ;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,UACJ;AAAA,QACJ,CACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;AApFW;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AARJ,eAQI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GACnB,AAXJ,eAWI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,kBAAkB,CAAC;AAAA,GACjE,AAdJ,eAcI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GACnB,AAjBJ,eAiBI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/ProgressCircle.js
CHANGED
|
@@ -73,11 +73,14 @@ export class ProgressCircle extends SizedMixin(SpectrumElement, {
|
|
|
73
73
|
}
|
|
74
74
|
if (false) {
|
|
75
75
|
if (!this.label && !this.getAttribute("aria-label") && !this.getAttribute("aria-labelledby")) {
|
|
76
|
-
window.__swc.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
window.__swc.warn(this, "<sp-progress-circle> elements will not be accessible to screen readers without one of the following:", "https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#accessibility", {
|
|
77
|
+
type: "accessibility",
|
|
78
|
+
issues: [
|
|
79
|
+
'value supplied to the "label" attribute, which will be displayed visually as part of the element, or',
|
|
80
|
+
'value supplied to the "aria-label" attribute, which will only be provided to screen readers, or',
|
|
81
|
+
'an element ID reference supplied to the "aria-labelledby" attribute, which will be provided by screen readers and will need to be managed manually by the parent application.'
|
|
82
|
+
]
|
|
83
|
+
});
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ProgressCircle.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 PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport progressCircleStyles from './progress-circle.css.js';\n\n/**\n * @element sp-progress-circle\n */\nexport class ProgressCircle extends SizedMixin(SpectrumElement, {\n validSizes: ['s', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [progressCircleStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String })\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'over-background' })\n public overBackground = false;\n\n @property({ type: Number })\n public progress = 0;\n\n private makeRotation(rotation: number): string | undefined {\n return this.indeterminate\n ? undefined\n : `transform: rotate(${rotation}deg);`;\n }\n\n protected override render(): TemplateResult {\n const styles = [\n this.makeRotation(-180 + (180 / 50) * Math.min(this.progress, 50)),\n this.makeRotation(\n -180 + (180 / 50) * Math.max(this.progress - 50, 0)\n ),\n ];\n const masks = ['Mask1', 'Mask2'];\n return html`\n <div class=\"track\"></div>\n <div class=\"fills\">\n ${masks.map(\n (mask, index) => html`\n <div class=\"fill${mask}\">\n <div\n class=\"fillSub${mask}\"\n style=${ifDefined(styles[index])}\n >\n <div class=\"fill\"></div>\n </div>\n </div>\n `\n )}\n </div>\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'progressbar');\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n } else if (this.hasAttribute('aria-valuenow')) {\n this.removeAttribute('aria-valuenow');\n }\n if (this.label && changes.has('label')) {\n this.setAttribute('aria-label', this.label);\n }\n\n if (window.__swc.DEBUG) {\n if (\n !this.label &&\n !this.getAttribute('aria-label') &&\n !this.getAttribute('aria-labelledby')\n ) {\n window.__swc.
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;AAEA;AAKO,aAAM,uBAAuB,WAAW,iBAAiB;AAAA,EAC5D,YAAY,CAAC,KAAK,KAAK,GAAG;AAC9B,CAAC,EAAE;AAAA,EAFI;AAAA;AAQI,yBAAgB;AAGhB,iBAAQ;AAGR,0BAAiB;AAGjB,oBAAW;AAAA;AAAA,aAdS,SAAyB;AAChD,WAAO,CAAC,oBAAoB;AAAA,EAChC;AAAA,EAcQ,aAAa,UAAsC;AACvD,WAAO,KAAK,gBACN,SACA,qBAAqB;AAAA,EAC/B;AAAA,EAEmB,SAAyB;AACxC,UAAM,SAAS;AAAA,MACX,KAAK,aAAa,OAAQ,MAAM,KAAM,KAAK,IAAI,KAAK,UAAU,EAAE,CAAC;AAAA,MACjE,KAAK,aACD,OAAQ,MAAM,KAAM,KAAK,IAAI,KAAK,WAAW,IAAI,CAAC,CACtD;AAAA,IACJ;AACA,UAAM,QAAQ,CAAC,SAAS,OAAO;AAC/B,WAAO;AAAA;AAAA;AAAA,kBAGG,MAAM,IACJ,CAAC,MAAM,UAAU;AAAA,0CACK;AAAA;AAAA,gDAEM;AAAA,wCACR,UAAU,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,qBAM/C;AAAA;AAAA;AAAA,EAGZ;AAAA,EAEmB,aAAa,SAA+B;AAC3D,UAAM,aAAa,OAAO;AAC1B,QAAI,CAAC,KAAK,aAAa,MAAM,GAAG;AAC5B,WAAK,aAAa,QAAQ,aAAa;AAAA,IAC3C;AAAA,EACJ;AAAA,EAEmB,QAAQ,SAA+B;AACtD,UAAM,QAAQ,OAAO;AACrB,QAAI,CAAC,KAAK,iBAAiB,QAAQ,IAAI,UAAU,GAAG;AAChD,WAAK,aAAa,iBAAiB,KAAK,KAAK,QAAQ;AAAA,IACzD,WAAW,KAAK,aAAa,eAAe,GAAG;AAC3C,WAAK,gBAAgB,eAAe;AAAA,IACxC;AACA,QAAI,KAAK,SAAS,QAAQ,IAAI,OAAO,GAAG;AACpC,WAAK,aAAa,cAAc,KAAK,KAAK;AAAA,IAC9C;AAEA,QAAI,OAAoB;AACpB,UACI,CAAC,KAAK,SACN,CAAC,KAAK,aAAa,YAAY,KAC/B,CAAC,KAAK,aAAa,iBAAiB,GACtC;AACE,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 PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport progressCircleStyles from './progress-circle.css.js';\n\n/**\n * @element sp-progress-circle\n */\nexport class ProgressCircle extends SizedMixin(SpectrumElement, {\n validSizes: ['s', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [progressCircleStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String })\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'over-background' })\n public overBackground = false;\n\n @property({ type: Number })\n public progress = 0;\n\n private makeRotation(rotation: number): string | undefined {\n return this.indeterminate\n ? undefined\n : `transform: rotate(${rotation}deg);`;\n }\n\n protected override render(): TemplateResult {\n const styles = [\n this.makeRotation(-180 + (180 / 50) * Math.min(this.progress, 50)),\n this.makeRotation(\n -180 + (180 / 50) * Math.max(this.progress - 50, 0)\n ),\n ];\n const masks = ['Mask1', 'Mask2'];\n return html`\n <div class=\"track\"></div>\n <div class=\"fills\">\n ${masks.map(\n (mask, index) => html`\n <div class=\"fill${mask}\">\n <div\n class=\"fillSub${mask}\"\n style=${ifDefined(styles[index])}\n >\n <div class=\"fill\"></div>\n </div>\n </div>\n `\n )}\n </div>\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'progressbar');\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n } else if (this.hasAttribute('aria-valuenow')) {\n this.removeAttribute('aria-valuenow');\n }\n if (this.label && changes.has('label')) {\n this.setAttribute('aria-label', this.label);\n }\n\n if (window.__swc.DEBUG) {\n if (\n !this.label &&\n !this.getAttribute('aria-label') &&\n !this.getAttribute('aria-labelledby')\n ) {\n window.__swc.warn(\n this,\n '<sp-progress-circle> elements will not be accessible to screen readers without one of the following:',\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#accessibility',\n {\n type: 'accessibility',\n issues: [\n 'value supplied to the \"label\" attribute, which will be displayed visually as part of the element, or',\n 'value supplied to the \"aria-label\" attribute, which will only be provided to screen readers, or',\n 'an element ID reference supplied to the \"aria-labelledby\" attribute, which will be provided by screen readers and will need to be managed manually by the parent application.',\n ]\n },\n );\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;AAEA;AAKO,aAAM,uBAAuB,WAAW,iBAAiB;AAAA,EAC5D,YAAY,CAAC,KAAK,KAAK,GAAG;AAC9B,CAAC,EAAE;AAAA,EAFI;AAAA;AAQI,yBAAgB;AAGhB,iBAAQ;AAGR,0BAAiB;AAGjB,oBAAW;AAAA;AAAA,aAdS,SAAyB;AAChD,WAAO,CAAC,oBAAoB;AAAA,EAChC;AAAA,EAcQ,aAAa,UAAsC;AACvD,WAAO,KAAK,gBACN,SACA,qBAAqB;AAAA,EAC/B;AAAA,EAEmB,SAAyB;AACxC,UAAM,SAAS;AAAA,MACX,KAAK,aAAa,OAAQ,MAAM,KAAM,KAAK,IAAI,KAAK,UAAU,EAAE,CAAC;AAAA,MACjE,KAAK,aACD,OAAQ,MAAM,KAAM,KAAK,IAAI,KAAK,WAAW,IAAI,CAAC,CACtD;AAAA,IACJ;AACA,UAAM,QAAQ,CAAC,SAAS,OAAO;AAC/B,WAAO;AAAA;AAAA;AAAA,kBAGG,MAAM,IACJ,CAAC,MAAM,UAAU;AAAA,0CACK;AAAA;AAAA,gDAEM;AAAA,wCACR,UAAU,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,qBAM/C;AAAA;AAAA;AAAA,EAGZ;AAAA,EAEmB,aAAa,SAA+B;AAC3D,UAAM,aAAa,OAAO;AAC1B,QAAI,CAAC,KAAK,aAAa,MAAM,GAAG;AAC5B,WAAK,aAAa,QAAQ,aAAa;AAAA,IAC3C;AAAA,EACJ;AAAA,EAEmB,QAAQ,SAA+B;AACtD,UAAM,QAAQ,OAAO;AACrB,QAAI,CAAC,KAAK,iBAAiB,QAAQ,IAAI,UAAU,GAAG;AAChD,WAAK,aAAa,iBAAiB,KAAK,KAAK,QAAQ;AAAA,IACzD,WAAW,KAAK,aAAa,eAAe,GAAG;AAC3C,WAAK,gBAAgB,eAAe;AAAA,IACxC;AACA,QAAI,KAAK,SAAS,QAAQ,IAAI,OAAO,GAAG;AACpC,WAAK,aAAa,cAAc,KAAK,KAAK;AAAA,IAC9C;AAEA,QAAI,OAAoB;AACpB,UACI,CAAC,KAAK,SACN,CAAC,KAAK,aAAa,YAAY,KAC/B,CAAC,KAAK,aAAa,iBAAiB,GACtC;AACE,eAAO,MAAM,KACT,MACA,wGACA,kGACA;AAAA,UACI,MAAM;AAAA,UACN,QAAQ;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,UACJ;AAAA,QACJ,CACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;AApFW;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AARJ,eAQI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GACnB,AAXJ,eAWI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,kBAAkB,CAAC;AAAA,GACjE,AAdJ,eAcI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GACnB,AAjBJ,eAiBI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["progress-circle.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 { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/progress-circle/sp-progress-circle.js';\n\nexport default {\n title: 'Progress Circle',\n component: 'sp-progress-circle',\n argTypes: {\n indeterminate: {\n name: 'indeterminate',\n type: { name: 'boolean', required: false },\n description: 'Whether the progress is indeterminate.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n },\n};\n\ninterface StoryArgs {\n indeterminate?: boolean;\n}\n\nexport const Default = ({ indeterminate }: StoryArgs = {}): TemplateResult => {\n return html`\n <div\n style=\"width: 250px; height: 150px; display: flex; align-items: center; justify-content: space-around;\"\n >\n <sp-progress-circle\n progress=\"27\"\n size=\"s\"\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n <sp-progress-circle\n progress=\"27\"\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n <sp-progress-circle\n progress=\"27\"\n size=\"l\"\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n </div>\n `;\n};\nDefault.args = {\n indeterminate: false,\n};\n\nexport const overBackground = ({\n indeterminate,\n}: StoryArgs = {}): TemplateResult => {\n return html`\n <div\n style=\"width: 250px; height: 150px; background-color: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: space-around;\"\n >\n <sp-progress-circle\n progress=\"53\"\n over-background\n size=\"s\"\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n <sp-progress-circle\n progress=\"53\"\n over-background\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n <sp-progress-circle\n progress=\"53\"\n over-background\n size=\"l\"\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n </div>\n `;\n};\noverBackground.args = {\n indeterminate: false,\n};\n\noverBackground.
|
|
5
|
-
"mappings": "AAYA;AAEA;AAEA,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,UAAU;AAAA,IACN,eAAe;AAAA,MACX,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,WAAW,UAAU,MAAM;AAAA,MACzC,aAAa;AAAA,MACb,OAAO;AAAA,QACH,MAAM,EAAE,SAAS,UAAU;AAAA,QAC3B,cAAc,EAAE,SAAS,MAAM;AAAA,MACnC;AAAA,MACA,SAAS;AAAA,QACL,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,EACJ;AACJ;AAMO,aAAM,UAAU,CAAC,EAAE,kBAA6B,CAAC,MAAsB;AAC1E,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAOsB;AAAA;AAAA;AAAA;AAAA,iCAIA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKA;AAAA;AAAA;AAAA;AAIjC;AACA,QAAQ,OAAO;AAAA,EACX,eAAe;AACnB;AAEO,aAAM,iBAAiB,CAAC;AAAA,EAC3B;AAAA,IACW,CAAC,MAAsB;AAClC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAQsB;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAMA;AAAA;AAAA;AAAA;AAIjC;AACA,eAAe,OAAO;AAAA,EAClB,eAAe;AACnB;AAEA,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*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/progress-circle/sp-progress-circle.js';\n\nexport default {\n title: 'Progress Circle',\n component: 'sp-progress-circle',\n argTypes: {\n indeterminate: {\n name: 'indeterminate',\n type: { name: 'boolean', required: false },\n description: 'Whether the progress is indeterminate.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n },\n};\n\ninterface StoryArgs {\n indeterminate?: boolean;\n}\n\nexport const Default = ({ indeterminate }: StoryArgs = {}): TemplateResult => {\n return html`\n <div\n style=\"width: 250px; height: 150px; display: flex; align-items: center; justify-content: space-around;\"\n >\n <sp-progress-circle\n progress=\"27\"\n size=\"s\"\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n <sp-progress-circle\n progress=\"27\"\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n <sp-progress-circle\n progress=\"27\"\n size=\"l\"\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n </div>\n `;\n};\nDefault.args = {\n indeterminate: false,\n};\n\nexport const overBackground = ({\n indeterminate,\n}: StoryArgs = {}): TemplateResult => {\n return html`\n <div\n style=\"width: 250px; height: 150px; background-color: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: space-around;\"\n >\n <sp-progress-circle\n progress=\"53\"\n over-background\n size=\"s\"\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n <sp-progress-circle\n progress=\"53\"\n over-background\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n <sp-progress-circle\n progress=\"53\"\n over-background\n size=\"l\"\n ?indeterminate=${indeterminate}\n ></sp-progress-circle>\n </div>\n `;\n};\noverBackground.args = {\n indeterminate: false,\n};\n\noverBackground.storyName = 'Over background';\n"],
|
|
5
|
+
"mappings": "AAYA;AAEA;AAEA,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,UAAU;AAAA,IACN,eAAe;AAAA,MACX,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,WAAW,UAAU,MAAM;AAAA,MACzC,aAAa;AAAA,MACb,OAAO;AAAA,QACH,MAAM,EAAE,SAAS,UAAU;AAAA,QAC3B,cAAc,EAAE,SAAS,MAAM;AAAA,MACnC;AAAA,MACA,SAAS;AAAA,QACL,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,EACJ;AACJ;AAMO,aAAM,UAAU,CAAC,EAAE,kBAA6B,CAAC,MAAsB;AAC1E,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAOsB;AAAA;AAAA;AAAA;AAAA,iCAIA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKA;AAAA;AAAA;AAAA;AAIjC;AACA,QAAQ,OAAO;AAAA,EACX,eAAe;AACnB;AAEO,aAAM,iBAAiB,CAAC;AAAA,EAC3B;AAAA,IACW,CAAC,MAAsB;AAClC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAQsB;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAMA;AAAA;AAAA;AAAA;AAIjC;AACA,eAAe,OAAO;AAAA,EAClB,eAAe;AACnB;AAEA,eAAe,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
|
|
2
2
|
import "@spectrum-web-components/progress-circle/sp-progress-circle.js";
|
|
3
|
+
import { stub } from "sinon";
|
|
4
|
+
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
3
5
|
describe("ProgressCircle", () => {
|
|
6
|
+
testForLitDevWarnings(async () => await fixture(html`
|
|
7
|
+
<sp-progress-circle label="Loading"></sp-progress-circle>
|
|
8
|
+
`));
|
|
4
9
|
it("loads", async () => {
|
|
5
10
|
const el = await fixture(html`
|
|
6
11
|
<sp-progress-circle label="Loading"></sp-progress-circle>
|
|
@@ -22,14 +27,20 @@ describe("ProgressCircle", () => {
|
|
|
22
27
|
});
|
|
23
28
|
it("accepts user `role`", async () => {
|
|
24
29
|
const el = await fixture(html`
|
|
25
|
-
<sp-progress-circle
|
|
30
|
+
<sp-progress-circle
|
|
31
|
+
role="progressbar"
|
|
32
|
+
label="With user role"
|
|
33
|
+
></sp-progress-circle>
|
|
26
34
|
`);
|
|
27
35
|
await elementUpdated(el);
|
|
28
36
|
expect(el.getAttribute("role")).to.equal("progressbar");
|
|
29
37
|
});
|
|
30
38
|
it("returns to indeterminate", async () => {
|
|
31
39
|
const el = await fixture(html`
|
|
32
|
-
<sp-progress-circle
|
|
40
|
+
<sp-progress-circle
|
|
41
|
+
progress="50"
|
|
42
|
+
label="Will be indeterminate"
|
|
43
|
+
></sp-progress-circle>
|
|
33
44
|
`);
|
|
34
45
|
await elementUpdated(el);
|
|
35
46
|
expect(el.hasAttribute("aria-valuenow")).to.be.true;
|
|
@@ -38,5 +49,23 @@ describe("ProgressCircle", () => {
|
|
|
38
49
|
await elementUpdated(el);
|
|
39
50
|
expect(el.hasAttribute("aria-valuenow")).to.be.false;
|
|
40
51
|
});
|
|
52
|
+
it("warns in Dev Mode when accessible attributes are not leveraged", async () => {
|
|
53
|
+
const consoleWarnStub = stub(console, "warn");
|
|
54
|
+
const el = await fixture(html`
|
|
55
|
+
<sp-progress-circle progress="50"></sp-progress-circle>
|
|
56
|
+
`);
|
|
57
|
+
await elementUpdated(el);
|
|
58
|
+
expect(consoleWarnStub.called).to.be.true;
|
|
59
|
+
const spyCall = consoleWarnStub.getCall(0);
|
|
60
|
+
expect(spyCall.args.at(0).includes("accessible"), "confirm accessibility-centric message").to.be.true;
|
|
61
|
+
expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({
|
|
62
|
+
data: {
|
|
63
|
+
localName: "sp-progress-circle",
|
|
64
|
+
type: "accessibility",
|
|
65
|
+
level: "default"
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
consoleWarnStub.restore();
|
|
69
|
+
});
|
|
41
70
|
});
|
|
42
71
|
//# sourceMappingURL=progress-circle.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["progress-circle.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/progress-circle/sp-progress-circle.js';\nimport { ProgressCircle } from '@spectrum-web-components/progress-circle';\n\ndescribe('ProgressCircle', () => {\n it('loads', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle label=\"Loading\"></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('loads - [indeterminate]', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n indeterminate\n label=\"Loading\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('accepts user `role`', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle
|
|
5
|
-
"mappings": "AAYA;AAEA;
|
|
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/progress-circle/sp-progress-circle.js';\nimport { ProgressCircle } from '@spectrum-web-components/progress-circle';\nimport { stub } from 'sinon';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('ProgressCircle', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<ProgressCircle>(html`\n <sp-progress-circle label=\"Loading\"></sp-progress-circle>\n `)\n );\n it('loads', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle label=\"Loading\"></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('loads - [indeterminate]', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n indeterminate\n label=\"Loading\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('accepts user `role`', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n role=\"progressbar\"\n label=\"With user role\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.getAttribute('role')).to.equal('progressbar');\n });\n it('returns to indeterminate', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n progress=\"50\"\n label=\"Will be indeterminate\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.hasAttribute('aria-valuenow')).to.be.true;\n expect(el.getAttribute('aria-valuenow')).to.equal('50');\n\n el.indeterminate = true;\n\n await elementUpdated(el);\n\n expect(el.hasAttribute('aria-valuenow')).to.be.false;\n });\n it('warns in Dev Mode when accessible attributes are not leveraged', async () => {\n const consoleWarnStub = stub(console, 'warn');\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle progress=\"50\"></sp-progress-circle>\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('accessible'),\n 'confirm accessibility-centric message'\n ).to.be.true;\n expect(spyCall.args.at(-1), 'confirm `data` shape').to.deep.equal({\n data: {\n localName: 'sp-progress-circle',\n type: 'accessibility',\n level: 'default',\n },\n });\n consoleWarnStub.restore();\n });\n});\n"],
|
|
5
|
+
"mappings": "AAYA;AAEA;AAEA;AACA;AAEA,SAAS,kBAAkB,MAAM;AAC7B,wBACI,YACI,MAAM,QAAwB;AAAA;AAAA,aAE7B,CACT;AACA,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA,SAExC;AAED,UAAM,eAAe,EAAE;AACvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AAErB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,2BAA2B,YAAY;AACtC,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA;AAAA,SAKxC;AAED,UAAM,eAAe,EAAE;AACvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AAErB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,uBAAuB,YAAY;AAClC,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA;AAAA,SAKxC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,aAAa,MAAM,CAAC,EAAE,GAAG,MAAM,aAAa;AAAA,EAC1D,CAAC;AACD,KAAG,4BAA4B,YAAY;AACvC,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA;AAAA,SAKxC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,aAAa,eAAe,CAAC,EAAE,GAAG,GAAG;AAC/C,WAAO,GAAG,aAAa,eAAe,CAAC,EAAE,GAAG,MAAM,IAAI;AAEtD,OAAG,gBAAgB;AAEnB,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,aAAa,eAAe,CAAC,EAAE,GAAG,GAAG;AAAA,EACnD,CAAC;AACD,KAAG,kEAAkE,YAAY;AAC7E,UAAM,kBAAkB,KAAK,SAAS,MAAM;AAC5C,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA,SAExC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,gBAAgB,MAAM,EAAE,GAAG,GAAG;AACrC,UAAM,UAAU,gBAAgB,QAAQ,CAAC;AACzC,WACI,QAAQ,KAAK,GAAG,CAAC,EAAE,SAAS,YAAY,GACxC,uCACJ,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
|
}
|