useHoverIndentGuide.test.ts 681 B

1234567891011121314151617
  1. import { renderHook, act } from '@testing-library/react-hooks';
  2. import { useHoverIndentGuide } from './useHoverIndentGuide';
  3. describe('useHoverIndentGuide', () => {
  4. it('adds and removes indent guide ids', async () => {
  5. const { result } = renderHook(() => useHoverIndentGuide());
  6. expect(result.current.hoverIndentGuideIds.size).toBe(0);
  7. act(() => result.current.addHoverIndentGuideId('span1'));
  8. expect(result.current.hoverIndentGuideIds.size).toBe(1);
  9. expect(result.current.hoverIndentGuideIds.has('span1')).toBe(true);
  10. act(() => result.current.removeHoverIndentGuideId('span1'));
  11. expect(result.current.hoverIndentGuideIds.size).toBe(0);
  12. });
  13. });