mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
Add some tests
This commit is contained in:
parent
ba7b7d0d6b
commit
07d6988f0d
@ -214,3 +214,29 @@ exports[`Cascader popup correctly with defaultValue 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`Cascader support controlled mode 1`] = `
|
||||
<span
|
||||
class="ant-cascader-picker"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="ant-cascader-picker-label"
|
||||
>
|
||||
Zhejiang / Hangzhou / West Lake
|
||||
</span>
|
||||
<input
|
||||
autocomplete="off"
|
||||
class="ant-input ant-cascader-input "
|
||||
readonly=""
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
<i
|
||||
class="anticon anticon-cross-circle ant-cascader-picker-clear"
|
||||
/>
|
||||
<i
|
||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||
/>
|
||||
</span>
|
||||
`;
|
||||
|
@ -46,6 +46,16 @@ describe('Cascader', () => {
|
||||
expect(render(wrapper.find('Trigger').instance().getComponent())).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('support controlled mode', () => {
|
||||
const wrapper = mount(
|
||||
<Cascader options={options} />
|
||||
);
|
||||
wrapper.setProps({
|
||||
value: ['zhejiang', 'hangzhou', 'xihu'],
|
||||
});
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('popup correctly with defaultValue', () => {
|
||||
const wrapper = mount(
|
||||
<Cascader options={options} defaultValue={['zhejiang', 'hangzhou']} />
|
||||
|
4
components/input-number/__tests__/index.test.js
Normal file
4
components/input-number/__tests__/index.test.js
Normal file
@ -0,0 +1,4 @@
|
||||
import InputNumber from '..';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
|
||||
focusTest(InputNumber);
|
43
components/slider/__tests__/__snapshots__/index.test.js.snap
Normal file
43
components/slider/__tests__/__snapshots__/index.test.js.snap
Normal file
@ -0,0 +1,43 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Slider should show tooltip when hovering slider handler 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="ant-tooltip ant-tooltip-placement-top "
|
||||
>
|
||||
<div
|
||||
class="ant-tooltip-content"
|
||||
>
|
||||
<div
|
||||
class="ant-tooltip-arrow"
|
||||
/>
|
||||
<div
|
||||
class="ant-tooltip-inner"
|
||||
>
|
||||
30
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`Slider should show tooltip when hovering slider handler 2`] = `
|
||||
<div>
|
||||
<div
|
||||
class="ant-tooltip ant-tooltip-placement-top ant-tooltip-hidden"
|
||||
>
|
||||
<div
|
||||
class="ant-tooltip-content"
|
||||
>
|
||||
<div
|
||||
class="ant-tooltip-arrow"
|
||||
/>
|
||||
<div
|
||||
class="ant-tooltip-inner"
|
||||
>
|
||||
30
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
15
components/slider/__tests__/index.test.js
Normal file
15
components/slider/__tests__/index.test.js
Normal file
@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
import { render, mount } from 'enzyme';
|
||||
import Slider from '..';
|
||||
|
||||
describe('Slider', () => {
|
||||
it('should show tooltip when hovering slider handler', () => {
|
||||
const wrapper = mount(
|
||||
<Slider defaultValue={30} />
|
||||
);
|
||||
wrapper.find('.ant-slider-handle').at(0).simulate('mouseEnter');
|
||||
expect(render(wrapper.find('Trigger').instance().getComponent())).toMatchSnapshot();
|
||||
wrapper.find('.ant-slider-handle').at(0).simulate('mouseLeave');
|
||||
expect(render(wrapper.find('Trigger').instance().getComponent())).toMatchSnapshot();
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user