mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
style: run prettier formatter over src and tests
This commit is contained in:
@@ -13,7 +13,9 @@ describe('useScrollSync', () => {
|
||||
it('throttles editor scroll events to 60fps', () => {
|
||||
const onScroll = vi.fn();
|
||||
const { result } = renderHook(() => useScrollSync({ onEditorScroll: onScroll }));
|
||||
const mockEvt = { currentTarget: { scrollTop: 100, scrollHeight: 1000, clientHeight: 200 } } as any;
|
||||
const mockEvt = {
|
||||
currentTarget: { scrollTop: 100, scrollHeight: 1000, clientHeight: 200 },
|
||||
} as any;
|
||||
// All calls within the same act() - performance.now() stays at 0
|
||||
// First call passes, subsequent calls within FRAME_MS are throttled
|
||||
act(() => {
|
||||
|
||||
@@ -95,7 +95,12 @@ describe('useShortcut', () => {
|
||||
it('calls preventDefault when the shortcut matches', () => {
|
||||
const cb = vi.fn();
|
||||
renderHook(() => useShortcut('mod+s', cb));
|
||||
const event = new KeyboardEvent('keydown', { key: 's', ctrlKey: true, bubbles: true, cancelable: true });
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 's',
|
||||
ctrlKey: true,
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
expect(event.defaultPrevented).toBe(true);
|
||||
});
|
||||
@@ -103,7 +108,12 @@ describe('useShortcut', () => {
|
||||
it('does NOT call preventDefault when the shortcut does NOT match', () => {
|
||||
const cb = vi.fn();
|
||||
renderHook(() => useShortcut('mod+s', cb));
|
||||
const event = new KeyboardEvent('keydown', { key: 'x', ctrlKey: true, bubbles: true, cancelable: true });
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'x',
|
||||
ctrlKey: true,
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
expect(event.defaultPrevented).toBe(false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user