Blame view

天文台pc/tianwentai-ui/node_modules/react-day-picker/src/components/CaptionLabel/CaptionLabel.test.tsx 874 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
  import { customRender } from 'test/render';
  import { getMonthCaption } from 'test/selectors';
  import { freezeBeforeAll } from 'test/utils';
  
  import { CaptionLabel } from './CaptionLabel';
  
  const today = new Date(1979, 8);
  freezeBeforeAll(today);
  
  test('should render the formatted display month', () => {
    customRender(<CaptionLabel displayMonth={today} />);
    expect(getMonthCaption()).toHaveTextContent('September 1979');
  });
  
  test('should apply the `caption_label` class name', () => {
    customRender(<CaptionLabel displayMonth={today} />, {
      classNames: { caption_label: 'foo' }
    });
    expect(getMonthCaption()).toHaveClass('foo');
  });
  
  test('should apply the `caption_label` style', () => {
    customRender(<CaptionLabel displayMonth={today} />, {
      styles: { caption_label: { color: 'red' } }
    });
    expect(getMonthCaption()).toHaveStyle({ color: 'red' });
  });