@instructure/ui-rating 9.2.1-snapshot-1 → 9.2.1-snapshot-3
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/CHANGELOG.md +1 -1
- package/es/Rating/__new-tests__/Rating.test.js +3 -2
- package/es/RatingIcon/__new-tests__/RatingIcon.test.js +12 -0
- package/lib/Rating/__new-tests__/Rating.test.js +3 -2
- package/lib/RatingIcon/__new-tests__/RatingIcon.test.js +12 -0
- package/package.json +16 -15
- package/src/Rating/__new-tests__/Rating.test.tsx +3 -2
- package/src/RatingIcon/__new-tests__/RatingIcon.test.tsx +20 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Rating/__new-tests__/Rating.test.d.ts.map +1 -1
- package/types/RatingIcon/__new-tests__/RatingIcon.test.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
## [9.2.1-snapshot-
|
|
6
|
+
## [9.2.1-snapshot-3](https://github.com/instructure/instructure-ui/compare/v9.2.0...v9.2.1-snapshot-3) (2024-07-12)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-rating
|
|
9
9
|
|
|
@@ -25,6 +25,7 @@ var _Rating, _Rating2, _Rating3, _Rating4, _Rating5;
|
|
|
25
25
|
|
|
26
26
|
import React from 'react';
|
|
27
27
|
import { render } from '@testing-library/react';
|
|
28
|
+
import { vi } from 'vitest';
|
|
28
29
|
import '@testing-library/jest-dom';
|
|
29
30
|
import { runAxeCheck } from '@instructure/ui-axe-check';
|
|
30
31
|
import { View } from '@instructure/ui-view';
|
|
@@ -97,7 +98,7 @@ describe('<Rating />', () => {
|
|
|
97
98
|
View.allowedProps.filter(prop => prop !== 'children').forEach(prop => {
|
|
98
99
|
if (Object.keys(allowedProps).indexOf(prop) < 0) {
|
|
99
100
|
it(`should NOT allow the '${prop}' prop`, () => {
|
|
100
|
-
const consoleErrorSpy =
|
|
101
|
+
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
101
102
|
const expectedErrorMessage = `Warning: [undefined] prop '${prop}' is not allowed.`;
|
|
102
103
|
const props = {
|
|
103
104
|
[prop]: 'foo'
|
|
@@ -114,7 +115,7 @@ describe('<Rating />', () => {
|
|
|
114
115
|
const props = {
|
|
115
116
|
[prop]: allowedProps[prop]
|
|
116
117
|
};
|
|
117
|
-
const consoleErrorSpy =
|
|
118
|
+
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
118
119
|
render( /*#__PURE__*/React.createElement(Rating, Object.assign({
|
|
119
120
|
label: "Course rating",
|
|
120
121
|
iconCount: 5
|
|
@@ -25,11 +25,23 @@ var _RatingIcon, _RatingIcon2, _RatingIcon3, _RatingIcon4;
|
|
|
25
25
|
|
|
26
26
|
import React from 'react';
|
|
27
27
|
import { render, waitFor } from '@testing-library/react';
|
|
28
|
+
import { vi } from 'vitest';
|
|
28
29
|
import '@testing-library/jest-dom';
|
|
29
30
|
import { InstUISettingsProvider } from '@instructure/emotion';
|
|
30
31
|
import { runAxeCheck } from '@instructure/ui-axe-check';
|
|
31
32
|
import { RatingIcon } from '../index';
|
|
32
33
|
describe('<RatingIcon />', () => {
|
|
34
|
+
let consoleWarningMock;
|
|
35
|
+
let consoleErrorMock;
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
// Mocking console to prevent test output pollution and expect for messages
|
|
38
|
+
consoleWarningMock = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
39
|
+
consoleErrorMock = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
40
|
+
});
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
consoleWarningMock.mockRestore();
|
|
43
|
+
consoleErrorMock.mockRestore();
|
|
44
|
+
});
|
|
33
45
|
it('transitions when filled on render and animateFill is true', async () => {
|
|
34
46
|
const _render = render( /*#__PURE__*/React.createElement(InstUISettingsProvider, {
|
|
35
47
|
theme: {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _react2 = require("@testing-library/react");
|
|
6
|
+
var _vitest = require("vitest");
|
|
6
7
|
require("@testing-library/jest-dom");
|
|
7
8
|
var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
|
|
8
9
|
var _View = require("@instructure/ui-view/lib/View");
|
|
@@ -99,7 +100,7 @@ describe('<Rating />', () => {
|
|
|
99
100
|
_View.View.allowedProps.filter(prop => prop !== 'children').forEach(prop => {
|
|
100
101
|
if (Object.keys(allowedProps).indexOf(prop) < 0) {
|
|
101
102
|
it(`should NOT allow the '${prop}' prop`, () => {
|
|
102
|
-
const consoleErrorSpy =
|
|
103
|
+
const consoleErrorSpy = _vitest.vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
103
104
|
const expectedErrorMessage = `Warning: [undefined] prop '${prop}' is not allowed.`;
|
|
104
105
|
const props = {
|
|
105
106
|
[prop]: 'foo'
|
|
@@ -116,7 +117,7 @@ describe('<Rating />', () => {
|
|
|
116
117
|
const props = {
|
|
117
118
|
[prop]: allowedProps[prop]
|
|
118
119
|
};
|
|
119
|
-
const consoleErrorSpy =
|
|
120
|
+
const consoleErrorSpy = _vitest.vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
120
121
|
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.Rating, Object.assign({
|
|
121
122
|
label: "Course rating",
|
|
122
123
|
iconCount: 5
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _react2 = require("@testing-library/react");
|
|
6
|
+
var _vitest = require("vitest");
|
|
6
7
|
require("@testing-library/jest-dom");
|
|
7
8
|
var _emotion = require("@instructure/emotion");
|
|
8
9
|
var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
|
|
@@ -32,6 +33,17 @@ var _RatingIcon, _RatingIcon2, _RatingIcon3, _RatingIcon4;
|
|
|
32
33
|
* SOFTWARE.
|
|
33
34
|
*/
|
|
34
35
|
describe('<RatingIcon />', () => {
|
|
36
|
+
let consoleWarningMock;
|
|
37
|
+
let consoleErrorMock;
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
// Mocking console to prevent test output pollution and expect for messages
|
|
40
|
+
consoleWarningMock = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
41
|
+
consoleErrorMock = _vitest.vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
42
|
+
});
|
|
43
|
+
afterEach(() => {
|
|
44
|
+
consoleWarningMock.mockRestore();
|
|
45
|
+
consoleErrorMock.mockRestore();
|
|
46
|
+
});
|
|
35
47
|
it('transitions when filled on render and animateFill is true', async () => {
|
|
36
48
|
const _render = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_emotion.InstUISettingsProvider, {
|
|
37
49
|
theme: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-rating",
|
|
3
|
-
"version": "9.2.1-snapshot-
|
|
3
|
+
"version": "9.2.1-snapshot-3",
|
|
4
4
|
"description": "A static rating component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,24 +24,25 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.24.5",
|
|
27
|
-
"@instructure/console": "9.2.1-snapshot-
|
|
28
|
-
"@instructure/emotion": "9.2.1-snapshot-
|
|
29
|
-
"@instructure/shared-types": "9.2.1-snapshot-
|
|
30
|
-
"@instructure/ui-a11y-content": "9.2.1-snapshot-
|
|
31
|
-
"@instructure/ui-dom-utils": "9.2.1-snapshot-
|
|
32
|
-
"@instructure/ui-icons": "9.2.1-snapshot-
|
|
33
|
-
"@instructure/ui-motion": "9.2.1-snapshot-
|
|
34
|
-
"@instructure/ui-react-utils": "9.2.1-snapshot-
|
|
35
|
-
"@instructure/ui-testable": "9.2.1-snapshot-
|
|
36
|
-
"@instructure/ui-view": "9.2.1-snapshot-
|
|
27
|
+
"@instructure/console": "9.2.1-snapshot-3",
|
|
28
|
+
"@instructure/emotion": "9.2.1-snapshot-3",
|
|
29
|
+
"@instructure/shared-types": "9.2.1-snapshot-3",
|
|
30
|
+
"@instructure/ui-a11y-content": "9.2.1-snapshot-3",
|
|
31
|
+
"@instructure/ui-dom-utils": "9.2.1-snapshot-3",
|
|
32
|
+
"@instructure/ui-icons": "9.2.1-snapshot-3",
|
|
33
|
+
"@instructure/ui-motion": "9.2.1-snapshot-3",
|
|
34
|
+
"@instructure/ui-react-utils": "9.2.1-snapshot-3",
|
|
35
|
+
"@instructure/ui-testable": "9.2.1-snapshot-3",
|
|
36
|
+
"@instructure/ui-view": "9.2.1-snapshot-3",
|
|
37
37
|
"prop-types": "^15.8.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@instructure/ui-axe-check": "9.2.1-snapshot-
|
|
41
|
-
"@instructure/ui-babel-preset": "9.2.1-snapshot-
|
|
42
|
-
"@instructure/ui-themes": "9.2.1-snapshot-
|
|
40
|
+
"@instructure/ui-axe-check": "9.2.1-snapshot-3",
|
|
41
|
+
"@instructure/ui-babel-preset": "9.2.1-snapshot-3",
|
|
42
|
+
"@instructure/ui-themes": "9.2.1-snapshot-3",
|
|
43
43
|
"@testing-library/jest-dom": "^6.4.5",
|
|
44
|
-
"@testing-library/react": "^15.0.7"
|
|
44
|
+
"@testing-library/react": "^15.0.7",
|
|
45
|
+
"vitest": "^1.6.0"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
48
|
"react": ">=16.8 <=18"
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
26
|
import { render } from '@testing-library/react'
|
|
27
|
+
import { vi } from 'vitest'
|
|
27
28
|
|
|
28
29
|
import '@testing-library/jest-dom'
|
|
29
30
|
import { runAxeCheck } from '@instructure/ui-axe-check'
|
|
@@ -106,7 +107,7 @@ describe('<Rating />', () => {
|
|
|
106
107
|
.forEach((prop) => {
|
|
107
108
|
if (Object.keys(allowedProps).indexOf(prop) < 0) {
|
|
108
109
|
it(`should NOT allow the '${prop}' prop`, () => {
|
|
109
|
-
const consoleErrorSpy =
|
|
110
|
+
const consoleErrorSpy = vi
|
|
110
111
|
.spyOn(console, 'error')
|
|
111
112
|
.mockImplementation(() => {})
|
|
112
113
|
const expectedErrorMessage = `Warning: [undefined] prop '${prop}' is not allowed.`
|
|
@@ -125,7 +126,7 @@ describe('<Rating />', () => {
|
|
|
125
126
|
} else {
|
|
126
127
|
it(`should allow the '${prop}' prop`, () => {
|
|
127
128
|
const props = { [prop]: allowedProps[prop] }
|
|
128
|
-
const consoleErrorSpy =
|
|
129
|
+
const consoleErrorSpy = vi
|
|
129
130
|
.spyOn(console, 'error')
|
|
130
131
|
.mockImplementation(() => {})
|
|
131
132
|
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
26
|
import { render, waitFor } from '@testing-library/react'
|
|
27
|
+
import { vi } from 'vitest'
|
|
28
|
+
import type { MockInstance } from 'vitest'
|
|
27
29
|
import '@testing-library/jest-dom'
|
|
28
30
|
|
|
29
31
|
import { InstUISettingsProvider } from '@instructure/emotion'
|
|
@@ -32,6 +34,24 @@ import { runAxeCheck } from '@instructure/ui-axe-check'
|
|
|
32
34
|
import { RatingIcon } from '../index'
|
|
33
35
|
|
|
34
36
|
describe('<RatingIcon />', () => {
|
|
37
|
+
let consoleWarningMock: ReturnType<typeof vi.spyOn>
|
|
38
|
+
let consoleErrorMock: ReturnType<typeof vi.spyOn>
|
|
39
|
+
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
// Mocking console to prevent test output pollution and expect for messages
|
|
42
|
+
consoleWarningMock = vi
|
|
43
|
+
.spyOn(console, 'warn')
|
|
44
|
+
.mockImplementation(() => {}) as MockInstance
|
|
45
|
+
consoleErrorMock = vi
|
|
46
|
+
.spyOn(console, 'error')
|
|
47
|
+
.mockImplementation(() => {}) as MockInstance
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
afterEach(() => {
|
|
51
|
+
consoleWarningMock.mockRestore()
|
|
52
|
+
consoleErrorMock.mockRestore()
|
|
53
|
+
})
|
|
54
|
+
|
|
35
55
|
it('transitions when filled on render and animateFill is true', async () => {
|
|
36
56
|
const { container } = render(
|
|
37
57
|
<InstUISettingsProvider
|