Skip to content

Commit 79ebbb8

Browse files
committed
test: add start date test
1 parent a1a78ef commit 79ebbb8

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

tests/panel.spec.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import moment from 'moment';
44
import { resetWarned } from 'rc-util/lib/warning';
55
import { spyElementPrototypes } from 'rc-util/lib/test/domHook';
66
import { mount, getMoment, isSame, MomentPickerPanel } from './util/commonUtil';
7+
import zhCN from '../src/locale/zh_CN';
8+
import enUS from '../src/locale/en_US';
79

810
describe('Picker.Panel', () => {
911
beforeAll(() => {
@@ -69,10 +71,7 @@ describe('Picker.Panel', () => {
6971
expect(wrapper.find('.rc-picker-year-panel').length).toBeTruthy();
7072
});
7173

72-
[
73-
['month', 'Aug'],
74-
['quarter', 'Q3'],
75-
].forEach(([picker, cell]) => {
74+
[['month', 'Aug'], ['quarter', 'Q3']].forEach(([picker, cell]) => {
7675
it(picker, () => {
7776
const wrapper = mount(<MomentPickerPanel picker={picker as any} />);
7877
wrapper.find('.rc-picker-year-btn').simulate('click');
@@ -420,4 +419,23 @@ describe('Picker.Panel', () => {
420419

421420
expect(wrapper.find('tbody').render()).toMatchSnapshot();
422421
});
422+
423+
describe('start weekday should be correct', () => {
424+
[{ locale: zhCN, startDate: '30' }, { locale: enUS, startDate: '29' }].forEach(
425+
({ locale, startDate }) => {
426+
it(locale.locale, () => {
427+
const wrapper = mount(
428+
<MomentPickerPanel defaultValue={getMoment('2020-04-02')} locale={locale} />,
429+
);
430+
431+
expect(
432+
wrapper
433+
.find('td')
434+
.first()
435+
.text(),
436+
).toEqual(startDate);
437+
});
438+
},
439+
);
440+
});
423441
});

0 commit comments

Comments
 (0)