Blame view

天文台pc/tianwentai-ui/node_modules/react-day-picker/src/components/DayContent/DayContent.test.tsx 911 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
30
31
32
33
34
35
36
37
  import { es } from 'date-fns/locale';
  import { DayPickerProps } from 'DayPicker';
  
  import { customRender } from 'test/render';
  import { freezeBeforeAll } from 'test/utils';
  
  import { DayContent, DayContentProps } from 'components/DayContent';
  
  const today = new Date(2021, 8);
  
  freezeBeforeAll(today);
  let container: HTMLElement;
  function setup(props: DayContentProps, dayPickerProps?: DayPickerProps) {
    const view = customRender(<DayContent {...props} />, dayPickerProps);
    container = view.container;
  }
  
  const date = today;
  const displayMonth = today;
  const props: DayContentProps = {
    date: date,
    displayMonth,
    activeModifiers: {}
  };
  
  const dayPickerProps: DayPickerProps = {
    locale: es
  };
  
  describe('when rendered', () => {
    beforeEach(() => {
      setup(props, dayPickerProps);
    });
    test('contains the formatted day', () => {
      expect(container.firstChild).toHaveTextContent('1');
    });
  });