init project
Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled

This commit is contained in:
how2ice
2025-12-12 14:26:25 +09:00
commit 005cf56baf
43188 changed files with 1079531 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import { act, fireEvent } from '@mui/internal-test-utils';
function delay(ms: number) {
return new Promise((r) => {
setTimeout(r, ms);
});
}
export async function asyncFireEvent(node: Element, event: keyof typeof fireEvent, options?: any) {
await act(async () => {
fireEvent[event](node, options);
await delay(1);
});
}
export function startTouch(node: Element, options?: any) {
return asyncFireEvent(node, 'mouseDown', options);
}
export async function stopTouch(node: Element) {
return asyncFireEvent(node, 'mouseUp');
}
export async function startFocus(node: HTMLElement) {
await act(async () => {
node.blur();
fireEvent.keyDown(document.body, { key: 'Tab' });
node.focus();
await delay(1);
});
}
export async function stopFocus(node: HTMLElement) {
await act(async () => {
node.blur();
await delay(1);
});
}