Browse Source

test: fixed generateCalendar time for snapshot stable (#41881)

pull/40111/merge
二货爱吃白萝卜 2 years ago
committed by GitHub
parent
commit
0dc3c417ca
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 118
      components/calendar/__tests__/__snapshots__/index.test.tsx.snap
  2. 4
      components/calendar/__tests__/index.test.tsx

118
components/calendar/__tests__/__snapshots__/index.test.tsx.snap

@ -2874,9 +2874,9 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</span>
<span
class="ant-select-selection-item"
title="2023"
title="2000"
>
2023
2000
</span>
</div>
<span
@ -2935,9 +2935,9 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</span>
<span
class="ant-select-selection-item"
title="Apr"
title="Jan"
>
Apr
Jan
</span>
</div>
<span
@ -3053,7 +3053,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<tr>
<td
class="ant-picker-cell"
title="2023-03-26"
title="1999-12-26"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3070,7 +3070,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell"
title="2023-03-27"
title="1999-12-27"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3087,7 +3087,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell"
title="2023-03-28"
title="1999-12-28"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3104,7 +3104,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell"
title="2023-03-29"
title="1999-12-29"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3121,7 +3121,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell"
title="2023-03-30"
title="1999-12-30"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3138,7 +3138,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-end"
title="2023-03-31"
title="1999-12-31"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3154,11 +3154,11 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</div>
</td>
<td
class="ant-picker-cell ant-picker-cell-start ant-picker-cell-in-view"
title="2023-04-01"
class="ant-picker-cell ant-picker-cell-start ant-picker-cell-in-view ant-picker-cell-today ant-picker-cell-selected"
title="2000-01-01"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
class="ant-picker-cell-inner ant-picker-calendar-date ant-picker-calendar-date-today"
>
<div
class="ant-picker-calendar-date-value"
@ -3174,7 +3174,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-02"
title="2000-01-02"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3191,7 +3191,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-03"
title="2000-01-03"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3208,7 +3208,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-04"
title="2000-01-04"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3225,7 +3225,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-05"
title="2000-01-05"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3242,7 +3242,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-06"
title="2000-01-06"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3259,7 +3259,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-07"
title="2000-01-07"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3276,7 +3276,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-08"
title="2000-01-08"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3295,7 +3295,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-09"
title="2000-01-09"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3312,7 +3312,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-10"
title="2000-01-10"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3329,7 +3329,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-11"
title="2000-01-11"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3346,7 +3346,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-12"
title="2000-01-12"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3363,7 +3363,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-13"
title="2000-01-13"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3380,7 +3380,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-14"
title="2000-01-14"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3397,7 +3397,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-15"
title="2000-01-15"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3416,7 +3416,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-16"
title="2000-01-16"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3433,7 +3433,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-17"
title="2000-01-17"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3450,7 +3450,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-18"
title="2000-01-18"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3466,11 +3466,11 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</div>
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view ant-picker-cell-today ant-picker-cell-selected"
title="2023-04-19"
class="ant-picker-cell ant-picker-cell-in-view"
title="2000-01-19"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date ant-picker-calendar-date-today"
class="ant-picker-cell-inner ant-picker-calendar-date"
>
<div
class="ant-picker-calendar-date-value"
@ -3484,7 +3484,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-20"
title="2000-01-20"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3501,7 +3501,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-21"
title="2000-01-21"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3518,7 +3518,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-22"
title="2000-01-22"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3537,7 +3537,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<tr>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-23"
title="2000-01-23"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3554,7 +3554,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-24"
title="2000-01-24"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3571,7 +3571,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-25"
title="2000-01-25"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3588,7 +3588,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-26"
title="2000-01-26"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3605,7 +3605,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-27"
title="2000-01-27"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3622,7 +3622,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-28"
title="2000-01-28"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3639,7 +3639,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell ant-picker-cell-in-view"
title="2023-04-29"
title="2000-01-29"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3657,8 +3657,8 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</tr>
<tr>
<td
class="ant-picker-cell ant-picker-cell-end ant-picker-cell-in-view"
title="2023-04-30"
class="ant-picker-cell ant-picker-cell-in-view"
title="2000-01-30"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3674,8 +3674,8 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</div>
</td>
<td
class="ant-picker-cell ant-picker-cell-start"
title="2023-05-01"
class="ant-picker-cell ant-picker-cell-end ant-picker-cell-in-view"
title="2000-01-31"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3683,7 +3683,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<div
class="ant-picker-calendar-date-value"
>
01
31
</div>
<div
class="ant-picker-calendar-date-content"
@ -3691,8 +3691,8 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</div>
</td>
<td
class="ant-picker-cell"
title="2023-05-02"
class="ant-picker-cell ant-picker-cell-start"
title="2000-02-01"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3700,7 +3700,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<div
class="ant-picker-calendar-date-value"
>
02
01
</div>
<div
class="ant-picker-calendar-date-content"
@ -3709,7 +3709,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell"
title="2023-05-03"
title="2000-02-02"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3717,7 +3717,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<div
class="ant-picker-calendar-date-value"
>
03
02
</div>
<div
class="ant-picker-calendar-date-content"
@ -3726,7 +3726,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell"
title="2023-05-04"
title="2000-02-03"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3734,7 +3734,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<div
class="ant-picker-calendar-date-value"
>
04
03
</div>
<div
class="ant-picker-calendar-date-content"
@ -3743,7 +3743,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell"
title="2023-05-05"
title="2000-02-04"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3751,7 +3751,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<div
class="ant-picker-calendar-date-value"
>
05
04
</div>
<div
class="ant-picker-calendar-date-content"
@ -3760,7 +3760,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
</td>
<td
class="ant-picker-cell"
title="2023-05-06"
title="2000-02-05"
>
<div
class="ant-picker-cell-inner ant-picker-calendar-date"
@ -3768,7 +3768,7 @@ exports[`Calendar support Calendar.generateCalendar 1`] = `
<div
class="ant-picker-calendar-date-value"
>
06
05
</div>
<div
class="ant-picker-calendar-date-content"

4
components/calendar/__tests__/index.test.tsx

@ -540,8 +540,12 @@ describe('Calendar', () => {
});
it('support Calendar.generateCalendar', () => {
jest.useFakeTimers().setSystemTime(new Date('2000-01-01'));
const MyCalendar = Calendar.generateCalendar(dayjsGenerateConfig);
const { container } = render(<MyCalendar />);
expect(container.firstChild).toMatchSnapshot();
jest.useRealTimers();
});
});

Loading…
Cancel
Save