test: update snap

refactor-list
tangjinzhou 2021-06-21 14:23:55 +08:00
parent 1cd6e94408
commit 276e4ec250
6 changed files with 53 additions and 54 deletions

View File

@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Radio should render correctly 1`] = `<label class="ant-radio-wrapper customized"><span class="ant-radio"><input type="radio" class="ant-radio-input" value=""><span class="ant-radio-inner"></span></span><span>Test</span></label>`; exports[`Radio should render correctly 1`] = `<label class="ant-radio-wrapper customized"><span class="ant-radio"><input type="radio" class="ant-radio-input"><span class="ant-radio-inner"></span></span><span>Test</span></label>`;

View File

@ -6,7 +6,7 @@ exports[`Select Select Custom Icons should support customized icons 1`] = `
<!----> <!---->
<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> <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-placeholder"><!----></span> <!----><span class="ant-select-selection-placeholder"><!----></span>
</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> </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 focusable="false" class="" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896"><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>
<!----> <!---->
</div> </div>
`; `;

View File

@ -29,13 +29,17 @@ describe('Select', () => {
}); });
it('should have default notFoundContent', async () => { it('should have default notFoundContent', async () => {
const wrapper = mount(Select, { const wrapper = mount(
props: { {
mode: 'multiple', render() {
return <Select mode="multiple" />;
}, },
},
{
sync: false, sync: false,
attachTo: 'body', attachTo: 'body',
}); },
);
await asyncExpect(() => { await asyncExpect(() => {
wrapper.findAll('.ant-select-selector')[0].element.dispatchEvent(new MouseEvent('mousedown')); wrapper.findAll('.ant-select-selector')[0].element.dispatchEvent(new MouseEvent('mousedown'));
}); });
@ -47,14 +51,17 @@ describe('Select', () => {
}); });
it('should support set notFoundContent to null', async () => { it('should support set notFoundContent to null', async () => {
const wrapper = mount(Select, { const wrapper = mount(
props: { {
mode: 'multiple', render() {
notFoundContent: null, return <Select mode="multiple" notFoundContent={null} />;
}, },
},
{
sync: false, sync: false,
attachTo: 'body', attachTo: 'body',
}); },
);
await asyncExpect(() => { await asyncExpect(() => {
wrapper.findAll('.ant-select-selector')[0].element.dispatchEvent(new MouseEvent('mousedown')); wrapper.findAll('.ant-select-selector')[0].element.dispatchEvent(new MouseEvent('mousedown'));
}); });
@ -65,13 +72,17 @@ describe('Select', () => {
}); });
it('should not have default notFoundContent when mode is combobox', async () => { it('should not have default notFoundContent when mode is combobox', async () => {
const wrapper = mount(Select, { const wrapper = mount(
props: { {
mode: Select.SECRET_COMBOBOX_MODE_DO_NOT_USE, render() {
return <Select mode={Select.SECRET_COMBOBOX_MODE_DO_NOT_USE} />;
}, },
},
{
sync: false, sync: false,
attachTo: 'body', attachTo: 'body',
}); },
);
await asyncExpect(() => { await asyncExpect(() => {
wrapper.findAll('.ant-select-selector')[0].element.dispatchEvent(new MouseEvent('mousedown')); wrapper.findAll('.ant-select-selector')[0].element.dispatchEvent(new MouseEvent('mousedown'));
}); });
@ -82,13 +93,18 @@ describe('Select', () => {
}); });
it('should not have notFoundContent when mode is combobox and notFoundContent is set', async () => { it('should not have notFoundContent when mode is combobox and notFoundContent is set', async () => {
const wrapper = mount(Select, { const wrapper = mount(
props: { {
mode: Select.SECRET_COMBOBOX_MODE_DO_NOT_USE, render() {
notFoundContent: 'not at all', return (
<Select mode={Select.SECRET_COMBOBOX_MODE_DO_NOT_USE} notFoundContent="not at all" />
);
}, },
},
{
sync: false, sync: false,
}); },
);
await asyncExpect(() => { await asyncExpect(() => {
wrapper.findAll('.ant-select-selector')[0].element.dispatchEvent(new MouseEvent('mousedown')); wrapper.findAll('.ant-select-selector')[0].element.dispatchEvent(new MouseEvent('mousedown'));
}); });

View File

@ -1,10 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Space should render correct with children 1`] = ` exports[`Space should render correct with children 1`] = `
<div class="ant-space ant-space-horizontal ant-space-align-center"> <div class="ant-space ant-space-horizontal ant-space-align-center" style="column-gap: 8px; row-gap: 8px;">
<div class="ant-space-item" style="margin-right: 8px;">text1</div> <div class="ant-space-item">text1</div>
<div class="ant-space-item" style="margin-right: 8px;"><span>text1</span></div> <!---->
<div class="ant-space-item"><span>text1</span></div>
<!---->
<div class="ant-space-item">text3</div> <div class="ant-space-item">text3</div>
<!---->
</div> </div>
`; `;

View File

@ -25,8 +25,8 @@ describe('Space', () => {
); );
}, },
}); });
expect(wrapper.findAll('.ant-space-item')[0].element.style.marginRight).toBe('10px'); expect(wrapper.find('.ant-space').element.style.columnGap).toBe('10px');
expect(wrapper.findAll('.ant-space-item')[1].element.style.marginRight).toBeFalsy(); expect(wrapper.find('.ant-space').element.style.rowGap).toBe('10px');
}); });
it('should render vertical space width customize size', () => { it('should render vertical space width customize size', () => {
@ -40,9 +40,8 @@ describe('Space', () => {
); );
}, },
}); });
expect(wrapper.find('.ant-space').element.style.columnGap).toBe('10px');
expect(wrapper.findAll('.ant-space-item')[0].element.style.marginBottom).toBe('10px'); expect(wrapper.find('.ant-space').element.style.rowGap).toBe('10px');
expect(wrapper.findAll('.ant-space-item')[1].element.style.marginBottom).toBeFalsy();
}); });
it('should render correct with children', () => { it('should render correct with children', () => {

View File

@ -88,25 +88,6 @@ describe('Statistic', () => {
expect(wrapper.find('.ant-statistic-content-value').text()).toEqual(value); expect(wrapper.find('.ant-statistic-content-value').text()).toEqual(value);
}); });
}); });
it('time going', async () => {
const now = Date.now() + 1000;
const props = {
props: {
value: now,
},
};
const wrapper = mount(Statistic.Countdown, props);
// setInterval should work
const instance = wrapper.vm;
expect(instance.countdownId).not.toBe(undefined);
// await delay(50);
// wrapper.unmount();
// expect(instance.countdownId).toBe(undefined);
});
}); });
describe('utils', () => { describe('utils', () => {
it('format should support escape', () => { it('format should support escape', () => {