You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
62 lines
1.7 KiB
4 years ago
|
import { mount } from 'enzyme';
|
||
|
import dropIndicatorRender, { offset } from '../utils/dropIndicator';
|
||
|
|
||
|
describe('dropIndicatorRender', () => {
|
||
|
it('work with dropPosition before (1)', () => {
|
||
|
const indicator = dropIndicatorRender({
|
||
|
dropPosition: 1,
|
||
|
dropLevelOffset: 0,
|
||
|
indent: 24,
|
||
|
prefixCls: 'ant',
|
||
|
direction: 'ltr',
|
||
|
});
|
||
|
const wrapper = mount(indicator);
|
||
|
expect(wrapper.props().style.bottom).toEqual(-3);
|
||
|
});
|
||
|
it('work with dropPosition inner (-0)', () => {
|
||
|
const indicator = dropIndicatorRender({
|
||
|
dropPosition: 0,
|
||
|
dropLevelOffset: 0,
|
||
|
indent: 24,
|
||
|
prefixCls: 'ant',
|
||
|
direction: 'ltr',
|
||
|
});
|
||
|
const wrapper = mount(indicator);
|
||
|
expect(wrapper.props().style.bottom).toEqual(-3);
|
||
|
expect(wrapper.props().style.left).toEqual(24 + offset);
|
||
|
});
|
||
|
it('work with dropPosition after (-1)', () => {
|
||
|
const indicator = dropIndicatorRender({
|
||
|
dropPosition: -1,
|
||
|
dropLevelOffset: 0,
|
||
|
indent: 24,
|
||
|
prefixCls: 'ant',
|
||
|
direction: 'ltr',
|
||
|
});
|
||
|
const wrapper = mount(indicator);
|
||
|
expect(wrapper.props().style.top).toEqual(-3);
|
||
|
});
|
||
|
it('work with drop level', () => {
|
||
|
const indicator = dropIndicatorRender({
|
||
|
dropPosition: -1,
|
||
|
dropLevelOffset: 2,
|
||
|
indent: 24,
|
||
|
prefixCls: 'ant',
|
||
|
direction: 'ltr',
|
||
|
});
|
||
|
const wrapper = mount(indicator);
|
||
|
expect(wrapper.props().style.left).toEqual(-2 * 24 + offset);
|
||
|
});
|
||
|
it('work with drop level (rtl)', () => {
|
||
|
const indicator = dropIndicatorRender({
|
||
|
dropPosition: -1,
|
||
|
dropLevelOffset: 2,
|
||
|
indent: 24,
|
||
|
prefixCls: 'ant',
|
||
|
direction: 'rtl',
|
||
|
});
|
||
|
const wrapper = mount(indicator);
|
||
|
expect(wrapper.props().style.right).toEqual(-2 * 24 + offset);
|
||
|
});
|
||
|
});
|