diff --git a/.dumirc.ts b/.dumirc.ts index bd809418..efcef9c5 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -19,5 +19,5 @@ export default defineConfig({ min-height: 300px; } `, - ] + ], }); diff --git a/.fatherrc.js b/.fatherrc.js index 4ddbafd1..96268ae1 100644 --- a/.fatherrc.js +++ b/.fatherrc.js @@ -2,4 +2,4 @@ import { defineConfig } from 'father'; export default defineConfig({ plugins: ['@rc-component/father-plugin'], -}); \ No newline at end of file +}); diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 23a5fb82..dcc76231 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,30 +1,30 @@ version: 2 updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: daily - time: "21:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: np - versions: - - 7.2.0 - - 7.3.0 - - 7.4.0 - - dependency-name: "@types/react-dom" - versions: - - 17.0.0 - - 17.0.1 - - 17.0.2 - - dependency-name: "@types/react" - versions: - - 17.0.0 - - 17.0.1 - - 17.0.2 - - 17.0.3 - - dependency-name: typescript - versions: - - 4.1.3 - - 4.1.4 - - 4.1.5 + - package-ecosystem: npm + directory: '/' + schedule: + interval: daily + time: '21:00' + open-pull-requests-limit: 10 + ignore: + - dependency-name: np + versions: + - 7.2.0 + - 7.3.0 + - 7.4.0 + - dependency-name: '@types/react-dom' + versions: + - 17.0.0 + - 17.0.1 + - 17.0.2 + - dependency-name: '@types/react' + versions: + - 17.0.0 + - 17.0.1 + - 17.0.2 + - 17.0.3 + - dependency-name: typescript + versions: + - 4.1.3 + - 4.1.4 + - 4.1.5 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 67f7884a..d7208a4a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,12 +1,12 @@ -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ "master" ] + branches: ['master'] pull_request: - branches: [ "master" ] + branches: ['master'] schedule: - - cron: "40 12 * * 0" + - cron: '40 12 * * 0' jobs: analyze: @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ javascript ] + language: [javascript] steps: - name: Checkout @@ -38,4 +38,4 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 with: - category: "/language:${{ matrix.language }}" + category: '/language:${{ matrix.language }}' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a23ad090..f860ff10 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,114 +1,6 @@ -name: CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - +name: ✅ test +on: [push, pull_request] jobs: - setup: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - uses: actions/setup-node@v1 - with: - node-version: '16' - - - name: cache package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: create package-lock.json - run: npm i --package-lock-only - - - name: hack for singe file - run: | - if [ ! -d "package-temp-dir" ]; then - mkdir package-temp-dir - fi - cp package-lock.json package-temp-dir - - - name: cache node_modules - id: node_modules_cache_id - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: install - if: steps.node_modules_cache_id.outputs.cache-hit != 'true' - run: npm i - - lint: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - name: restore cache from package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: restore cache from node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: lint - run: npm run lint - - needs: setup - - compile: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - name: restore cache from package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: restore cache from node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: compile - run: npm run compile - - needs: setup - - coverage: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - name: restore cache from package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: restore cache from node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: coverage - run: npm run coverage && bash <(curl -s https://codecov.io/bash) - - needs: setup \ No newline at end of file + test: + uses: react-component/rc-test/.github/workflows/test.yml@main + secrets: inherit diff --git a/.gitignore b/.gitignore index 65899cf1..f44d17fe 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ es coverage yarn.lock package-lock.json +bun.lockb # dumi .umi diff --git a/HISTORY.md b/HISTORY.md index 7ee63c89..c159b6b6 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,6 @@ # History ----- + +--- ## 4.1.0 / 2020-05-08 diff --git a/README.md b/README.md index e479e565..9e191b3a 100644 --- a/README.md +++ b/README.md @@ -39,25 +39,26 @@ import React from 'react'; import ReactDOM from 'react-dom'; import Trigger from '@rc-component/trigger'; -ReactDOM.render(( +ReactDOM.render( popup} popupAlign={{ points: ['tl', 'bl'], - offset: [0, 3] + offset: [0, 3], }} > - hover - -), container); + hover + , + container, +); ``` ## Compatibility | [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Electron](http://godban.github.io/browsers-support-badges/)
Electron | -| --- | --- | --- | --- | --- | -| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions | ## Example @@ -243,7 +244,6 @@ npm start - ## Test Case ``` diff --git a/assets/index/Mask.less b/assets/index/Mask.less index 81692e64..a7b40bf5 100644 --- a/assets/index/Mask.less +++ b/assets/index/Mask.less @@ -22,7 +22,8 @@ animation-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2); } - &-fade-enter,&-fade-appear { + &-fade-enter, + &-fade-appear { opacity: 0; .fade-effect(); animation-play-state: paused; @@ -33,7 +34,8 @@ animation-play-state: paused; } - &-fade-enter&-fade-enter-active,&-fade-appear&-fade-appear-active { + &-fade-enter&-fade-enter-active, + &-fade-appear&-fade-appear-active { animation-name: rcTriggerMaskFadeIn; animation-play-state: running; } diff --git a/docs/demos/body-overflow.md b/docs/demos/body-overflow.md index 6f6f9c48..b8fe6faf 100644 --- a/docs/demos/body-overflow.md +++ b/docs/demos/body-overflow.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/case.md b/docs/demos/case.md index 053a1bcf..7a7c3cfe 100644 --- a/docs/demos/case.md +++ b/docs/demos/case.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/click-nested.md b/docs/demos/click-nested.md index c67236dd..d1fa6ccf 100644 --- a/docs/demos/click-nested.md +++ b/docs/demos/click-nested.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/clip.md b/docs/demos/clip.md index e2798ee3..017d539f 100644 --- a/docs/demos/clip.md +++ b/docs/demos/clip.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/container.md b/docs/demos/container.md index a4860cbc..d607f169 100644 --- a/docs/demos/container.md +++ b/docs/demos/container.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/inside.md b/docs/demos/inside.md index a9853c32..6a1ccb04 100644 --- a/docs/demos/inside.md +++ b/docs/demos/inside.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/large-popup.md b/docs/demos/large-popup.md index 048c77a7..24cf8b10 100644 --- a/docs/demos/large-popup.md +++ b/docs/demos/large-popup.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/nested.md b/docs/demos/nested.md index 5daf43b0..bfd0c6ba 100644 --- a/docs/demos/nested.md +++ b/docs/demos/nested.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/point.md b/docs/demos/point.md index 073a89bc..1d31f1c1 100644 --- a/docs/demos/point.md +++ b/docs/demos/point.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/shadow.md b/docs/demos/shadow.md index 379812b7..029c60c2 100644 --- a/docs/demos/shadow.md +++ b/docs/demos/shadow.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/simple.md b/docs/demos/simple.md index dbb7c35a..6ac4ca8d 100644 --- a/docs/demos/simple.md +++ b/docs/demos/simple.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/demos/visible-fallback.md b/docs/demos/visible-fallback.md index cb5a8f24..71d0d910 100644 --- a/docs/demos/visible-fallback.md +++ b/docs/demos/visible-fallback.md @@ -5,4 +5,4 @@ nav: path: /demo --- - \ No newline at end of file + diff --git a/docs/examples/case.tsx b/docs/examples/case.tsx index 2d24a8e4..74e8740d 100644 --- a/docs/examples/case.tsx +++ b/docs/examples/case.tsx @@ -2,7 +2,7 @@ import React from 'react'; import type { CSSMotionProps } from 'rc-motion'; -import type { BuildInPlacements } from 'rc-trigger'; +import type { ActionType, BuildInPlacements } from 'rc-trigger'; import Trigger from 'rc-trigger'; import './case.less'; @@ -116,6 +116,10 @@ const Demo = () => { contextMenu, }; + const actionsKeys = Object.keys(actions).filter( + (action) => actions[action], + ) as ActionType[]; + return (
@@ -203,7 +207,7 @@ const Demo = () => { maskMotion={motion ? MaskMotion : null} maskClosable={maskClosable} stretch={stretch} - action={Object.keys(actions).filter((action) => actions[action])} + action={actionsKeys} builtinPlacements={builtinPlacements} forceRender={forceRender} popupStyle={{ diff --git a/docs/examples/nested.tsx b/docs/examples/nested.tsx index 3412438e..12dffe09 100644 --- a/docs/examples/nested.tsx +++ b/docs/examples/nested.tsx @@ -67,9 +67,7 @@ const Test = () => { getPopupContainer={() => containerRef.current} popup={
I am inner Trigger Popup
} > - - clickToShowInnerTrigger - + clickToShowInnerTrigger
); @@ -94,9 +92,7 @@ const Test = () => { builtinPlacements={builtinPlacements} popup={
i am a hover popup
} > - - trigger - + trigger @@ -108,9 +104,7 @@ const Test = () => { builtinPlacements={builtinPlacements} popup={innerTrigger} > - - trigger - + trigger diff --git a/docs/examples/point.less b/docs/examples/point.less index 4adc3418..3ea05e58 100644 --- a/docs/examples/point.less +++ b/docs/examples/point.less @@ -1,3 +1,3 @@ .point-popup { pointer-events: none; -} \ No newline at end of file +} diff --git a/docs/examples/point.tsx b/docs/examples/point.tsx index 228fb182..1e1e16ef 100644 --- a/docs/examples/point.tsx +++ b/docs/examples/point.tsx @@ -1,7 +1,7 @@ /* eslint no-console:0 */ import React from 'react'; -import Trigger from 'rc-trigger'; +import Trigger, { ActionType } from 'rc-trigger'; import '../../assets/index.less'; import './point.less'; @@ -12,12 +12,14 @@ const builtinPlacements = { }; const innerTrigger = ( -
This is popup
+
+ This is popup +
); class Test extends React.Component { state = { - action: 'click', + action: 'click' as ActionType, mouseEnterDelay: 0, }; @@ -45,7 +47,11 @@ class Test extends React.Component { {action === 'hover' && ( )}
diff --git a/docs/examples/simple.tsx b/docs/examples/simple.tsx index 31b53881..aa4c7033 100644 --- a/docs/examples/simple.tsx +++ b/docs/examples/simple.tsx @@ -1,6 +1,6 @@ /* eslint no-console:0 */ -import Trigger from 'rc-trigger'; +import Trigger, { ActionType } from 'rc-trigger'; import React from 'react'; import '../../assets/index.less'; @@ -199,6 +199,9 @@ class Test extends React.Component { if (state.destroyed) { return null; } + + const actions = Object.keys(state.trigger) as ActionType[]; + return (
@@ -359,7 +362,7 @@ class Test extends React.Component { maskAnimation="fade" // mouseEnterDelay={0.1} // mouseLeaveDelay={0.1} - action={Object.keys(state.trigger)} + action={actions} builtinPlacements={builtinPlacements} arrow popupStyle={{ @@ -370,33 +373,6 @@ class Test extends React.Component { }} popup={
i am a popup
} popupTransitionName={state.transitionName} - mobile={ - state.mobile - ? { - popupMotion: { - motionName: 'rc-trigger-popup-mobile-fade', - }, - popupClassName: 'rc-trigger-popup-mobile', - popupStyle: { - padding: 16, - borderTop: '1px solid red', - background: '#FFF', - textAlign: 'center', - }, - popupRender: (node) => ( - <> -
- -
- {node} - - ), - } - : null - } > diff --git a/docs/index.md b/docs/index.md index 2782d1cf..6e9e0db6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,4 +4,4 @@ hero: description: React Trigger Component --- - \ No newline at end of file + diff --git a/now.json b/now.json index 76d28fa1..716cff0a 100644 --- a/now.json +++ b/now.json @@ -8,4 +8,4 @@ "config": { "distDir": ".doc" } } ] -} \ No newline at end of file +} diff --git a/package.json b/package.json index 7d140862..230ab027 100644 --- a/package.json +++ b/package.json @@ -36,25 +36,27 @@ "prepublishOnly": "npm run compile && np --yolo --no-publish", "lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js", "test": "rc-test", + "prettier": "prettier --write .", "coverage": "rc-test --coverage", "now-build": "npm run build" }, "devDependencies": { "@rc-component/father-plugin": "^1.0.0", "@testing-library/jest-dom": "^6.1.4", - "@testing-library/react": "^15.0.4", + "@testing-library/react": "^16.0.0", "@types/classnames": "^2.2.10", "@types/jest": "^29.5.2", - "@types/node": "^20.11.6", + "@types/node": "^22.0.2", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.11", "@umijs/fabric": "^4.0.1", "cross-env": "^7.0.1", "dumi": "^2.1.0", - "eslint": "^8.51.0", + "eslint": "^9.9.1", "father": "^4.0.0", "less": "^4.2.0", "np": "^10.0.5", + "prettier": "^3.3.3", "rc-test": "^7.0.13", "react": "^18.0.0", "react-dom": "^18.0.0", diff --git a/src/hooks/useAlign.ts b/src/hooks/useAlign.ts index 6c15a09d..8af82525 100644 --- a/src/hooks/useAlign.ts +++ b/src/hooks/useAlign.ts @@ -212,6 +212,8 @@ export default function useAlign( }; } else { const rect = target.getBoundingClientRect(); + rect.x = rect.x ?? rect.left; + rect.y = rect.y ?? rect.top; targetRect = { x: rect.x, y: rect.y, @@ -220,6 +222,8 @@ export default function useAlign( }; } const popupRect = popupElement.getBoundingClientRect(); + popupRect.x = popupRect.x ?? popupRect.left; + popupRect.y = popupRect.y ?? popupRect.top; const { clientWidth, clientHeight, diff --git a/tests/align.test.tsx b/tests/align.test.tsx index 9366cc7c..945b132e 100644 --- a/tests/align.test.tsx +++ b/tests/align.test.tsx @@ -26,6 +26,8 @@ describe('Trigger.Align', () => { getBoundingClientRect: () => ({ x: rectX, y: rectY, + left: rectX, + top: rectY, width: rectWidth, height: rectHeight, right: 200, diff --git a/tests/arrow.test.jsx b/tests/arrow.test.jsx index 80be36ad..24df7055 100644 --- a/tests/arrow.test.jsx +++ b/tests/arrow.test.jsx @@ -53,6 +53,8 @@ describe('Trigger.Arrow', () => { () => ({ x: 200, y: 200, + left: 200, + top: 200, width: 100, height: 50, }), diff --git a/tests/flip-visibleFirst.test.tsx b/tests/flip-visibleFirst.test.tsx index e9ef9891..f44c530f 100644 --- a/tests/flip-visibleFirst.test.tsx +++ b/tests/flip-visibleFirst.test.tsx @@ -56,6 +56,8 @@ describe('Trigger.VisibleFirst', () => { let containerRect = { x: 0, y: 0, + left: 0, + top: 0, width: 100, height: 100, }; @@ -63,6 +65,8 @@ describe('Trigger.VisibleFirst', () => { let targetRect = { x: 0, y: 0, + left: 0, + top: 0, width: 1, height: 1, }; @@ -70,6 +74,8 @@ describe('Trigger.VisibleFirst', () => { let popupRect = { x: 0, y: 0, + left: 0, + top: 0, width: 100, height: 100, }; @@ -84,18 +90,24 @@ describe('Trigger.VisibleFirst', () => { containerRect = { x: 0, y: 0, + left: 0, + top: 0, width: 100, height: 100, }; targetRect = { x: 250, y: 250, + left: 250, + top: 250, width: 1, height: 1, }; popupRect = { x: 0, y: 0, + left: 0, + top: 0, width: 100, height: 100, }; diff --git a/tests/flip.test.tsx b/tests/flip.test.tsx index fa98faee..853ec980 100644 --- a/tests/flip.test.tsx +++ b/tests/flip.test.tsx @@ -58,6 +58,8 @@ describe('Trigger.Align', () => { let spanRect = { x: 0, y: 0, + left: 0, + top: 0, width: 1, height: 1, }; @@ -65,6 +67,8 @@ describe('Trigger.Align', () => { let popupRect = { x: 0, y: 0, + left: 0, + top: 0, width: 100, height: 100, }; @@ -112,12 +116,16 @@ describe('Trigger.Align', () => { spanRect = { x: 0, y: 0, + left: 0, + top: 0, width: 1, height: 1, }; popupRect = { x: 0, y: 0, + left: 0, + top: 0, width: 100, height: 100, }; @@ -253,6 +261,8 @@ describe('Trigger.Align', () => { popupRect = { x: 100, y: 1, + left: 100, + top: 1, width: 100, height: 100, }; @@ -339,9 +349,11 @@ describe('Trigger.Align', () => { ({ x: 100, y: 100, + left: 100, + top: 100, width: 300, height: 300, - } as any); + }) as any; const visibleArea = getVisibleArea(initArea, [affectEle]); expect(visibleArea).toEqual({ @@ -384,6 +396,8 @@ describe('Trigger.Align', () => { popupRect = { x: 0, y: 0, + left: 0, + top: 0, width: 200, height: 200, }; diff --git a/tests/flipShift.test.tsx b/tests/flipShift.test.tsx index ed4b3170..d9e02a03 100644 --- a/tests/flipShift.test.tsx +++ b/tests/flipShift.test.tsx @@ -79,12 +79,14 @@ const builtinPlacements = { }; describe('Trigger.Flip+Shift', () => { - let spanRect = { x: 0, y: 0, width: 0, height: 0 }; + let spanRect = { x: 0, y: 0, left: 0, top: 0, width: 0, height: 0 }; beforeEach(() => { spanRect = { x: 0, y: 100, + left: 0, + top: 100, width: 100, height: 100, }; @@ -113,6 +115,8 @@ describe('Trigger.Flip+Shift', () => { return { x: 0, y: 0, + left: 0, + top: 0, width: 100, height: 300, }; diff --git a/tests/rect.test.tsx b/tests/rect.test.tsx new file mode 100644 index 00000000..596689f0 --- /dev/null +++ b/tests/rect.test.tsx @@ -0,0 +1,77 @@ +import { cleanup, render } from '@testing-library/react'; +import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import React from 'react'; +import Trigger from '../src'; +import { awaitFakeTimer } from './util'; + +describe('Trigger.Rect', () => { + let targetVisible = true; + + let rectX = 100; + let rectY = 100; + let rectWidth = 100; + let rectHeight = 100; + + beforeAll(() => { + spyElementPrototypes(HTMLDivElement, { + getBoundingClientRect: () => ({ + left: rectX, + top: rectY, + width: rectWidth, + height: rectHeight, + right: 200, + bottom: 200, + }), + }); + + spyElementPrototypes(HTMLElement, { + offsetParent: { + get: () => (targetVisible ? document.body : null), + }, + }); + spyElementPrototypes(SVGElement, { + offsetParent: { + get: () => (targetVisible ? document.body : null), + }, + }); + }); + + beforeEach(() => { + targetVisible = true; + + rectX = 100; + rectY = 100; + rectWidth = 100; + rectHeight = 100; + + jest.useFakeTimers(); + }); + + afterEach(() => { + cleanup(); + jest.useRealTimers(); + }); + + it('getBoundingClientRect top and left', async () => { + render( + } + popupAlign={{ + points: ['bc', 'tc'], + _experimental: { + dynamicInset: true, + }, + }} + > +
+ , + ); + + await awaitFakeTimer(); + + expect(document.querySelector('.rc-trigger-popup')).toHaveStyle({ + bottom: `100px`, + }); + }); +}); diff --git a/tests/util.tsx b/tests/util.tsx index c06684f4..c706654d 100644 --- a/tests/util.tsx +++ b/tests/util.tsx @@ -1,4 +1,4 @@ -import { act } from "@testing-library/react"; +import { act } from '@testing-library/react'; const autoAdjustOverflow = { adjustX: 1, @@ -94,7 +94,6 @@ export function getMouseEvent(type: string, values = {}): FakeMouseEvent { return new FakeMouseEvent(type, values); } - export async function awaitFakeTimer() { for (let i = 0; i < 10; i += 1) { await act(async () => {