Skip to content

Commit ee0d450

Browse files
committed
test: update calendar snap
1 parent 5188180 commit ee0d450

File tree

6 files changed

+185
-210
lines changed

6 files changed

+185
-210
lines changed

components/calendar/Header.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export default defineComponent({
7272
return (
7373
<Select
7474
size={fullscreen ? undefined : 'small'}
75-
dropdownMatchSelectWidth={false}
7675
class={`${prefixCls}-year-select`}
7776
onChange={this.onYearChange}
7877
value={String(year)}
@@ -107,7 +106,6 @@ export default defineComponent({
107106
return (
108107
<Select
109108
size={fullscreen ? undefined : 'small'}
110-
dropdownMatchSelectWidth={false}
111109
class={`${prefixCls}-month-select`}
112110
value={month}
113111
options={options}

components/calendar/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 156 additions & 180 deletions
Large diffs are not rendered by default.

components/calendar/__tests__/__snapshots__/index.test.js.snap

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,21 @@
33
exports[`Calendar Calendar should support locale 1`] = `
44
<div class=" ant-fullcalendar-fullscreen">
55
<div class="ant-fullcalendar-header">
6-
<!---->
7-
<div class="ant-fullcalendar-year-select ant-select ant-select-enabled" tabindex="0">
8-
<div role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" aria-controls="test-uuid" class="ant-select-selection ant-select-selection--single">
9-
<div class="ant-select-selection__rendered">
10-
<!---->
11-
<div class="ant-select-selection-selected-value" title="2018年" style="display: block; opacity: 1;">2018年</div>
12-
</div>
13-
<!----><span class="ant-select-arrow" style="user-select: none;" unselectable="on"><span role="img" aria-label="down" class="anticon anticon-down ant-select-arrow-icon"><svg class="" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896" focusable="false"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></span></span>
14-
</div>
6+
<div class="ant-select ant-fullcalendar-year-select ant-select-single ant-select-show-arrow">
7+
<!---->
8+
<!---->
9+
<div class="ant-select-selector"><span class="ant-select-selection-search"><input id="rc_select_TEST_OR_SSR" autocomplete="off" class="ant-select-selection-search-input" style="opacity: 0;" role="combobox" aria-haspopup="listbox" aria-owns="rc_select_TEST_OR_SSR_list" aria-autocomplete="list" aria-controls="rc_select_TEST_OR_SSR_list" aria-activedescendant="rc_select_TEST_OR_SSR_list_0" readonly="" unselectable="on" type="search"></span><span class="ant-select-selection-item" title="2018">2018</span>
10+
<!---->
11+
</div><span class="ant-select-arrow" style="user-select: none;" unselectable="on" aria-hidden="true"><span role="img" aria-label="down" class="anticon anticon-down ant-select-suffix"><svg class="" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896" focusable="false"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></span></span>
12+
<!---->
1513
</div>
16-
<!---->
17-
<div class="ant-fullcalendar-month-select ant-select ant-select-enabled" tabindex="0">
18-
<div role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" aria-controls="test-uuid" class="ant-select-selection ant-select-selection--single">
19-
<div class="ant-select-selection__rendered">
20-
<!---->
21-
<div class="ant-select-selection-selected-value" title="Oct" style="display: block; opacity: 1;">Oct</div>
22-
</div>
23-
<!----><span class="ant-select-arrow" style="user-select: none;" unselectable="on"><span role="img" aria-label="down" class="anticon anticon-down ant-select-arrow-icon"><svg class="" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896" focusable="false"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></span></span>
24-
</div>
14+
<div class="ant-select ant-fullcalendar-month-select ant-select-single ant-select-show-arrow">
15+
<!---->
16+
<!---->
17+
<div class="ant-select-selector"><span class="ant-select-selection-search"><input id="rc_select_TEST_OR_SSR" autocomplete="off" class="ant-select-selection-search-input" style="opacity: 0;" role="combobox" aria-haspopup="listbox" aria-owns="rc_select_TEST_OR_SSR_list" aria-autocomplete="list" aria-controls="rc_select_TEST_OR_SSR_list" aria-activedescendant="rc_select_TEST_OR_SSR_list_0" readonly="" unselectable="on" type="search"></span><span class="ant-select-selection-item" title="Oct">Oct</span>
18+
<!---->
19+
</div><span class="ant-select-arrow" style="user-select: none;" unselectable="on" aria-hidden="true"><span role="img" aria-label="down" class="anticon anticon-down ant-select-suffix"><svg class="" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896" focusable="false"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></span></span>
20+
<!---->
2521
</div>
2622
<div class="ant-radio-group ant-radio-group-outline ant-radio-group-default"><label class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"><span class="ant-radio-button ant-radio-button-checked"><input type="radio" class="ant-radio-button-input" value="month"><span class="ant-radio-button-inner"></span></span><span>月</span></label><label class="ant-radio-button-wrapper"><span class="ant-radio-button"><input type="radio" class="ant-radio-button-input" value="year"><span class="ant-radio-button-inner"></span></span><span>年</span></label></div>
2723
</div>

components/calendar/__tests__/index.test.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ describe('Calendar', () => {
122122
it('months other than in valid range should not be shown in header', async () => {
123123
document.body.innerHTML = '';
124124
const validRange = [Moment('2017-02-02'), Moment('2018-05-18')];
125+
// eslint-disable-next-line no-unused-vars
125126
const wrapper = mount(
126127
{
127128
render() {
@@ -131,11 +132,13 @@ describe('Calendar', () => {
131132
{ sync: false, attachTo: 'body' },
132133
);
133134
await asyncExpect(() => {
134-
wrapper.find('.ant-fullcalendar-year-select').trigger('click');
135+
wrapper
136+
.findAll('.ant-fullcalendar-year-select .ant-select-selector')[0]
137+
.element.dispatchEvent(new MouseEvent('mousedown'));
135138
});
136139
await asyncExpect(() => {
137-
$$('.ant-select-dropdown-menu-item')[0].click();
138-
}, 0);
140+
expect($$('.ant-select-item-option').length).toBe(2);
141+
}, 100);
139142
});
140143

141144
it('getDateRange should returns a disabledDate function', async () => {
@@ -263,9 +266,9 @@ describe('Calendar', () => {
263266
},
264267
);
265268
await sleep(50);
266-
wrapper.findAll('.ant-fullcalendar-year-select')[0].trigger('click');
269+
wrapper.findAll('.ant-select-selector')[0].element.dispatchEvent(new MouseEvent('mousedown'));
267270
await sleep(50);
268-
$$('.ant-select-dropdown-menu-item')[0].click();
271+
$$('.ant-select-item-option')[0].click();
269272
await sleep(50);
270273
};
271274

@@ -320,9 +323,11 @@ describe('Calendar', () => {
320323
},
321324
);
322325
await sleep(50);
323-
wrapper.findAll('.ant-fullcalendar-month-select')[0].trigger('click');
326+
wrapper
327+
.findAll('.ant-fullcalendar-month-select .ant-select-selector')[0]
328+
.element.dispatchEvent(new MouseEvent('mousedown'));
324329
await sleep(50);
325-
wrapper.findAll('.ant-select-dropdown-menu-item')[0].trigger('click');
330+
wrapper.findAll('.ant-select-item-option')[0].trigger('click');
326331
await sleep(50);
327332
expect(onValueChange).toHaveBeenCalledWith(value.month(10));
328333
});
@@ -342,7 +347,8 @@ describe('Calendar', () => {
342347
);
343348
},
344349
});
345-
wrapper.findAll('input')[1].trigger('change');
350+
const buttons = wrapper.findAll('.ant-radio-button-input');
351+
buttons[buttons.length - 1].trigger('change');
346352
expect(onTypeChange).toHaveBeenCalledWith('year');
347353
});
348354
});

components/calendar/style/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
outline: none;
1111

1212
.@{ant-prefix}-select&-year-select {
13-
min-width: 90px;
13+
min-width: 80px;
1414

1515
&.@{ant-prefix}-select-sm {
1616
min-width: 70px;

components/vc-pagination/Options.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ export default {
107107
showSearch={false}
108108
class={`${prefixCls}-size-changer`}
109109
optionLabelProp="children"
110-
dropdownMatchSelectWidth={false}
111110
value={(pageSize || pageSizeOptions[0]).toString()}
112111
onChange={value => this.changeSize(Number(value))}
113112
getPopupContainer={triggerNode => triggerNode.parentNode}

0 commit comments

Comments
 (0)