Browse Source

Updates test for Transfer (removes snapshot)

pull/10728/merge
Eduardo Ludi 7 years ago
committed by 偏右
parent
commit
7f16ded760
  1. 187
      components/transfer/__tests__/__snapshots__/index.test.js.snap
  2. 20
      components/transfer/__tests__/index.test.js

187
components/transfer/__tests__/__snapshots__/index.test.js.snap

@ -1,192 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Transfer should add custom styles when their props are provided 1`] = `
<div
class="ant-transfer"
style="background-color:red"
>
<div
class="ant-transfer-list"
style="background-color:blue"
>
<div
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper"
>
<span
class="ant-checkbox ant-checkbox-checked"
>
<input
checked=""
class="ant-checkbox-input"
type="checkbox"
/>
<span
class="ant-checkbox-inner"
/>
</span>
</label>
<span
class="ant-transfer-list-header-selected"
>
<span>
1/2 items
</span>
<span
class="ant-transfer-list-header-title"
/>
</span>
</div>
<div
class="ant-transfer-list-body"
>
<ul
class="ant-transfer-list-content"
>
<li
class="ant-transfer-list-content-item"
>
<label
class="ant-checkbox-wrapper"
>
<span
class="ant-checkbox ant-checkbox-checked"
>
<input
checked=""
class="ant-checkbox-input"
type="checkbox"
/>
<span
class="ant-checkbox-inner"
/>
</span>
</label>
<span />
</li>
<li
class="ant-transfer-list-content-item ant-transfer-list-content-item-disabled"
>
<label
class="ant-checkbox-wrapper"
>
<span
class="ant-checkbox ant-checkbox-disabled"
>
<input
class="ant-checkbox-input"
disabled=""
type="checkbox"
/>
<span
class="ant-checkbox-inner"
/>
</span>
</label>
<span />
</li>
</ul>
<div
class="ant-transfer-list-body-not-found"
>
Not Found
</div>
</div>
</div>
<div
class="ant-transfer-operation"
style="background-color:yellow"
>
<button
class="ant-btn ant-btn-primary ant-btn-sm ant-btn-icon-only"
disabled=""
type="button"
>
<i
class="anticon anticon-left"
/>
</button>
<button
class="ant-btn ant-btn-primary ant-btn-sm ant-btn-icon-only"
type="button"
>
<i
class="anticon anticon-right"
/>
</button>
</div>
<div
class="ant-transfer-list"
style="background-color:blue"
>
<div
class="ant-transfer-list-header"
>
<label
class="ant-checkbox-wrapper"
>
<span
class="ant-checkbox"
>
<input
class="ant-checkbox-input"
type="checkbox"
/>
<span
class="ant-checkbox-inner"
/>
</span>
</label>
<span
class="ant-transfer-list-header-selected"
>
<span>
1 item
</span>
<span
class="ant-transfer-list-header-title"
/>
</span>
</div>
<div
class="ant-transfer-list-body"
>
<ul
class="ant-transfer-list-content"
>
<li
class="ant-transfer-list-content-item"
>
<label
class="ant-checkbox-wrapper"
>
<span
class="ant-checkbox"
>
<input
class="ant-checkbox-input"
type="checkbox"
/>
<span
class="ant-checkbox-inner"
/>
</span>
</label>
<span />
</li>
</ul>
<div
class="ant-transfer-list-body-not-found"
>
Not Found
</div>
</div>
</div>
</div>
`;
exports[`Transfer should render correctly 1`] = `
<div
class="ant-transfer"

20
components/transfer/__tests__/index.test.js

@ -260,18 +260,16 @@ describe('Transfer', () => {
backgroundColor: 'yellow',
};
const wrapper = render(<Transfer {...listCommonProps} style={style} listStyle={listStyle} operationStyle={operationStyle} />);
const component = mount(<Transfer {...listCommonProps} style={style} listStyle={listStyle} operationStyle={operationStyle} />);
const outterWrap = wrapper[0];
const listSource = outterWrap.children[0];
const operation = outterWrap.children[1];
const listTarget = outterWrap.children[2];
const wrapper = component.find('.ant-transfer');
const listSource = component.find('.ant-transfer-list').first();
const listTarget = component.find('.ant-transfer-list').last();
const operation = component.find('.ant-transfer-operation').first();
expect(outterWrap.attribs.style).toBe('background-color:red');
expect(listSource.attribs.style).toBe('background-color:blue');
expect(operation.attribs.style).toBe('background-color:yellow');
expect(listTarget.attribs.style).toBe('background-color:blue');
expect(wrapper).toMatchSnapshot();
expect(wrapper.prop('style')).toHaveProperty('backgroundColor', 'red');
expect(listSource.prop('style')).toHaveProperty('backgroundColor', 'blue');
expect(listTarget.prop('style')).toHaveProperty('backgroundColor', 'blue');
expect(operation.prop('style')).toHaveProperty('backgroundColor', 'yellow');
});
});

Loading…
Cancel
Save