mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
fix doc error and add test case for WeekPicker
This commit is contained in:
parent
a7bedca0e2
commit
41aa37bd99
@ -2,6 +2,7 @@ import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import DatePicker from '..';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import { openPanel } from './utils';
|
||||
|
||||
const { WeekPicker } = DatePicker;
|
||||
|
||||
@ -12,4 +13,39 @@ describe('WeekPicker', () => {
|
||||
const wrapper = mount(<WeekPicker style={{ width: 400 }} />);
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('extra footer works', () => {
|
||||
const wrapper = mount(
|
||||
<WeekPicker renderExtraFooter={mode => <span className="extra-node">{mode}</span>} />,
|
||||
);
|
||||
openPanel(wrapper);
|
||||
|
||||
let extraNode = wrapper.find('.extra-node');
|
||||
expect(extraNode.length).toBe(1);
|
||||
expect(extraNode.text()).toBe('date');
|
||||
|
||||
wrapper
|
||||
.find('.ant-calendar-month-select')
|
||||
.hostNodes()
|
||||
.simulate('click');
|
||||
extraNode = wrapper.find('.ant-calendar-month-panel .extra-node');
|
||||
expect(extraNode.length).toBe(1);
|
||||
expect(extraNode.text()).toBe('month');
|
||||
|
||||
wrapper
|
||||
.find('.ant-calendar-year-select')
|
||||
.hostNodes()
|
||||
.simulate('click');
|
||||
extraNode = wrapper.find('.ant-calendar-year-panel .extra-node');
|
||||
expect(extraNode.length).toBe(1);
|
||||
expect(extraNode.text()).toBe('year');
|
||||
|
||||
wrapper
|
||||
.find('.ant-calendar-year-panel-decade-select')
|
||||
.hostNodes()
|
||||
.simulate('click');
|
||||
extraNode = wrapper.find('.ant-calendar-decade-panel .extra-node');
|
||||
expect(extraNode.length).toBe(1);
|
||||
expect(extraNode.text()).toBe('decade');
|
||||
});
|
||||
});
|
||||
|
@ -65,7 +65,6 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
|
||||
| style | to customize the style of the input box | object | {} |
|
||||
| onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - |
|
||||
| onPanelChange | callback when picker panel mode is changed | function(value, mode) | - |
|
||||
| renderFooter | renderer of picker panel footer | (mode) => ReactNode | - |
|
||||
|
||||
### Common Methods
|
||||
|
||||
|
@ -66,7 +66,6 @@ moment.locale('zh-cn');
|
||||
| style | 自定义输入框样式 | object | {} |
|
||||
| onOpenChange | 弹出日历和关闭日历的回调 | function(status) | 无 |
|
||||
| onPanelChange | 日历面板切换的回调 | function(value, mode) | - |
|
||||
| renderFooter | 渲染弹出层的页脚 | (mode) => ReactNode | - |
|
||||
|
||||
### 共同的方法
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user