@instructure/ui-progress 10.6.0 → 10.6.1-snapshot-1

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/es/ProgressBar/__new-tests__/ProgressBar.test.js +78 -0
  3. package/es/ProgressCircle/__new-tests__/ProgressCircle.test.js +78 -0
  4. package/lib/ProgressBar/__new-tests__/ProgressBar.test.js +80 -0
  5. package/lib/ProgressCircle/__new-tests__/ProgressCircle.test.js +80 -0
  6. package/package.json +16 -13
  7. package/src/ProgressBar/__new-tests__/ProgressBar.test.tsx +86 -0
  8. package/src/ProgressCircle/__new-tests__/ProgressCircle.test.tsx +86 -0
  9. package/tsconfig.build.json +1 -0
  10. package/tsconfig.build.tsbuildinfo +1 -1
  11. package/types/ProgressBar/__new-tests__/ProgressBar.test.d.ts +2 -0
  12. package/types/ProgressBar/__new-tests__/ProgressBar.test.d.ts.map +1 -0
  13. package/types/ProgressCircle/__new-tests__/ProgressCircle.test.d.ts +2 -0
  14. package/types/ProgressCircle/__new-tests__/ProgressCircle.test.d.ts.map +1 -0
  15. package/es/ProgressBar/ProgressBarLocator.js +0 -28
  16. package/es/ProgressBar/locator.js +0 -26
  17. package/es/ProgressCircle/ProgressCircleLocator.js +0 -28
  18. package/es/ProgressCircle/locator.js +0 -26
  19. package/lib/ProgressBar/ProgressBarLocator.js +0 -34
  20. package/lib/ProgressBar/locator.js +0 -37
  21. package/lib/ProgressCircle/ProgressCircleLocator.js +0 -34
  22. package/lib/ProgressCircle/locator.js +0 -37
  23. package/src/ProgressBar/ProgressBarLocator.ts +0 -29
  24. package/src/ProgressBar/locator.ts +0 -27
  25. package/src/ProgressCircle/ProgressCircleLocator.ts +0 -29
  26. package/src/ProgressCircle/locator.ts +0 -27
  27. package/types/ProgressBar/ProgressBarLocator.d.ts +0 -310
  28. package/types/ProgressBar/ProgressBarLocator.d.ts.map +0 -1
  29. package/types/ProgressBar/locator.d.ts +0 -4
  30. package/types/ProgressBar/locator.d.ts.map +0 -1
  31. package/types/ProgressCircle/ProgressCircleLocator.d.ts +0 -310
  32. package/types/ProgressCircle/ProgressCircleLocator.d.ts.map +0 -1
  33. package/types/ProgressCircle/locator.d.ts +0 -4
  34. package/types/ProgressCircle/locator.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [10.6.1-snapshot-1](https://github.com/instructure/instructure-ui/compare/v10.6.0...v10.6.1-snapshot-1) (2024-11-19)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-progress
9
+
10
+
11
+
12
+
13
+
6
14
  # [10.6.0](https://github.com/instructure/instructure-ui/compare/v10.5.0...v10.6.0) (2024-11-18)
7
15
 
8
16
 
@@ -0,0 +1,78 @@
1
+ var _ProgressBar, _ProgressBar2, _ProgressBar3;
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2015 - present Instructure, Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ import React from 'react';
27
+ import { render } from '@testing-library/react';
28
+ import '@testing-library/jest-dom';
29
+ import { runAxeCheck } from '@instructure/ui-axe-check';
30
+ import { ProgressBar } from '../index';
31
+ describe('<ProgressBar />', () => {
32
+ it('should render', async () => {
33
+ const _render = render(_ProgressBar || (_ProgressBar = /*#__PURE__*/React.createElement(ProgressBar, {
34
+ screenReaderLabel: "Chapters read",
35
+ valueMax: 60,
36
+ valueNow: 30
37
+ }))),
38
+ container = _render.container;
39
+ const progress = container.querySelector('progress');
40
+ expect(progress).toBeInTheDocument();
41
+ });
42
+ it('should render a progress element with correct aria attributes', async () => {
43
+ const _render2 = render(_ProgressBar2 || (_ProgressBar2 = /*#__PURE__*/React.createElement(ProgressBar, {
44
+ screenReaderLabel: "Chapters read",
45
+ valueMax: 60,
46
+ valueNow: 30
47
+ }))),
48
+ container = _render2.container;
49
+ const progress = container.querySelector('progress');
50
+ expect(progress).toHaveAttribute('value', '30');
51
+ });
52
+ it('should format the displayed text', async () => {
53
+ const current = 30;
54
+ const max = 60;
55
+ const _render3 = render(/*#__PURE__*/React.createElement(ProgressBar, {
56
+ screenReaderLabel: "Chapters read",
57
+ valueMax: max,
58
+ valueNow: current,
59
+ renderValue: ({
60
+ valueNow,
61
+ valueMax
62
+ }) => `${valueNow} of ${valueMax}`
63
+ })),
64
+ container = _render3.container;
65
+ const progress = container.querySelector('[class$="-progressBar"]');
66
+ expect(progress).toHaveTextContent(`${current} of ${max}`);
67
+ });
68
+ it('should meet a11y standards', async () => {
69
+ const _render4 = render(_ProgressBar3 || (_ProgressBar3 = /*#__PURE__*/React.createElement(ProgressBar, {
70
+ screenReaderLabel: "Chapters read",
71
+ valueMax: 60,
72
+ valueNow: 30
73
+ }))),
74
+ container = _render4.container;
75
+ const axeCheck = await runAxeCheck(container);
76
+ expect(axeCheck).toBe(true);
77
+ });
78
+ });
@@ -0,0 +1,78 @@
1
+ var _ProgressCircle, _ProgressCircle2, _ProgressCircle3;
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2015 - present Instructure, Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ import React from 'react';
27
+ import { render } from '@testing-library/react';
28
+ import '@testing-library/jest-dom';
29
+ import { runAxeCheck } from '@instructure/ui-axe-check';
30
+ import { ProgressCircle } from '../index';
31
+ describe('<ProgressCircle />', () => {
32
+ it('should render', async () => {
33
+ const _render = render(_ProgressCircle || (_ProgressCircle = /*#__PURE__*/React.createElement(ProgressCircle, {
34
+ screenReaderLabel: "Chapters read",
35
+ valueMax: 60,
36
+ valueNow: 30
37
+ }))),
38
+ container = _render.container;
39
+ const progress = container.querySelector('progress');
40
+ expect(progress).toBeInTheDocument();
41
+ });
42
+ it('should render a progress element with correct aria attributes', async () => {
43
+ const _render2 = render(_ProgressCircle2 || (_ProgressCircle2 = /*#__PURE__*/React.createElement(ProgressCircle, {
44
+ screenReaderLabel: "Chapters read",
45
+ valueMax: 60,
46
+ valueNow: 30
47
+ }))),
48
+ container = _render2.container;
49
+ const progress = container.querySelector('progress');
50
+ expect(progress).toHaveAttribute('value', '30');
51
+ });
52
+ it('should format the displayed text', async () => {
53
+ const current = 30;
54
+ const max = 60;
55
+ const _render3 = render(/*#__PURE__*/React.createElement(ProgressCircle, {
56
+ screenReaderLabel: "Chapters read",
57
+ valueMax: max,
58
+ valueNow: current,
59
+ renderValue: ({
60
+ valueNow,
61
+ valueMax
62
+ }) => `${valueNow} of ${valueMax}`
63
+ })),
64
+ container = _render3.container;
65
+ const progress = container.querySelector('[class$="-progressCircle"]');
66
+ expect(progress).toHaveTextContent(`${current} of ${max}`);
67
+ });
68
+ it('should meet a11y standards', async () => {
69
+ const _render4 = render(_ProgressCircle3 || (_ProgressCircle3 = /*#__PURE__*/React.createElement(ProgressCircle, {
70
+ screenReaderLabel: "Chapters read",
71
+ valueMax: 60,
72
+ valueNow: 30
73
+ }))),
74
+ container = _render4.container;
75
+ const axeCheck = await runAxeCheck(container);
76
+ expect(axeCheck).toBe(true);
77
+ });
78
+ });
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _react = _interopRequireDefault(require("react"));
5
+ var _react2 = require("@testing-library/react");
6
+ require("@testing-library/jest-dom");
7
+ var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
8
+ var _index = require("../index");
9
+ var _ProgressBar, _ProgressBar2, _ProgressBar3;
10
+ /*
11
+ * The MIT License (MIT)
12
+ *
13
+ * Copyright (c) 2015 - present Instructure, Inc.
14
+ *
15
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ * of this software and associated documentation files (the "Software"), to deal
17
+ * in the Software without restriction, including without limitation the rights
18
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ * copies of the Software, and to permit persons to whom the Software is
20
+ * furnished to do so, subject to the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be included in all
23
+ * copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ * SOFTWARE.
32
+ */
33
+ describe('<ProgressBar />', () => {
34
+ it('should render', async () => {
35
+ const _render = (0, _react2.render)(_ProgressBar || (_ProgressBar = /*#__PURE__*/_react.default.createElement(_index.ProgressBar, {
36
+ screenReaderLabel: "Chapters read",
37
+ valueMax: 60,
38
+ valueNow: 30
39
+ }))),
40
+ container = _render.container;
41
+ const progress = container.querySelector('progress');
42
+ expect(progress).toBeInTheDocument();
43
+ });
44
+ it('should render a progress element with correct aria attributes', async () => {
45
+ const _render2 = (0, _react2.render)(_ProgressBar2 || (_ProgressBar2 = /*#__PURE__*/_react.default.createElement(_index.ProgressBar, {
46
+ screenReaderLabel: "Chapters read",
47
+ valueMax: 60,
48
+ valueNow: 30
49
+ }))),
50
+ container = _render2.container;
51
+ const progress = container.querySelector('progress');
52
+ expect(progress).toHaveAttribute('value', '30');
53
+ });
54
+ it('should format the displayed text', async () => {
55
+ const current = 30;
56
+ const max = 60;
57
+ const _render3 = (0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.ProgressBar, {
58
+ screenReaderLabel: "Chapters read",
59
+ valueMax: max,
60
+ valueNow: current,
61
+ renderValue: ({
62
+ valueNow,
63
+ valueMax
64
+ }) => `${valueNow} of ${valueMax}`
65
+ })),
66
+ container = _render3.container;
67
+ const progress = container.querySelector('[class$="-progressBar"]');
68
+ expect(progress).toHaveTextContent(`${current} of ${max}`);
69
+ });
70
+ it('should meet a11y standards', async () => {
71
+ const _render4 = (0, _react2.render)(_ProgressBar3 || (_ProgressBar3 = /*#__PURE__*/_react.default.createElement(_index.ProgressBar, {
72
+ screenReaderLabel: "Chapters read",
73
+ valueMax: 60,
74
+ valueNow: 30
75
+ }))),
76
+ container = _render4.container;
77
+ const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
78
+ expect(axeCheck).toBe(true);
79
+ });
80
+ });
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _react = _interopRequireDefault(require("react"));
5
+ var _react2 = require("@testing-library/react");
6
+ require("@testing-library/jest-dom");
7
+ var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
8
+ var _index = require("../index");
9
+ var _ProgressCircle, _ProgressCircle2, _ProgressCircle3;
10
+ /*
11
+ * The MIT License (MIT)
12
+ *
13
+ * Copyright (c) 2015 - present Instructure, Inc.
14
+ *
15
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ * of this software and associated documentation files (the "Software"), to deal
17
+ * in the Software without restriction, including without limitation the rights
18
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ * copies of the Software, and to permit persons to whom the Software is
20
+ * furnished to do so, subject to the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be included in all
23
+ * copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ * SOFTWARE.
32
+ */
33
+ describe('<ProgressCircle />', () => {
34
+ it('should render', async () => {
35
+ const _render = (0, _react2.render)(_ProgressCircle || (_ProgressCircle = /*#__PURE__*/_react.default.createElement(_index.ProgressCircle, {
36
+ screenReaderLabel: "Chapters read",
37
+ valueMax: 60,
38
+ valueNow: 30
39
+ }))),
40
+ container = _render.container;
41
+ const progress = container.querySelector('progress');
42
+ expect(progress).toBeInTheDocument();
43
+ });
44
+ it('should render a progress element with correct aria attributes', async () => {
45
+ const _render2 = (0, _react2.render)(_ProgressCircle2 || (_ProgressCircle2 = /*#__PURE__*/_react.default.createElement(_index.ProgressCircle, {
46
+ screenReaderLabel: "Chapters read",
47
+ valueMax: 60,
48
+ valueNow: 30
49
+ }))),
50
+ container = _render2.container;
51
+ const progress = container.querySelector('progress');
52
+ expect(progress).toHaveAttribute('value', '30');
53
+ });
54
+ it('should format the displayed text', async () => {
55
+ const current = 30;
56
+ const max = 60;
57
+ const _render3 = (0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.ProgressCircle, {
58
+ screenReaderLabel: "Chapters read",
59
+ valueMax: max,
60
+ valueNow: current,
61
+ renderValue: ({
62
+ valueNow,
63
+ valueMax
64
+ }) => `${valueNow} of ${valueMax}`
65
+ })),
66
+ container = _render3.container;
67
+ const progress = container.querySelector('[class$="-progressCircle"]');
68
+ expect(progress).toHaveTextContent(`${current} of ${max}`);
69
+ });
70
+ it('should meet a11y standards', async () => {
71
+ const _render4 = (0, _react2.render)(_ProgressCircle3 || (_ProgressCircle3 = /*#__PURE__*/_react.default.createElement(_index.ProgressCircle, {
72
+ screenReaderLabel: "Chapters read",
73
+ valueMax: 60,
74
+ valueNow: 30
75
+ }))),
76
+ container = _render4.container;
77
+ const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
78
+ expect(axeCheck).toBe(true);
79
+ });
80
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-progress",
3
- "version": "10.6.0",
3
+ "version": "10.6.1-snapshot-1",
4
4
  "description": "Styled HTML <progress /> elements for showing completion of a task",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,21 +24,24 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.25.6",
27
- "@instructure/console": "10.6.0",
28
- "@instructure/emotion": "10.6.0",
29
- "@instructure/shared-types": "10.6.0",
30
- "@instructure/ui-a11y-content": "10.6.0",
31
- "@instructure/ui-color-utils": "10.6.0",
32
- "@instructure/ui-react-utils": "10.6.0",
33
- "@instructure/ui-testable": "10.6.0",
34
- "@instructure/ui-view": "10.6.0",
27
+ "@instructure/console": "10.6.1-snapshot-1",
28
+ "@instructure/emotion": "10.6.1-snapshot-1",
29
+ "@instructure/shared-types": "10.6.1-snapshot-1",
30
+ "@instructure/ui-a11y-content": "10.6.1-snapshot-1",
31
+ "@instructure/ui-color-utils": "10.6.1-snapshot-1",
32
+ "@instructure/ui-react-utils": "10.6.1-snapshot-1",
33
+ "@instructure/ui-testable": "10.6.1-snapshot-1",
34
+ "@instructure/ui-view": "10.6.1-snapshot-1",
35
35
  "prop-types": "^15.8.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@instructure/ui-babel-preset": "10.6.0",
39
- "@instructure/ui-test-locator": "10.6.0",
40
- "@instructure/ui-test-utils": "10.6.0",
41
- "@instructure/ui-themes": "10.6.0"
38
+ "@instructure/ui-axe-check": "10.6.1-snapshot-1",
39
+ "@instructure/ui-babel-preset": "10.6.1-snapshot-1",
40
+ "@instructure/ui-test-utils": "10.6.1-snapshot-1",
41
+ "@instructure/ui-themes": "10.6.1-snapshot-1",
42
+ "@testing-library/jest-dom": "^6.4.6",
43
+ "@testing-library/react": "^16.0.1",
44
+ "vitest": "^2.1.1"
42
45
  },
43
46
  "peerDependencies": {
44
47
  "react": ">=16.8 <=18"
@@ -0,0 +1,86 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import React from 'react'
26
+ import { render } from '@testing-library/react'
27
+
28
+ import '@testing-library/jest-dom'
29
+ import { runAxeCheck } from '@instructure/ui-axe-check'
30
+ import { ProgressBar } from '../index'
31
+
32
+ describe('<ProgressBar />', () => {
33
+ it('should render', async () => {
34
+ const { container } = render(
35
+ <ProgressBar
36
+ screenReaderLabel="Chapters read"
37
+ valueMax={60}
38
+ valueNow={30}
39
+ />
40
+ )
41
+ const progress = container.querySelector('progress')
42
+
43
+ expect(progress).toBeInTheDocument()
44
+ })
45
+
46
+ it('should render a progress element with correct aria attributes', async () => {
47
+ const { container } = render(
48
+ <ProgressBar
49
+ screenReaderLabel="Chapters read"
50
+ valueMax={60}
51
+ valueNow={30}
52
+ />
53
+ )
54
+ const progress = container.querySelector('progress')
55
+
56
+ expect(progress).toHaveAttribute('value', '30')
57
+ })
58
+
59
+ it('should format the displayed text', async () => {
60
+ const current = 30
61
+ const max = 60
62
+ const { container } = render(
63
+ <ProgressBar
64
+ screenReaderLabel="Chapters read"
65
+ valueMax={max}
66
+ valueNow={current}
67
+ renderValue={({ valueNow, valueMax }) => `${valueNow} of ${valueMax}`}
68
+ />
69
+ )
70
+ const progress = container.querySelector('[class$="-progressBar"]')
71
+
72
+ expect(progress).toHaveTextContent(`${current} of ${max}`)
73
+ })
74
+
75
+ it('should meet a11y standards', async () => {
76
+ const { container } = render(
77
+ <ProgressBar
78
+ screenReaderLabel="Chapters read"
79
+ valueMax={60}
80
+ valueNow={30}
81
+ />
82
+ )
83
+ const axeCheck = await runAxeCheck(container)
84
+ expect(axeCheck).toBe(true)
85
+ })
86
+ })
@@ -0,0 +1,86 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import React from 'react'
26
+ import { render } from '@testing-library/react'
27
+
28
+ import '@testing-library/jest-dom'
29
+ import { runAxeCheck } from '@instructure/ui-axe-check'
30
+ import { ProgressCircle } from '../index'
31
+
32
+ describe('<ProgressCircle />', () => {
33
+ it('should render', async () => {
34
+ const { container } = render(
35
+ <ProgressCircle
36
+ screenReaderLabel="Chapters read"
37
+ valueMax={60}
38
+ valueNow={30}
39
+ />
40
+ )
41
+ const progress = container.querySelector('progress')
42
+
43
+ expect(progress).toBeInTheDocument()
44
+ })
45
+
46
+ it('should render a progress element with correct aria attributes', async () => {
47
+ const { container } = render(
48
+ <ProgressCircle
49
+ screenReaderLabel="Chapters read"
50
+ valueMax={60}
51
+ valueNow={30}
52
+ />
53
+ )
54
+ const progress = container.querySelector('progress')
55
+
56
+ expect(progress).toHaveAttribute('value', '30')
57
+ })
58
+
59
+ it('should format the displayed text', async () => {
60
+ const current = 30
61
+ const max = 60
62
+ const { container } = render(
63
+ <ProgressCircle
64
+ screenReaderLabel="Chapters read"
65
+ valueMax={max}
66
+ valueNow={current}
67
+ renderValue={({ valueNow, valueMax }) => `${valueNow} of ${valueMax}`}
68
+ />
69
+ )
70
+ const progress = container.querySelector('[class$="-progressCircle"]')
71
+
72
+ expect(progress).toHaveTextContent(`${current} of ${max}`)
73
+ })
74
+
75
+ it('should meet a11y standards', async () => {
76
+ const { container } = render(
77
+ <ProgressCircle
78
+ screenReaderLabel="Chapters read"
79
+ valueMax={60}
80
+ valueNow={30}
81
+ />
82
+ )
83
+ const axeCheck = await runAxeCheck(container)
84
+ expect(axeCheck).toBe(true)
85
+ })
86
+ })
@@ -11,6 +11,7 @@
11
11
  { "path": "../emotion/tsconfig.build.json" },
12
12
  { "path": "../shared-types/tsconfig.build.json" },
13
13
  { "path": "../ui-a11y-content/tsconfig.build.json" },
14
+ { "path": "../ui-axe-check/tsconfig.build.json" },
14
15
  { "path": "../ui-color-utils/tsconfig.build.json" },
15
16
  { "path": "../ui-react-utils/tsconfig.build.json" },
16
17
  { "path": "../ui-testable/tsconfig.build.json" },