@instructure/ui-react-utils 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/__new-tests__/deprecated.test.js +12 -11
- package/es/__new-tests__/experimental.test.js +6 -5
- package/es/__new-tests__/hack.test.js +3 -2
- package/es/__new-tests__/safeCloneElement.test.js +8 -7
- package/lib/__new-tests__/deprecated.test.js +12 -11
- package/lib/__new-tests__/experimental.test.js +6 -5
- package/lib/__new-tests__/hack.test.js +3 -2
- package/lib/__new-tests__/safeCloneElement.test.js +8 -7
- package/package.json +9 -8
- package/src/__new-tests__/deprecated.test.tsx +12 -11
- package/src/__new-tests__/experimental.test.tsx +6 -5
- package/src/__new-tests__/hack.test.tsx +3 -2
- package/src/__new-tests__/safeCloneElement.test.tsx +8 -7
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/__new-tests__/deprecated.test.d.ts.map +1 -1
- package/types/__new-tests__/experimental.test.d.ts.map +1 -1
- package/types/__new-tests__/hack.test.d.ts.map +1 -1
- package/types/__new-tests__/safeCloneElement.test.d.ts.map +1 -1
|
@@ -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('@hack', () => {
|
|
|
59
60
|
const HackComponent = hack(['bar'])(TestComponent)
|
|
60
61
|
|
|
61
62
|
it('should warn when using an hack prop', () => {
|
|
62
|
-
const consoleWarningSpy =
|
|
63
|
+
const consoleWarningSpy = vi
|
|
63
64
|
.spyOn(console, 'warn')
|
|
64
65
|
.mockImplementation(() => {})
|
|
65
66
|
render(<HackComponent bar="Jane" />)
|
|
@@ -76,7 +77,7 @@ describe('@hack', () => {
|
|
|
76
77
|
})
|
|
77
78
|
|
|
78
79
|
it('should not output a warning using a non-hack prop', () => {
|
|
79
|
-
const consoleWarningSpy =
|
|
80
|
+
const consoleWarningSpy = vi
|
|
80
81
|
.spyOn(console, 'warn')
|
|
81
82
|
.mockImplementation(() => {})
|
|
82
83
|
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React, { ReactElement, ReactNode } from 'react'
|
|
26
|
+
import { vi } from 'vitest'
|
|
26
27
|
|
|
27
28
|
import { createChainedFunction } from '@instructure/ui-utils'
|
|
28
29
|
import { render, screen } from '@testing-library/react'
|
|
@@ -44,8 +45,8 @@ describe('safeCloneElement', () => {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
it('should preserve refs', () => {
|
|
47
|
-
const origRef =
|
|
48
|
-
const cloneRef =
|
|
48
|
+
const origRef = vi.fn()
|
|
49
|
+
const cloneRef = vi.fn()
|
|
49
50
|
|
|
50
51
|
render(
|
|
51
52
|
<SafeClone element={<div ref={origRef} />} props={{ ref: cloneRef }} />
|
|
@@ -56,8 +57,8 @@ describe('safeCloneElement', () => {
|
|
|
56
57
|
})
|
|
57
58
|
|
|
58
59
|
it('should preserve event handlers', () => {
|
|
59
|
-
const onClickA =
|
|
60
|
-
const onClickB =
|
|
60
|
+
const onClickA = vi.fn()
|
|
61
|
+
const onClickB = vi.fn()
|
|
61
62
|
|
|
62
63
|
render(
|
|
63
64
|
<SafeClone
|
|
@@ -74,9 +75,9 @@ describe('safeCloneElement', () => {
|
|
|
74
75
|
})
|
|
75
76
|
|
|
76
77
|
it('should preserve already chained functions', () => {
|
|
77
|
-
const onClickA =
|
|
78
|
-
const onClickB =
|
|
79
|
-
const onClickC =
|
|
78
|
+
const onClickA = vi.fn()
|
|
79
|
+
const onClickB = vi.fn()
|
|
80
|
+
const onClickC = vi.fn()
|
|
80
81
|
|
|
81
82
|
render(
|
|
82
83
|
<SafeClone
|