File tree Expand file tree Collapse file tree 1 file changed +5
-21
lines changed
Expand file tree Collapse file tree 1 file changed +5
-21
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ import ReactDOM, { createPortal } from 'react-dom';
66import Trigger from '../src' ;
77import { awaitFakeTimer , placementAlignMap } from './util' ;
88
9+ jest . mock ( '@rc-component/util/lib/hooks/useId' , ( ) => {
10+ const origin = jest . requireActual ( 'react' ) ;
11+ return origin . useId ;
12+ } ) ;
13+
914describe ( 'Trigger.Basic' , ( ) => {
1015 beforeAll ( ( ) => {
1116 spyElementPrototypes ( HTMLElement , {
@@ -1202,27 +1207,6 @@ describe('Trigger.Basic', () => {
12021207 } ) ;
12031208
12041209 describe ( 'keyboard' , ( ) => {
1205- const useIdModule = require ( '@rc-component/util/lib/hooks/useId' ) ;
1206- let useIdSpy ;
1207- let uuid = 0 ;
1208-
1209- beforeEach ( ( ) => {
1210- useIdSpy = jest . spyOn ( useIdModule , 'default' ) . mockImplementation ( ( ) => {
1211- const idRef = React . useRef ( ) ;
1212-
1213- if ( ! idRef . current ) {
1214- uuid += 1 ;
1215- idRef . current = `test-id-${ uuid } ` ;
1216- }
1217-
1218- return idRef . current ;
1219- } ) ;
1220- } ) ;
1221-
1222- afterEach ( ( ) => {
1223- useIdSpy . mockRestore ( ) ;
1224- } ) ;
1225-
12261210 it ( 'esc should close popup' , async ( ) => {
12271211 const { container } = render (
12281212 < Trigger action = "click" popup = { < strong > trigger</ strong > } >
You can’t perform that action at this time.
0 commit comments