Skip to content

Commit fdca67f

Browse files
committed
test: update components/aXXX
1 parent 981470f commit fdca67f

File tree

7 files changed

+64
-90
lines changed

7 files changed

+64
-90
lines changed

.jest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = {
2525
testRegex: libDir === 'dist' ? 'demo\\.test\\.js$' : '.*\\.test\\.js$',
2626
moduleNameMapper: {
2727
'^@/(.*)$': '<rootDir>/$1',
28-
'ant-design-vue$': '<rootDir>/components/index.js',
28+
'ant-design-vue$': '<rootDir>/components/index.ts',
2929
'ant-design-vue/es': '<rootDir>/components',
3030
},
3131
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
Lines changed: 42 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,77 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`renders ./antdv-demo/docs/auto-complete/demo/basic.md correctly 1`] = `
4-
<!---->
5-
<div style="width: 200px;" class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled" tabindex="0">
6-
<div role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" aria-controls="test-uuid" class="ant-select-selection ant-select-selection--single">
7-
<div class="ant-select-selection__rendered">
8-
<!---->
9-
<ul>
10-
<li class="ant-select-search ant-select-search--inline">
11-
<div class="ant-select-search__field__wrap"><input placeholder="input here" type="text" class="ant-input ant-select-search__field"><span class="ant-select-search__field__mirror">&nbsp;</span></div>
12-
</li>
13-
</ul>
14-
</div>
15-
<!----><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>
4+
<div class="ant-select ant-select-show-search ant-select-auto-complete ant-select-single ant-select-customize-input" style="width: 200px;">
5+
<!---->
6+
<!---->
7+
<div class="ant-select-selector"><span class="ant-select-selection-search"><input type="search" id="rc_select_TEST_OR_SSR" autocomplete="off" class="ant-input ant-select-selection-search-input" 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"></span>
8+
<!----><span class="ant-select-selection-placeholder">input here</span>
169
</div>
10+
<!---->
11+
<!---->
1712
</div>
1813
`;
1914
2015
exports[`renders ./antdv-demo/docs/auto-complete/demo/certain-category.md correctly 1`] = `
2116
<div class="certain-category-search-wrapper" style="width: 250px;">
22-
<!---->
23-
<div style="width: 100%;" class="certain-category-search ant-select-lg ant-select-show-search ant-select-auto-complete ant-select-lg certain-category-search ant-select-lg ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled" tabindex="0">
24-
<div role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" aria-controls="test-uuid" class="ant-select-selection ant-select-selection--single">
25-
<div class="ant-select-selection__rendered">
26-
<!---->
27-
<ul>
28-
<li class="ant-select-search ant-select-search--inline">
29-
<div class="ant-select-search__field__wrap"><span class="ant-select-search__field ant-input-affix-wrapper"><!----><input placeholder="input here" type="text" class="ant-input"><span class="ant-input-suffix"><!----><span role="img" aria-label="search" class="anticon anticon-search certain-category-icon"><svg class="" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896" focusable="false"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg></span></span></span><span class="ant-select-search__field__mirror">&nbsp;</span></div>
30-
</li>
31-
</ul>
32-
</div>
33-
<!----><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>
17+
<div class="ant-select ant-select-lg certain-category-search ant-select-lg ant-select-show-search ant-select-auto-complete ant-select-single ant-select-customize-input" style="width: 100%;">
18+
<!---->
19+
<!---->
20+
<div class="ant-select-selector"><span class="ant-select-selection-search"><span class="ant-select-selection-search-input ant-input-affix-wrapper"><!----><input type="search" id="rc_select_TEST_OR_SSR" autocomplete="off" class="ant-input" 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"><span class="ant-input-suffix"><!----><span role="img" aria-label="search" class="anticon anticon-search certain-category-icon"><svg class="" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896" focusable="false"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg></span></span></span></span>
21+
<!----><span class="ant-select-selection-placeholder">input here</span>
3422
</div>
23+
<!---->
24+
<!---->
3525
</div>
3626
</div>
3727
`;
3828

3929
exports[`renders ./antdv-demo/docs/auto-complete/demo/custom.md correctly 1`] = `
40-
<!---->
41-
<div style="width: 200px;" class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled" tabindex="0">
42-
<div role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" aria-controls="test-uuid" class="ant-select-selection ant-select-selection--single">
43-
<div class="ant-select-selection__rendered">
44-
<!---->
45-
<ul>
46-
<li class="ant-select-search ant-select-search--inline">
47-
<div class="ant-select-search__field__wrap"><textarea placeholder="input here" class="ant-input custom ant-select-search__field" style="height: 50px;"></textarea><span class="ant-select-search__field__mirror">&nbsp;</span></div>
48-
</li>
49-
</ul>
50-
</div>
51-
<!----><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>
30+
<div class="ant-select ant-select-show-search ant-select-auto-complete ant-select-single ant-select-customize-input" style="width: 200px;">
31+
<!---->
32+
<!---->
33+
<div class="ant-select-selector"><span class="ant-select-selection-search"><textarea placeholder="input here" class="ant-input ant-select-selection-search-input" style="height: 50px;" id="rc_select_TEST_OR_SSR" autocomplete="off" 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"></textarea></span>
34+
<!----><span class="ant-select-selection-placeholder"><!----></span>
5235
</div>
36+
<!---->
37+
<!---->
5338
</div>
5439
`;
5540

5641
exports[`renders ./antdv-demo/docs/auto-complete/demo/non-case-sensitive.md correctly 1`] = `
57-
<!---->
58-
<div style="width: 200px;" class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled" tabindex="0">
59-
<div role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" aria-controls="test-uuid" class="ant-select-selection ant-select-selection--single">
60-
<div class="ant-select-selection__rendered">
61-
<!---->
62-
<ul>
63-
<li class="ant-select-search ant-select-search--inline">
64-
<div class="ant-select-search__field__wrap"><input placeholder="input here" type="text" class="ant-input ant-select-search__field"><span class="ant-select-search__field__mirror">&nbsp;</span></div>
65-
</li>
66-
</ul>
67-
</div>
68-
<!----><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>
42+
<div class="ant-select ant-select-show-search ant-select-auto-complete ant-select-single ant-select-customize-input" style="width: 200px;">
43+
<!---->
44+
<!---->
45+
<div class="ant-select-selector"><span class="ant-select-selection-search"><input type="search" id="rc_select_TEST_OR_SSR" autocomplete="off" class="ant-input ant-select-selection-search-input" 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"></span>
46+
<!----><span class="ant-select-selection-placeholder">input here</span>
6947
</div>
48+
<!---->
49+
<!---->
7050
</div>
7151
`;
7252
7353
exports[`renders ./antdv-demo/docs/auto-complete/demo/options.md correctly 1`] = `
74-
<!---->
75-
<div style="width: 200px;" class="ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled" tabindex="0">
76-
<div role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" aria-controls="test-uuid" class="ant-select-selection ant-select-selection--single">
77-
<div class="ant-select-selection__rendered">
78-
<!---->
79-
<ul>
80-
<li class="ant-select-search ant-select-search--inline">
81-
<div class="ant-select-search__field__wrap"><input placeholder="input here" type="text" class="ant-input ant-select-search__field"><span class="ant-select-search__field__mirror">&nbsp;</span></div>
82-
</li>
83-
</ul>
84-
</div>
85-
<!----><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>
54+
<div class="ant-select ant-select-show-search ant-select-auto-complete ant-select-single ant-select-customize-input" style="width: 200px;">
55+
<!---->
56+
<!---->
57+
<div class="ant-select-selector"><span class="ant-select-selection-search"><input type="search" id="rc_select_TEST_OR_SSR" autocomplete="off" class="ant-input ant-select-selection-search-input" 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"></span>
58+
<!----><span class="ant-select-selection-placeholder">input here</span>
8659
</div>
60+
<!---->
61+
<!---->
8762
</div>
8863
`;
8964
9065
exports[`renders ./antdv-demo/docs/auto-complete/demo/uncertain-category.md correctly 1`] = `
9166
<div class="global-search-wrapper" style="width: 300px;">
92-
<!---->
93-
<div style="width: 100%;" class="global-search ant-select-lg ant-select-show-search ant-select-auto-complete ant-select-lg global-search ant-select-lg ant-select-show-search ant-select-auto-complete ant-select ant-select-combobox ant-select-enabled" tabindex="0">
94-
<div role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" aria-controls="test-uuid" class="ant-select-selection ant-select-selection--single">
95-
<div class="ant-select-selection__rendered">
96-
<!---->
97-
<ul>
98-
<li class="ant-select-search ant-select-search--inline">
99-
<div class="ant-select-search__field__wrap"><input placeholder="input here" type="text" class="ant-input ant-select-search__field"><span class="ant-select-search__field__mirror">&nbsp;</span></div>
100-
</li>
101-
</ul>
102-
</div>
103-
<!----><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>
67+
<div class="ant-select ant-select-lg global-search ant-select-lg ant-select-show-search ant-select-auto-complete ant-select-single ant-select-customize-input" style="width: 100%;">
68+
<!---->
69+
<!---->
70+
<div class="ant-select-selector"><span class="ant-select-selection-search"><input type="search" id="rc_select_TEST_OR_SSR" autocomplete="off" class="ant-input ant-select-selection-search-input" 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"></span>
71+
<!----><span class="ant-select-selection-placeholder">input here</span>
10472
</div>
73+
<!---->
74+
<!---->
10575
</div>
10676
</div>
10777
`;

components/auto-complete/__tests__/index.test.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { mount } from '@vue/test-utils';
2-
import * as Vue from 'vue';
2+
import { sleep } from '../../../tests/utils';
33
import AutoComplete from '..';
44
import focusTest from '../../../tests/shared/focusTest';
55

@@ -8,7 +8,7 @@ describe('AutoComplete with Custom Input Element Render', () => {
88
function $$(className) {
99
return document.body.querySelectorAll(className);
1010
}
11-
it('AutoComplete with custom Input render perfectly', done => {
11+
it('AutoComplete with custom Input render perfectly', async () => {
1212
const wrapper = mount(
1313
{
1414
render() {
@@ -25,9 +25,7 @@ describe('AutoComplete with Custom Input Element Render', () => {
2525
const input = wrapper.find('input');
2626
input.element.value = '123';
2727
input.trigger('input');
28-
Vue.nextTick(() => {
29-
expect($$('.ant-select-item-option').length).toBe(3);
30-
done();
31-
});
28+
await sleep();
29+
expect($$('.ant-select-item-option').length).toBe(3);
3230
});
3331
});

0 commit comments

Comments
 (0)