@instructure/ui-react-utils 9.2.1-snapshot-1 → 9.2.1-snapshot-2

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 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-1](https://github.com/instructure/instructure-ui/compare/v9.2.0...v9.2.1-snapshot-1) (2024-07-10)
6
+ ## [9.2.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v9.2.0...v9.2.1-snapshot-2) (2024-07-10)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-react-utils
9
9
 
@@ -23,6 +23,7 @@
23
23
  */
24
24
 
25
25
  import React, { Component } from 'react';
26
+ import { vi } from 'vitest';
26
27
  import PropTypes from 'prop-types';
27
28
  import { render } from '@testing-library/react';
28
29
  import '@testing-library/jest-dom';
@@ -49,7 +50,7 @@ describe('@deprecated', () => {
49
50
  baz: true
50
51
  })(TestComponent);
51
52
  it('should warn when suggesting new prop when using old prop', () => {
52
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
53
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
53
54
  render(_DeprecatedComponent || (_DeprecatedComponent = /*#__PURE__*/React.createElement(DeprecatedComponent, {
54
55
  foo: "Jane"
55
56
  })));
@@ -58,7 +59,7 @@ describe('@deprecated', () => {
58
59
  consoleWarningSpy.mockRestore();
59
60
  });
60
61
  it('should warn when using old prop with no new prop', () => {
61
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
62
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
62
63
  render(_DeprecatedComponent2 || (_DeprecatedComponent2 = /*#__PURE__*/React.createElement(DeprecatedComponent, {
63
64
  baz: "Goodbye"
64
65
  })));
@@ -67,7 +68,7 @@ describe('@deprecated', () => {
67
68
  consoleWarningSpy.mockRestore();
68
69
  });
69
70
  it('should not output a warning using new prop', () => {
70
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
71
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
71
72
  render(_DeprecatedComponent3 || (_DeprecatedComponent3 = /*#__PURE__*/React.createElement(DeprecatedComponent, {
72
73
  bar: "Jane"
73
74
  })));
@@ -79,7 +80,7 @@ describe('@deprecated', () => {
79
80
  var _DeprecatedComponent4;
80
81
  const DeprecatedComponent = deprecated('3.4.0')(TestComponent);
81
82
  it('should warn that the entire component is deprecated if no old props are supplied', () => {
82
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
83
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
83
84
  render(_DeprecatedComponent4 || (_DeprecatedComponent4 = /*#__PURE__*/React.createElement(DeprecatedComponent, null)));
84
85
  const expectedWarningMessage = 'Warning: [TestComponent] is deprecated and will be removed in version 3.4.0.';
85
86
  expect(consoleWarningSpy).toHaveBeenCalledWith(expect.stringContaining(expectedWarningMessage), expect.any(String));
@@ -90,7 +91,7 @@ describe('@deprecated', () => {
90
91
  var _DeprecatedComponent5;
91
92
  const DeprecatedComponent = deprecated('5.0.0', null, deprecated.changedPackageWarning('ui-forms', 'ui-number-input'))(TestComponent);
92
93
  it('should warn that the component is deprecated and output a warning that the package changed', () => {
93
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
94
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
94
95
  const expectedWarningMessage = 'Warning: [TestComponent] is deprecated and will be removed in version 5.0.0. It has been moved from @instructure/ui-forms to @instructure/ui-number-input.';
95
96
  render(_DeprecatedComponent5 || (_DeprecatedComponent5 = /*#__PURE__*/React.createElement(DeprecatedComponent, null)));
96
97
  expect(consoleWarningSpy).toHaveBeenCalledWith(expect.stringContaining(expectedWarningMessage), expect.any(String));
@@ -99,7 +100,7 @@ describe('@deprecated', () => {
99
100
  });
100
101
  describe('component with deprecated prop values', () => {
101
102
  it('should not warn when an allowed prop value is supplied', () => {
102
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
103
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
103
104
  class DeprecatedPropValueComponent extends Component {
104
105
  render() {
105
106
  return /*#__PURE__*/React.createElement("div", null, this.props.color);
@@ -119,7 +120,7 @@ describe('@deprecated', () => {
119
120
  consoleWarningSpy.mockRestore();
120
121
  });
121
122
  it('should warn when a forbidden prop value is supplied', () => {
122
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
123
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
123
124
  const color = 'orange';
124
125
  class DeprecatedPropValueComponent extends Component {
125
126
  render() {
@@ -141,7 +142,7 @@ describe('@deprecated', () => {
141
142
  consoleWarningSpy.mockRestore();
142
143
  });
143
144
  it('should warn with additional message text when a forbidden prop value is supplied and has message text', () => {
144
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
145
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
145
146
  const color = 'gold';
146
147
  const message = 'It will be removed in v8.0.0.';
147
148
  class DeprecatedPropValueComponent extends Component {
@@ -164,8 +165,8 @@ describe('@deprecated', () => {
164
165
  consoleWarningSpy.mockRestore();
165
166
  });
166
167
  it('should call functional message with the correct props', () => {
167
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
168
- const messageMock = jest.fn();
168
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
169
+ const messageMock = vi.fn();
169
170
  const color = 'gold';
170
171
  class DeprecatedPropValueComponent extends Component {
171
172
  render() {
@@ -195,7 +196,7 @@ describe('@deprecated', () => {
195
196
  consoleWarningSpy.mockRestore();
196
197
  });
197
198
  it('should warn with a completely custom message when provided message is functional and prop value is forbidden', () => {
198
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
199
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
199
200
  const color = 'gold';
200
201
  class DeprecatedPropValueComponent extends Component {
201
202
  render() {
@@ -23,6 +23,7 @@
23
23
  */
24
24
 
25
25
  import React, { Component } from 'react';
26
+ import { vi } from 'vitest';
26
27
  import PropTypes from 'prop-types';
27
28
  import { render } from '@testing-library/react';
28
29
  import '@testing-library/jest-dom';
@@ -46,7 +47,7 @@ describe('@experimental', () => {
46
47
  var _ExperimentalComponen, _ExperimentalComponen2, _ExperimentalComponen3;
47
48
  const ExperimentalComponent = experimental(['bar'])(TestComponent);
48
49
  it('should warn when using an experimental prop', () => {
49
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
50
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
50
51
  render(_ExperimentalComponen || (_ExperimentalComponen = /*#__PURE__*/React.createElement(ExperimentalComponent, {
51
52
  bar: "Jane"
52
53
  })));
@@ -55,7 +56,7 @@ describe('@experimental', () => {
55
56
  consoleWarningSpy.mockRestore();
56
57
  });
57
58
  it('should not output a warning using a non-experimental prop', () => {
58
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
59
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
59
60
  render(_ExperimentalComponen2 || (_ExperimentalComponen2 = /*#__PURE__*/React.createElement(ExperimentalComponent, {
60
61
  qux: "Jane"
61
62
  })));
@@ -63,7 +64,7 @@ describe('@experimental', () => {
63
64
  consoleWarningSpy.mockRestore();
64
65
  });
65
66
  it('should not output a warning for an experimental prop when dangerously ignored', () => {
66
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
67
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
67
68
  render(_ExperimentalComponen3 || (_ExperimentalComponen3 = /*#__PURE__*/React.createElement(ExperimentalComponent, {
68
69
  qux: "Jane",
69
70
  __dangerouslyIgnoreExperimentalWarnings: true
@@ -76,14 +77,14 @@ describe('@experimental', () => {
76
77
  var _ExperimentalComponen4, _ExperimentalComponen5;
77
78
  const ExperimentalComponent = experimental()(TestComponent);
78
79
  it('should warn that the entire component is experimental if no props are supplied', () => {
79
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
80
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
80
81
  render(_ExperimentalComponen4 || (_ExperimentalComponen4 = /*#__PURE__*/React.createElement(ExperimentalComponent, null)));
81
82
  const expectedWarningMessage = 'Warning: [TestComponent] is experimental and its API could change significantly in a future release.';
82
83
  expect(consoleWarningSpy).toHaveBeenCalledWith(expect.stringContaining(expectedWarningMessage), expect.any(String));
83
84
  consoleWarningSpy.mockRestore();
84
85
  });
85
86
  it('should not output a warning for a component when dangerously ignored', () => {
86
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
87
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
87
88
  render(_ExperimentalComponen5 || (_ExperimentalComponen5 = /*#__PURE__*/React.createElement(ExperimentalComponent, {
88
89
  __dangerouslyIgnoreExperimentalWarnings: true
89
90
  })));
@@ -23,6 +23,7 @@
23
23
  */
24
24
 
25
25
  import React, { Component } from 'react';
26
+ import { vi } from 'vitest';
26
27
  import PropTypes from 'prop-types';
27
28
  import { render } from '@testing-library/react';
28
29
  import '@testing-library/jest-dom';
@@ -46,7 +47,7 @@ describe('@hack', () => {
46
47
  var _HackComponent, _HackComponent2;
47
48
  const HackComponent = hack(['bar'])(TestComponent);
48
49
  it('should warn when using an hack prop', () => {
49
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
50
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
50
51
  render(_HackComponent || (_HackComponent = /*#__PURE__*/React.createElement(HackComponent, {
51
52
  bar: "Jane"
52
53
  })));
@@ -55,7 +56,7 @@ describe('@hack', () => {
55
56
  consoleWarningSpy.mockRestore();
56
57
  });
57
58
  it('should not output a warning using a non-hack prop', () => {
58
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
59
+ const consoleWarningSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
59
60
  render(_HackComponent2 || (_HackComponent2 = /*#__PURE__*/React.createElement(HackComponent, {
60
61
  qux: "Jane"
61
62
  })));
@@ -23,6 +23,7 @@
23
23
  */
24
24
 
25
25
  import React from 'react';
26
+ import { vi } from 'vitest';
26
27
  import { createChainedFunction } from '@instructure/ui-utils';
27
28
  import { render, screen } from '@testing-library/react';
28
29
  import '@testing-library/jest-dom';
@@ -36,8 +37,8 @@ describe('safeCloneElement', () => {
36
37
  return safeCloneElement(element, props, children);
37
38
  };
38
39
  it('should preserve refs', () => {
39
- const origRef = jest.fn();
40
- const cloneRef = jest.fn();
40
+ const origRef = vi.fn();
41
+ const cloneRef = vi.fn();
41
42
  render( /*#__PURE__*/React.createElement(SafeClone, {
42
43
  element: /*#__PURE__*/React.createElement("div", {
43
44
  ref: origRef
@@ -50,8 +51,8 @@ describe('safeCloneElement', () => {
50
51
  expect(cloneRef).toHaveBeenCalled();
51
52
  });
52
53
  it('should preserve event handlers', () => {
53
- const onClickA = jest.fn();
54
- const onClickB = jest.fn();
54
+ const onClickA = vi.fn();
55
+ const onClickB = vi.fn();
55
56
  render( /*#__PURE__*/React.createElement(SafeClone, {
56
57
  element: /*#__PURE__*/React.createElement("button", {
57
58
  onClick: onClickA
@@ -66,9 +67,9 @@ describe('safeCloneElement', () => {
66
67
  expect(onClickB).toHaveBeenCalled();
67
68
  });
68
69
  it('should preserve already chained functions', () => {
69
- const onClickA = jest.fn();
70
- const onClickB = jest.fn();
71
- const onClickC = jest.fn();
70
+ const onClickA = vi.fn();
71
+ const onClickB = vi.fn();
72
+ const onClickC = vi.fn();
72
73
  render( /*#__PURE__*/React.createElement(SafeClone, {
73
74
  element: /*#__PURE__*/React.createElement("button", {
74
75
  onClick: onClickA
@@ -3,6 +3,7 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
5
  var _react = _interopRequireWildcard(require("react"));
6
+ var _vitest = require("vitest");
6
7
  var _propTypes = _interopRequireDefault(require("prop-types"));
7
8
  var _react2 = require("@testing-library/react");
8
9
  require("@testing-library/jest-dom");
@@ -53,7 +54,7 @@ describe('@deprecated', () => {
53
54
  baz: true
54
55
  })(TestComponent);
55
56
  it('should warn when suggesting new prop when using old prop', () => {
56
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
57
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
57
58
  (0, _react2.render)(_DeprecatedComponent || (_DeprecatedComponent = /*#__PURE__*/_react.default.createElement(DeprecatedComponent, {
58
59
  foo: "Jane"
59
60
  })));
@@ -62,7 +63,7 @@ describe('@deprecated', () => {
62
63
  consoleWarningSpy.mockRestore();
63
64
  });
64
65
  it('should warn when using old prop with no new prop', () => {
65
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
66
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
66
67
  (0, _react2.render)(_DeprecatedComponent2 || (_DeprecatedComponent2 = /*#__PURE__*/_react.default.createElement(DeprecatedComponent, {
67
68
  baz: "Goodbye"
68
69
  })));
@@ -71,7 +72,7 @@ describe('@deprecated', () => {
71
72
  consoleWarningSpy.mockRestore();
72
73
  });
73
74
  it('should not output a warning using new prop', () => {
74
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
75
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
75
76
  (0, _react2.render)(_DeprecatedComponent3 || (_DeprecatedComponent3 = /*#__PURE__*/_react.default.createElement(DeprecatedComponent, {
76
77
  bar: "Jane"
77
78
  })));
@@ -83,7 +84,7 @@ describe('@deprecated', () => {
83
84
  var _DeprecatedComponent4;
84
85
  const DeprecatedComponent = (0, _deprecated.deprecated)('3.4.0')(TestComponent);
85
86
  it('should warn that the entire component is deprecated if no old props are supplied', () => {
86
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
87
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
87
88
  (0, _react2.render)(_DeprecatedComponent4 || (_DeprecatedComponent4 = /*#__PURE__*/_react.default.createElement(DeprecatedComponent, null)));
88
89
  const expectedWarningMessage = 'Warning: [TestComponent] is deprecated and will be removed in version 3.4.0.';
89
90
  expect(consoleWarningSpy).toHaveBeenCalledWith(expect.stringContaining(expectedWarningMessage), expect.any(String));
@@ -94,7 +95,7 @@ describe('@deprecated', () => {
94
95
  var _DeprecatedComponent5;
95
96
  const DeprecatedComponent = (0, _deprecated.deprecated)('5.0.0', null, _deprecated.deprecated.changedPackageWarning('ui-forms', 'ui-number-input'))(TestComponent);
96
97
  it('should warn that the component is deprecated and output a warning that the package changed', () => {
97
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
98
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
98
99
  const expectedWarningMessage = 'Warning: [TestComponent] is deprecated and will be removed in version 5.0.0. It has been moved from @instructure/ui-forms to @instructure/ui-number-input.';
99
100
  (0, _react2.render)(_DeprecatedComponent5 || (_DeprecatedComponent5 = /*#__PURE__*/_react.default.createElement(DeprecatedComponent, null)));
100
101
  expect(consoleWarningSpy).toHaveBeenCalledWith(expect.stringContaining(expectedWarningMessage), expect.any(String));
@@ -103,7 +104,7 @@ describe('@deprecated', () => {
103
104
  });
104
105
  describe('component with deprecated prop values', () => {
105
106
  it('should not warn when an allowed prop value is supplied', () => {
106
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
107
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
107
108
  class DeprecatedPropValueComponent extends _react.Component {
108
109
  render() {
109
110
  return /*#__PURE__*/_react.default.createElement("div", null, this.props.color);
@@ -123,7 +124,7 @@ describe('@deprecated', () => {
123
124
  consoleWarningSpy.mockRestore();
124
125
  });
125
126
  it('should warn when a forbidden prop value is supplied', () => {
126
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
127
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
127
128
  const color = 'orange';
128
129
  class DeprecatedPropValueComponent extends _react.Component {
129
130
  render() {
@@ -145,7 +146,7 @@ describe('@deprecated', () => {
145
146
  consoleWarningSpy.mockRestore();
146
147
  });
147
148
  it('should warn with additional message text when a forbidden prop value is supplied and has message text', () => {
148
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
149
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
149
150
  const color = 'gold';
150
151
  const message = 'It will be removed in v8.0.0.';
151
152
  class DeprecatedPropValueComponent extends _react.Component {
@@ -168,8 +169,8 @@ describe('@deprecated', () => {
168
169
  consoleWarningSpy.mockRestore();
169
170
  });
170
171
  it('should call functional message with the correct props', () => {
171
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
172
- const messageMock = jest.fn();
172
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
173
+ const messageMock = _vitest.vi.fn();
173
174
  const color = 'gold';
174
175
  class DeprecatedPropValueComponent extends _react.Component {
175
176
  render() {
@@ -199,7 +200,7 @@ describe('@deprecated', () => {
199
200
  consoleWarningSpy.mockRestore();
200
201
  });
201
202
  it('should warn with a completely custom message when provided message is functional and prop value is forbidden', () => {
202
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
203
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
203
204
  const color = 'gold';
204
205
  class DeprecatedPropValueComponent extends _react.Component {
205
206
  render() {
@@ -3,6 +3,7 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
5
  var _react = _interopRequireWildcard(require("react"));
6
+ var _vitest = require("vitest");
6
7
  var _propTypes = _interopRequireDefault(require("prop-types"));
7
8
  var _react2 = require("@testing-library/react");
8
9
  require("@testing-library/jest-dom");
@@ -50,7 +51,7 @@ describe('@experimental', () => {
50
51
  var _ExperimentalComponen, _ExperimentalComponen2, _ExperimentalComponen3;
51
52
  const ExperimentalComponent = (0, _experimental.experimental)(['bar'])(TestComponent);
52
53
  it('should warn when using an experimental prop', () => {
53
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
54
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
54
55
  (0, _react2.render)(_ExperimentalComponen || (_ExperimentalComponen = /*#__PURE__*/_react.default.createElement(ExperimentalComponent, {
55
56
  bar: "Jane"
56
57
  })));
@@ -59,7 +60,7 @@ describe('@experimental', () => {
59
60
  consoleWarningSpy.mockRestore();
60
61
  });
61
62
  it('should not output a warning using a non-experimental prop', () => {
62
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
63
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
63
64
  (0, _react2.render)(_ExperimentalComponen2 || (_ExperimentalComponen2 = /*#__PURE__*/_react.default.createElement(ExperimentalComponent, {
64
65
  qux: "Jane"
65
66
  })));
@@ -67,7 +68,7 @@ describe('@experimental', () => {
67
68
  consoleWarningSpy.mockRestore();
68
69
  });
69
70
  it('should not output a warning for an experimental prop when dangerously ignored', () => {
70
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
71
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
71
72
  (0, _react2.render)(_ExperimentalComponen3 || (_ExperimentalComponen3 = /*#__PURE__*/_react.default.createElement(ExperimentalComponent, {
72
73
  qux: "Jane",
73
74
  __dangerouslyIgnoreExperimentalWarnings: true
@@ -80,14 +81,14 @@ describe('@experimental', () => {
80
81
  var _ExperimentalComponen4, _ExperimentalComponen5;
81
82
  const ExperimentalComponent = (0, _experimental.experimental)()(TestComponent);
82
83
  it('should warn that the entire component is experimental if no props are supplied', () => {
83
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
84
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
84
85
  (0, _react2.render)(_ExperimentalComponen4 || (_ExperimentalComponen4 = /*#__PURE__*/_react.default.createElement(ExperimentalComponent, null)));
85
86
  const expectedWarningMessage = 'Warning: [TestComponent] is experimental and its API could change significantly in a future release.';
86
87
  expect(consoleWarningSpy).toHaveBeenCalledWith(expect.stringContaining(expectedWarningMessage), expect.any(String));
87
88
  consoleWarningSpy.mockRestore();
88
89
  });
89
90
  it('should not output a warning for a component when dangerously ignored', () => {
90
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
91
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
91
92
  (0, _react2.render)(_ExperimentalComponen5 || (_ExperimentalComponen5 = /*#__PURE__*/_react.default.createElement(ExperimentalComponent, {
92
93
  __dangerouslyIgnoreExperimentalWarnings: true
93
94
  })));
@@ -3,6 +3,7 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
5
  var _react = _interopRequireWildcard(require("react"));
6
+ var _vitest = require("vitest");
6
7
  var _propTypes = _interopRequireDefault(require("prop-types"));
7
8
  var _react2 = require("@testing-library/react");
8
9
  require("@testing-library/jest-dom");
@@ -50,7 +51,7 @@ describe('@hack', () => {
50
51
  var _HackComponent, _HackComponent2;
51
52
  const HackComponent = (0, _hack.hack)(['bar'])(TestComponent);
52
53
  it('should warn when using an hack prop', () => {
53
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
54
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
54
55
  (0, _react2.render)(_HackComponent || (_HackComponent = /*#__PURE__*/_react.default.createElement(HackComponent, {
55
56
  bar: "Jane"
56
57
  })));
@@ -59,7 +60,7 @@ describe('@hack', () => {
59
60
  consoleWarningSpy.mockRestore();
60
61
  });
61
62
  it('should not output a warning using a non-hack prop', () => {
62
- const consoleWarningSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
63
+ const consoleWarningSpy = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
63
64
  (0, _react2.render)(_HackComponent2 || (_HackComponent2 = /*#__PURE__*/_react.default.createElement(HackComponent, {
64
65
  qux: "Jane"
65
66
  })));
@@ -2,6 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  var _react = _interopRequireDefault(require("react"));
5
+ var _vitest = require("vitest");
5
6
  var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
6
7
  var _react2 = require("@testing-library/react");
7
8
  require("@testing-library/jest-dom");
@@ -39,8 +40,8 @@ describe('safeCloneElement', () => {
39
40
  return (0, _safeCloneElement.safeCloneElement)(element, props, children);
40
41
  };
41
42
  it('should preserve refs', () => {
42
- const origRef = jest.fn();
43
- const cloneRef = jest.fn();
43
+ const origRef = _vitest.vi.fn();
44
+ const cloneRef = _vitest.vi.fn();
44
45
  (0, _react2.render)( /*#__PURE__*/_react.default.createElement(SafeClone, {
45
46
  element: /*#__PURE__*/_react.default.createElement("div", {
46
47
  ref: origRef
@@ -53,8 +54,8 @@ describe('safeCloneElement', () => {
53
54
  expect(cloneRef).toHaveBeenCalled();
54
55
  });
55
56
  it('should preserve event handlers', () => {
56
- const onClickA = jest.fn();
57
- const onClickB = jest.fn();
57
+ const onClickA = _vitest.vi.fn();
58
+ const onClickB = _vitest.vi.fn();
58
59
  (0, _react2.render)( /*#__PURE__*/_react.default.createElement(SafeClone, {
59
60
  element: /*#__PURE__*/_react.default.createElement("button", {
60
61
  onClick: onClickA
@@ -69,9 +70,9 @@ describe('safeCloneElement', () => {
69
70
  expect(onClickB).toHaveBeenCalled();
70
71
  });
71
72
  it('should preserve already chained functions', () => {
72
- const onClickA = jest.fn();
73
- const onClickB = jest.fn();
74
- const onClickC = jest.fn();
73
+ const onClickA = _vitest.vi.fn();
74
+ const onClickB = _vitest.vi.fn();
75
+ const onClickC = _vitest.vi.fn();
75
76
  (0, _react2.render)( /*#__PURE__*/_react.default.createElement(SafeClone, {
76
77
  element: /*#__PURE__*/_react.default.createElement("button", {
77
78
  onClick: onClickA
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-react-utils",
3
- "version": "9.2.1-snapshot-1",
3
+ "version": "9.2.1-snapshot-2",
4
4
  "description": "A React utility library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -22,18 +22,19 @@
22
22
  },
23
23
  "license": "MIT",
24
24
  "devDependencies": {
25
- "@instructure/ui-babel-preset": "9.2.1-snapshot-1",
25
+ "@instructure/ui-babel-preset": "9.2.1-snapshot-2",
26
26
  "@testing-library/jest-dom": "^6.4.5",
27
- "@testing-library/react": "^15.0.7"
27
+ "@testing-library/react": "^15.0.7",
28
+ "vitest": "^1.6.0"
28
29
  },
29
30
  "dependencies": {
30
31
  "@babel/runtime": "^7.24.5",
31
32
  "@emotion/is-prop-valid": "^1.2.2",
32
- "@instructure/console": "9.2.1-snapshot-1",
33
- "@instructure/shared-types": "9.2.1-snapshot-1",
34
- "@instructure/ui-decorator": "9.2.1-snapshot-1",
35
- "@instructure/ui-dom-utils": "9.2.1-snapshot-1",
36
- "@instructure/ui-utils": "9.2.1-snapshot-1",
33
+ "@instructure/console": "9.2.1-snapshot-2",
34
+ "@instructure/shared-types": "9.2.1-snapshot-2",
35
+ "@instructure/ui-decorator": "9.2.1-snapshot-2",
36
+ "@instructure/ui-dom-utils": "9.2.1-snapshot-2",
37
+ "@instructure/ui-utils": "9.2.1-snapshot-2",
37
38
  "hoist-non-react-statics": "^3.3.2",
38
39
  "prop-types": "^15.8.1"
39
40
  },
@@ -23,6 +23,7 @@
23
23
  */
24
24
 
25
25
  import React, { Component } from 'react'
26
+ import { vi } from 'vitest'
26
27
  import PropTypes from 'prop-types'
27
28
 
28
29
  import { render } from '@testing-library/react'
@@ -62,7 +63,7 @@ describe('@deprecated', () => {
62
63
  })(TestComponent)
63
64
 
64
65
  it('should warn when suggesting new prop when using old prop', () => {
65
- const consoleWarningSpy = jest
66
+ const consoleWarningSpy = vi
66
67
  .spyOn(console, 'warn')
67
68
  .mockImplementation(() => {})
68
69
 
@@ -80,7 +81,7 @@ describe('@deprecated', () => {
80
81
  })
81
82
 
82
83
  it('should warn when using old prop with no new prop', () => {
83
- const consoleWarningSpy = jest
84
+ const consoleWarningSpy = vi
84
85
  .spyOn(console, 'warn')
85
86
  .mockImplementation(() => {})
86
87
 
@@ -98,7 +99,7 @@ describe('@deprecated', () => {
98
99
  })
99
100
 
100
101
  it('should not output a warning using new prop', () => {
101
- const consoleWarningSpy = jest
102
+ const consoleWarningSpy = vi
102
103
  .spyOn(console, 'warn')
103
104
  .mockImplementation(() => {})
104
105
 
@@ -114,7 +115,7 @@ describe('@deprecated', () => {
114
115
  const DeprecatedComponent = deprecated('3.4.0')(TestComponent)
115
116
 
116
117
  it('should warn that the entire component is deprecated if no old props are supplied', () => {
117
- const consoleWarningSpy = jest
118
+ const consoleWarningSpy = vi
118
119
  .spyOn(console, 'warn')
119
120
  .mockImplementation(() => {})
120
121
 
@@ -140,7 +141,7 @@ describe('@deprecated', () => {
140
141
  )(TestComponent)
141
142
 
142
143
  it('should warn that the component is deprecated and output a warning that the package changed', () => {
143
- const consoleWarningSpy = jest
144
+ const consoleWarningSpy = vi
144
145
  .spyOn(console, 'warn')
145
146
  .mockImplementation(() => {})
146
147
 
@@ -160,7 +161,7 @@ describe('@deprecated', () => {
160
161
 
161
162
  describe('component with deprecated prop values', () => {
162
163
  it('should not warn when an allowed prop value is supplied', () => {
163
- const consoleWarningSpy = jest
164
+ const consoleWarningSpy = vi
164
165
  .spyOn(console, 'warn')
165
166
  .mockImplementation(() => {})
166
167
  type DeprecatedPropValueComponentProps = {
@@ -191,7 +192,7 @@ describe('@deprecated', () => {
191
192
  })
192
193
 
193
194
  it('should warn when a forbidden prop value is supplied', () => {
194
- const consoleWarningSpy = jest
195
+ const consoleWarningSpy = vi
195
196
  .spyOn(console, 'warn')
196
197
  .mockImplementation(() => {})
197
198
 
@@ -229,7 +230,7 @@ describe('@deprecated', () => {
229
230
  })
230
231
 
231
232
  it('should warn with additional message text when a forbidden prop value is supplied and has message text', () => {
232
- const consoleWarningSpy = jest
233
+ const consoleWarningSpy = vi
233
234
  .spyOn(console, 'warn')
234
235
  .mockImplementation(() => {})
235
236
 
@@ -269,10 +270,10 @@ describe('@deprecated', () => {
269
270
  })
270
271
 
271
272
  it('should call functional message with the correct props', () => {
272
- const consoleWarningSpy = jest
273
+ const consoleWarningSpy = vi
273
274
  .spyOn(console, 'warn')
274
275
  .mockImplementation(() => {})
275
- const messageMock = jest.fn()
276
+ const messageMock = vi.fn()
276
277
 
277
278
  const color = 'gold'
278
279
  type DeprecatedPropValueComponentProps = {
@@ -309,7 +310,7 @@ describe('@deprecated', () => {
309
310
  })
310
311
 
311
312
  it('should warn with a completely custom message when provided message is functional and prop value is forbidden', () => {
312
- const consoleWarningSpy = jest
313
+ const consoleWarningSpy = vi
313
314
  .spyOn(console, 'warn')
314
315
  .mockImplementation(() => {})
315
316
 
@@ -23,6 +23,7 @@
23
23
  */
24
24
 
25
25
  import React, { Component } from 'react'
26
+ import { vi } from 'vitest'
26
27
  import PropTypes from 'prop-types'
27
28
 
28
29
  import { render } from '@testing-library/react'
@@ -59,7 +60,7 @@ describe('@experimental', () => {
59
60
  const ExperimentalComponent = experimental(['bar'])(TestComponent)
60
61
 
61
62
  it('should warn when using an experimental prop', () => {
62
- const consoleWarningSpy = jest
63
+ const consoleWarningSpy = vi
63
64
  .spyOn(console, 'warn')
64
65
  .mockImplementation(() => {})
65
66
  render(<ExperimentalComponent bar="Jane" />)
@@ -76,7 +77,7 @@ describe('@experimental', () => {
76
77
  })
77
78
 
78
79
  it('should not output a warning using a non-experimental prop', () => {
79
- const consoleWarningSpy = jest
80
+ const consoleWarningSpy = vi
80
81
  .spyOn(console, 'warn')
81
82
  .mockImplementation(() => {})
82
83
  render(<ExperimentalComponent qux="Jane" />)
@@ -87,7 +88,7 @@ describe('@experimental', () => {
87
88
  })
88
89
 
89
90
  it('should not output a warning for an experimental prop when dangerously ignored', () => {
90
- const consoleWarningSpy = jest
91
+ const consoleWarningSpy = vi
91
92
  .spyOn(console, 'warn')
92
93
  .mockImplementation(() => {})
93
94
 
@@ -108,7 +109,7 @@ describe('@experimental', () => {
108
109
  const ExperimentalComponent = experimental()(TestComponent)
109
110
 
110
111
  it('should warn that the entire component is experimental if no props are supplied', () => {
111
- const consoleWarningSpy = jest
112
+ const consoleWarningSpy = vi
112
113
  .spyOn(console, 'warn')
113
114
  .mockImplementation(() => {})
114
115
  render(<ExperimentalComponent />)
@@ -125,7 +126,7 @@ describe('@experimental', () => {
125
126
  })
126
127
 
127
128
  it('should not output a warning for a component when dangerously ignored', () => {
128
- const consoleWarningSpy = jest
129
+ const consoleWarningSpy = vi
129
130
  .spyOn(console, 'warn')
130
131
  .mockImplementation(() => {})
131
132
  render(<ExperimentalComponent __dangerouslyIgnoreExperimentalWarnings />)