@instructure/ui-form-field 9.2.1-snapshot-0 → 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.
Files changed (24) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +2 -2
  3. package/es/FormField/__new-tests__/FormField.test.js +12 -0
  4. package/es/FormFieldGroup/__new-tests__/FormFieldGroup.test.js +12 -0
  5. package/es/FormFieldLabel/__new-tests__/FormFieldLabel.test.js +12 -0
  6. package/es/FormFieldLayout/__new-tests__/FormFieldLayout.test.js +13 -1
  7. package/es/FormFieldMessages/__new-tests__/FormFieldMessages.test.js +12 -0
  8. package/lib/FormField/__new-tests__/FormField.test.js +12 -0
  9. package/lib/FormFieldGroup/__new-tests__/FormFieldGroup.test.js +12 -0
  10. package/lib/FormFieldLabel/__new-tests__/FormFieldLabel.test.js +12 -0
  11. package/lib/FormFieldLayout/__new-tests__/FormFieldLayout.test.js +13 -1
  12. package/lib/FormFieldMessages/__new-tests__/FormFieldMessages.test.js +12 -0
  13. package/package.json +17 -16
  14. package/src/FormField/__new-tests__/FormField.test.tsx +19 -0
  15. package/src/FormFieldGroup/__new-tests__/FormFieldGroup.test.tsx +19 -0
  16. package/src/FormFieldLabel/__new-tests__/FormFieldLabel.test.tsx +19 -0
  17. package/src/FormFieldLayout/__new-tests__/FormFieldLayout.test.tsx +20 -1
  18. package/src/FormFieldMessages/__new-tests__/FormFieldMessages.test.tsx +19 -0
  19. package/tsconfig.build.tsbuildinfo +1 -1
  20. package/types/FormField/__new-tests__/FormField.test.d.ts.map +1 -1
  21. package/types/FormFieldGroup/__new-tests__/FormFieldGroup.test.d.ts.map +1 -1
  22. package/types/FormFieldLabel/__new-tests__/FormFieldLabel.test.d.ts.map +1 -1
  23. package/types/FormFieldLayout/__new-tests__/FormFieldLayout.test.d.ts.map +1 -1
  24. package/types/FormFieldMessages/__new-tests__/FormFieldMessages.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-0](https://github.com/instructure/instructure-ui/compare/v9.2.0...v9.2.1-snapshot-0) (2024-07-09)
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-form-field
9
9
 
package/README.md CHANGED
@@ -4,8 +4,8 @@ category: packages
4
4
 
5
5
  ## ui-form-field
6
6
 
7
- [![npm][npm]][npm-url] 
8
- [![MIT License][license-badge]][license] 
7
+ [![npm][npm]][npm-url]
8
+ [![MIT License][license-badge]][license]
9
9
  [![Code of Conduct][coc-badge]][coc]
10
10
 
11
11
  Form layout components.
@@ -25,10 +25,22 @@ var _FormField, _FormField2, _FormField3;
25
25
 
26
26
  import React from 'react';
27
27
  import { render, screen } from '@testing-library/react';
28
+ import { vi } from 'vitest';
28
29
  import { runAxeCheck } from '@instructure/ui-axe-check';
29
30
  import '@testing-library/jest-dom';
30
31
  import { FormField } from '../index';
31
32
  describe('<FormField />', () => {
33
+ let consoleWarningMock;
34
+ let consoleErrorMock;
35
+ beforeEach(() => {
36
+ // Mocking console to prevent test output pollution and expect for messages
37
+ consoleWarningMock = vi.spyOn(console, 'warn').mockImplementation(() => {});
38
+ consoleErrorMock = vi.spyOn(console, 'error').mockImplementation(() => {});
39
+ });
40
+ afterEach(() => {
41
+ consoleWarningMock.mockRestore();
42
+ consoleErrorMock.mockRestore();
43
+ });
32
44
  it('should render', () => {
33
45
  render(_FormField || (_FormField = /*#__PURE__*/React.createElement(FormField, {
34
46
  label: "foo",
@@ -25,10 +25,22 @@ var _FormFieldGroup, _label, _label2, _label3, _label4, _label5, _label6, _label
25
25
 
26
26
  import React from 'react';
27
27
  import { render, screen } from '@testing-library/react';
28
+ import { vi } from 'vitest';
28
29
  import { runAxeCheck } from '@instructure/ui-axe-check';
29
30
  import '@testing-library/jest-dom';
30
31
  import { FormFieldGroup } from '../index';
31
32
  describe('<FormFieldGroup />', () => {
33
+ let consoleWarningMock;
34
+ let consoleErrorMock;
35
+ beforeEach(() => {
36
+ // Mocking console to prevent test output pollution and expect for messages
37
+ consoleWarningMock = vi.spyOn(console, 'warn').mockImplementation(() => {});
38
+ consoleErrorMock = vi.spyOn(console, 'error').mockImplementation(() => {});
39
+ });
40
+ afterEach(() => {
41
+ consoleWarningMock.mockRestore();
42
+ consoleErrorMock.mockRestore();
43
+ });
32
44
  it('should render', () => {
33
45
  const _render = render(_FormFieldGroup || (_FormFieldGroup = /*#__PURE__*/React.createElement(FormFieldGroup, {
34
46
  description: "Please enter your full name"
@@ -25,10 +25,22 @@ var _FormFieldLabel, _FormFieldLabel2, _FormFieldLabel3;
25
25
 
26
26
  import React from 'react';
27
27
  import { render } from '@testing-library/react';
28
+ import { vi } from 'vitest';
28
29
  import { runAxeCheck } from '@instructure/ui-axe-check';
29
30
  import '@testing-library/jest-dom';
30
31
  import { FormFieldLabel } from '../index';
31
32
  describe('<FormFieldLabel />', () => {
33
+ let consoleWarningMock;
34
+ let consoleErrorMock;
35
+ beforeEach(() => {
36
+ // Mocking console to prevent test output pollution and expect for messages
37
+ consoleWarningMock = vi.spyOn(console, 'warn').mockImplementation(() => {});
38
+ consoleErrorMock = vi.spyOn(console, 'error').mockImplementation(() => {});
39
+ });
40
+ afterEach(() => {
41
+ consoleWarningMock.mockRestore();
42
+ consoleErrorMock.mockRestore();
43
+ });
32
44
  it('should render', () => {
33
45
  const _render = render(_FormFieldLabel || (_FormFieldLabel = /*#__PURE__*/React.createElement(FormFieldLabel, null, "Foo"))),
34
46
  container = _render.container;
@@ -25,10 +25,22 @@ var _FormFieldLayout, _FormFieldLayout2, _input;
25
25
 
26
26
  import React from 'react';
27
27
  import { render, screen } from '@testing-library/react';
28
+ import { vi } from 'vitest';
28
29
  import { runAxeCheck } from '@instructure/ui-axe-check';
29
30
  import '@testing-library/jest-dom';
30
31
  import { FormFieldLayout } from '../index';
31
32
  describe('<FormFieldLayout />', () => {
33
+ let consoleWarningMock;
34
+ let consoleErrorMock;
35
+ beforeEach(() => {
36
+ // Mocking console to prevent test output pollution and expect for messages
37
+ consoleWarningMock = vi.spyOn(console, 'warn').mockImplementation(() => {});
38
+ consoleErrorMock = vi.spyOn(console, 'error').mockImplementation(() => {});
39
+ });
40
+ afterEach(() => {
41
+ consoleWarningMock.mockRestore();
42
+ consoleErrorMock.mockRestore();
43
+ });
32
44
  it('should render', () => {
33
45
  const _render = render(_FormFieldLayout || (_FormFieldLayout = /*#__PURE__*/React.createElement(FormFieldLayout, {
34
46
  label: "Username"
@@ -49,7 +61,7 @@ describe('<FormFieldLayout />', () => {
49
61
  expect(axeCheck).toBe(true);
50
62
  });
51
63
  it('should provide a ref to the input container', () => {
52
- const inputContainerRef = jest.fn();
64
+ const inputContainerRef = vi.fn();
53
65
  render( /*#__PURE__*/React.createElement(FormFieldLayout, {
54
66
  label: "Username",
55
67
  inputContainerRef: inputContainerRef
@@ -25,11 +25,23 @@ var _span;
25
25
 
26
26
  import React from 'react';
27
27
  import { render } from '@testing-library/react';
28
+ import { vi } from 'vitest';
28
29
  import { runAxeCheck } from '@instructure/ui-axe-check';
29
30
  import { IconWarningLine } from '@instructure/ui-icons';
30
31
  import '@testing-library/jest-dom';
31
32
  import { FormFieldMessages } from '../index';
32
33
  describe('<FormFieldMessages />', () => {
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('should render', () => {
34
46
  const messages = [{
35
47
  text: 'Invalid name',
@@ -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
  var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
7
8
  require("@testing-library/jest-dom");
8
9
  var _index = require("../index");
@@ -31,6 +32,17 @@ var _FormField, _FormField2, _FormField3;
31
32
  * SOFTWARE.
32
33
  */
33
34
  describe('<FormField />', () => {
35
+ let consoleWarningMock;
36
+ let consoleErrorMock;
37
+ beforeEach(() => {
38
+ // Mocking console to prevent test output pollution and expect for messages
39
+ consoleWarningMock = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
40
+ consoleErrorMock = _vitest.vi.spyOn(console, 'error').mockImplementation(() => {});
41
+ });
42
+ afterEach(() => {
43
+ consoleWarningMock.mockRestore();
44
+ consoleErrorMock.mockRestore();
45
+ });
34
46
  it('should render', () => {
35
47
  (0, _react2.render)(_FormField || (_FormField = /*#__PURE__*/_react.default.createElement(_index.FormField, {
36
48
  label: "foo",
@@ -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
  var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
7
8
  require("@testing-library/jest-dom");
8
9
  var _index = require("../index");
@@ -31,6 +32,17 @@ var _FormFieldGroup, _label, _label2, _label3, _label4, _label5, _label6, _label
31
32
  * SOFTWARE.
32
33
  */
33
34
  describe('<FormFieldGroup />', () => {
35
+ let consoleWarningMock;
36
+ let consoleErrorMock;
37
+ beforeEach(() => {
38
+ // Mocking console to prevent test output pollution and expect for messages
39
+ consoleWarningMock = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
40
+ consoleErrorMock = _vitest.vi.spyOn(console, 'error').mockImplementation(() => {});
41
+ });
42
+ afterEach(() => {
43
+ consoleWarningMock.mockRestore();
44
+ consoleErrorMock.mockRestore();
45
+ });
34
46
  it('should render', () => {
35
47
  const _render = (0, _react2.render)(_FormFieldGroup || (_FormFieldGroup = /*#__PURE__*/_react.default.createElement(_index.FormFieldGroup, {
36
48
  description: "Please enter your full name"
@@ -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
  var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
7
8
  require("@testing-library/jest-dom");
8
9
  var _index = require("../index");
@@ -31,6 +32,17 @@ var _FormFieldLabel, _FormFieldLabel2, _FormFieldLabel3;
31
32
  * SOFTWARE.
32
33
  */
33
34
  describe('<FormFieldLabel />', () => {
35
+ let consoleWarningMock;
36
+ let consoleErrorMock;
37
+ beforeEach(() => {
38
+ // Mocking console to prevent test output pollution and expect for messages
39
+ consoleWarningMock = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
40
+ consoleErrorMock = _vitest.vi.spyOn(console, 'error').mockImplementation(() => {});
41
+ });
42
+ afterEach(() => {
43
+ consoleWarningMock.mockRestore();
44
+ consoleErrorMock.mockRestore();
45
+ });
34
46
  it('should render', () => {
35
47
  const _render = (0, _react2.render)(_FormFieldLabel || (_FormFieldLabel = /*#__PURE__*/_react.default.createElement(_index.FormFieldLabel, null, "Foo"))),
36
48
  container = _render.container;
@@ -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
  var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
7
8
  require("@testing-library/jest-dom");
8
9
  var _index = require("../index");
@@ -31,6 +32,17 @@ var _FormFieldLayout, _FormFieldLayout2, _input;
31
32
  * SOFTWARE.
32
33
  */
33
34
  describe('<FormFieldLayout />', () => {
35
+ let consoleWarningMock;
36
+ let consoleErrorMock;
37
+ beforeEach(() => {
38
+ // Mocking console to prevent test output pollution and expect for messages
39
+ consoleWarningMock = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
40
+ consoleErrorMock = _vitest.vi.spyOn(console, 'error').mockImplementation(() => {});
41
+ });
42
+ afterEach(() => {
43
+ consoleWarningMock.mockRestore();
44
+ consoleErrorMock.mockRestore();
45
+ });
34
46
  it('should render', () => {
35
47
  const _render = (0, _react2.render)(_FormFieldLayout || (_FormFieldLayout = /*#__PURE__*/_react.default.createElement(_index.FormFieldLayout, {
36
48
  label: "Username"
@@ -51,7 +63,7 @@ describe('<FormFieldLayout />', () => {
51
63
  expect(axeCheck).toBe(true);
52
64
  });
53
65
  it('should provide a ref to the input container', () => {
54
- const inputContainerRef = jest.fn();
66
+ const inputContainerRef = _vitest.vi.fn();
55
67
  (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.FormFieldLayout, {
56
68
  label: "Username",
57
69
  inputContainerRef: inputContainerRef
@@ -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
  var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
7
8
  var _IconWarningLine = require("@instructure/ui-icons/lib/IconWarningLine.js");
8
9
  require("@testing-library/jest-dom");
@@ -32,6 +33,17 @@ var _span;
32
33
  * SOFTWARE.
33
34
  */
34
35
  describe('<FormFieldMessages />', () => {
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('should render', () => {
36
48
  const messages = [{
37
49
  text: 'Invalid name',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-form-field",
3
- "version": "9.2.1-snapshot-0",
3
+ "version": "9.2.1-snapshot-2",
4
4
  "description": "Form layout components.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,25 +23,26 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-axe-check": "9.2.1-snapshot-0",
27
- "@instructure/ui-babel-preset": "9.2.1-snapshot-0",
28
- "@instructure/ui-test-utils": "9.2.1-snapshot-0",
29
- "@instructure/ui-themes": "9.2.1-snapshot-0",
26
+ "@instructure/ui-axe-check": "9.2.1-snapshot-2",
27
+ "@instructure/ui-babel-preset": "9.2.1-snapshot-2",
28
+ "@instructure/ui-test-utils": "9.2.1-snapshot-2",
29
+ "@instructure/ui-themes": "9.2.1-snapshot-2",
30
30
  "@testing-library/jest-dom": "^6.4.5",
31
- "@testing-library/react": "^15.0.7"
31
+ "@testing-library/react": "^15.0.7",
32
+ "vitest": "^1.6.0"
32
33
  },
33
34
  "dependencies": {
34
35
  "@babel/runtime": "^7.24.5",
35
- "@instructure/console": "9.2.1-snapshot-0",
36
- "@instructure/emotion": "9.2.1-snapshot-0",
37
- "@instructure/shared-types": "9.2.1-snapshot-0",
38
- "@instructure/ui-a11y-content": "9.2.1-snapshot-0",
39
- "@instructure/ui-a11y-utils": "9.2.1-snapshot-0",
40
- "@instructure/ui-grid": "9.2.1-snapshot-0",
41
- "@instructure/ui-icons": "9.2.1-snapshot-0",
42
- "@instructure/ui-react-utils": "9.2.1-snapshot-0",
43
- "@instructure/ui-utils": "9.2.1-snapshot-0",
44
- "@instructure/uid": "9.2.1-snapshot-0",
36
+ "@instructure/console": "9.2.1-snapshot-2",
37
+ "@instructure/emotion": "9.2.1-snapshot-2",
38
+ "@instructure/shared-types": "9.2.1-snapshot-2",
39
+ "@instructure/ui-a11y-content": "9.2.1-snapshot-2",
40
+ "@instructure/ui-a11y-utils": "9.2.1-snapshot-2",
41
+ "@instructure/ui-grid": "9.2.1-snapshot-2",
42
+ "@instructure/ui-icons": "9.2.1-snapshot-2",
43
+ "@instructure/ui-react-utils": "9.2.1-snapshot-2",
44
+ "@instructure/ui-utils": "9.2.1-snapshot-2",
45
+ "@instructure/uid": "9.2.1-snapshot-2",
45
46
  "prop-types": "^15.8.1"
46
47
  },
47
48
  "peerDependencies": {
@@ -24,12 +24,31 @@
24
24
 
25
25
  import React from 'react'
26
26
  import { render, screen } from '@testing-library/react'
27
+ import { vi } from 'vitest'
27
28
  import { runAxeCheck } from '@instructure/ui-axe-check'
28
29
  import '@testing-library/jest-dom'
29
30
 
30
31
  import { FormField } from '../index'
31
32
 
32
33
  describe('<FormField />', () => {
34
+ let consoleWarningMock: ReturnType<typeof vi.spyOn>
35
+ let consoleErrorMock: ReturnType<typeof vi.spyOn>
36
+
37
+ beforeEach(() => {
38
+ // Mocking console to prevent test output pollution and expect for messages
39
+ consoleWarningMock = vi
40
+ .spyOn(console, 'warn')
41
+ .mockImplementation(() => {}) as any
42
+ consoleErrorMock = vi
43
+ .spyOn(console, 'error')
44
+ .mockImplementation(() => {}) as any
45
+ })
46
+
47
+ afterEach(() => {
48
+ consoleWarningMock.mockRestore()
49
+ consoleErrorMock.mockRestore()
50
+ })
51
+
33
52
  it('should render', () => {
34
53
  render(<FormField label="foo" id="bar" />)
35
54
  const formField = screen.getByText('foo').closest('label')
@@ -24,6 +24,7 @@
24
24
 
25
25
  import React from 'react'
26
26
  import { render, screen } from '@testing-library/react'
27
+ import { vi } from 'vitest'
27
28
  import { runAxeCheck } from '@instructure/ui-axe-check'
28
29
  import '@testing-library/jest-dom'
29
30
 
@@ -31,6 +32,24 @@ import { FormFieldGroup } from '../index'
31
32
  import { FormMessage } from '../../FormPropTypes'
32
33
 
33
34
  describe('<FormFieldGroup />', () => {
35
+ let consoleWarningMock: ReturnType<typeof vi.spyOn>
36
+ let consoleErrorMock: ReturnType<typeof vi.spyOn>
37
+
38
+ beforeEach(() => {
39
+ // Mocking console to prevent test output pollution and expect for messages
40
+ consoleWarningMock = vi
41
+ .spyOn(console, 'warn')
42
+ .mockImplementation(() => {}) as any
43
+ consoleErrorMock = vi
44
+ .spyOn(console, 'error')
45
+ .mockImplementation(() => {}) as any
46
+ })
47
+
48
+ afterEach(() => {
49
+ consoleWarningMock.mockRestore()
50
+ consoleErrorMock.mockRestore()
51
+ })
52
+
34
53
  it('should render', () => {
35
54
  const { container } = render(
36
55
  <FormFieldGroup description="Please enter your full name">
@@ -24,12 +24,31 @@
24
24
 
25
25
  import React from 'react'
26
26
  import { render } from '@testing-library/react'
27
+ import { vi } from 'vitest'
27
28
  import { runAxeCheck } from '@instructure/ui-axe-check'
28
29
  import '@testing-library/jest-dom'
29
30
 
30
31
  import { FormFieldLabel } from '../index'
31
32
 
32
33
  describe('<FormFieldLabel />', () => {
34
+ let consoleWarningMock: ReturnType<typeof vi.spyOn>
35
+ let consoleErrorMock: ReturnType<typeof vi.spyOn>
36
+
37
+ beforeEach(() => {
38
+ // Mocking console to prevent test output pollution and expect for messages
39
+ consoleWarningMock = vi
40
+ .spyOn(console, 'warn')
41
+ .mockImplementation(() => {}) as any
42
+ consoleErrorMock = vi
43
+ .spyOn(console, 'error')
44
+ .mockImplementation(() => {}) as any
45
+ })
46
+
47
+ afterEach(() => {
48
+ consoleWarningMock.mockRestore()
49
+ consoleErrorMock.mockRestore()
50
+ })
51
+
33
52
  it('should render', () => {
34
53
  const { container } = render(<FormFieldLabel>Foo</FormFieldLabel>)
35
54
 
@@ -24,12 +24,31 @@
24
24
 
25
25
  import React from 'react'
26
26
  import { render, screen } from '@testing-library/react'
27
+ import { vi } from 'vitest'
27
28
  import { runAxeCheck } from '@instructure/ui-axe-check'
28
29
  import '@testing-library/jest-dom'
29
30
 
30
31
  import { FormFieldLayout } from '../index'
31
32
 
32
33
  describe('<FormFieldLayout />', () => {
34
+ let consoleWarningMock: ReturnType<typeof vi.spyOn>
35
+ let consoleErrorMock: ReturnType<typeof vi.spyOn>
36
+
37
+ beforeEach(() => {
38
+ // Mocking console to prevent test output pollution and expect for messages
39
+ consoleWarningMock = vi
40
+ .spyOn(console, 'warn')
41
+ .mockImplementation(() => {}) as any
42
+ consoleErrorMock = vi
43
+ .spyOn(console, 'error')
44
+ .mockImplementation(() => {}) as any
45
+ })
46
+
47
+ afterEach(() => {
48
+ consoleWarningMock.mockRestore()
49
+ consoleErrorMock.mockRestore()
50
+ })
51
+
33
52
  it('should render', () => {
34
53
  const { container } = render(<FormFieldLayout label="Username" />)
35
54
 
@@ -54,7 +73,7 @@ describe('<FormFieldLayout />', () => {
54
73
  })
55
74
 
56
75
  it('should provide a ref to the input container', () => {
57
- const inputContainerRef = jest.fn()
76
+ const inputContainerRef = vi.fn()
58
77
 
59
78
  render(
60
79
  <FormFieldLayout label="Username" inputContainerRef={inputContainerRef}>
@@ -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
  import { runAxeCheck } from '@instructure/ui-axe-check'
28
29
  import { IconWarningLine } from '@instructure/ui-icons'
29
30
  import '@testing-library/jest-dom'
@@ -32,6 +33,24 @@ import { FormFieldMessages } from '../index'
32
33
  import { FormMessage } from '../../FormPropTypes'
33
34
 
34
35
  describe('<FormFieldMessages />', () => {
36
+ let consoleWarningMock: ReturnType<typeof vi.spyOn>
37
+ let consoleErrorMock: ReturnType<typeof vi.spyOn>
38
+
39
+ beforeEach(() => {
40
+ // Mocking console to prevent test output pollution and expect for messages
41
+ consoleWarningMock = vi
42
+ .spyOn(console, 'warn')
43
+ .mockImplementation(() => {}) as any
44
+ consoleErrorMock = vi
45
+ .spyOn(console, 'error')
46
+ .mockImplementation(() => {}) as any
47
+ })
48
+
49
+ afterEach(() => {
50
+ consoleWarningMock.mockRestore()
51
+ consoleErrorMock.mockRestore()
52
+ })
53
+
35
54
  it('should render', () => {
36
55
  const messages: FormMessage[] = [
37
56
  { text: 'Invalid name', type: 'error' },