Blame view

天文台pc/tianwentai-ui/node_modules/react-day-picker/src/hooks/useActiveModifiers/useActiveModifiers.test.tsx 846 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  import { addMonths } from 'date-fns';
  
  import { renderDayPickerHook } from 'test/render';
  
  import { ActiveModifiers } from 'types/Modifiers';
  
  import { useActiveModifiers } from './useActiveModifiers';
  
  const date = new Date(2010, 5, 23);
  
  describe('when in the same month', () => {
    const displayMonth = date;
    test('should return the active modifiers', () => {
      const result = renderDayPickerHook<ActiveModifiers>(() =>
        useActiveModifiers(date, displayMonth)
      );
      expect(result).toBeDefined();
    });
  });
  
  describe('when not in the same display month', () => {
    const displayMonth = addMonths(date, 1);
    test('should return the outside modifier', () => {
      const result = renderDayPickerHook<ActiveModifiers>(() =>
        useActiveModifiers(date, displayMonth)
      );
      expect(result.current.outside).toBe(true);
    });
  });