test: add tranfer test
							parent
							
								
									3e22aab799
								
							
						
					
					
						commit
						e74d3495d1
					
				| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
 | 
			
		||||
 | 
			
		||||
exports[`List should render correctly 1`] = `
 | 
			
		||||
<div class="ant-transfer-list">
 | 
			
		||||
  <div class="ant-transfer-list-header">
 | 
			
		||||
    <label class="ant-checkbox-wrapper"><span class="ant-checkbox ant-checkbox-indeterminate"><input type="checkbox" class="ant-checkbox-input"><span class="ant-checkbox-inner"></span></span>
 | 
			
		||||
    </label><span class="ant-transfer-list-header-selected"><span>1/3 </span><span class="ant-transfer-list-header-title"></span></span>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="ant-transfer-list-body"><span tag="div" class="ant-transfer-list-content-warp"><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 type="checkbox" checked="checked" class="ant-checkbox-input"><span class="ant-checkbox-inner"></span></span>
 | 
			
		||||
    </label><span></span></li>
 | 
			
		||||
    <li class="ant-transfer-list-content-item">
 | 
			
		||||
      <label class="ant-checkbox-wrapper"><span class="ant-checkbox"><input type="checkbox" class="ant-checkbox-input"><span class="ant-checkbox-inner"></span></span>
 | 
			
		||||
      </label><span></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 type="checkbox" disabled="disabled" class="ant-checkbox-input"><span class="ant-checkbox-inner"></span></span>
 | 
			
		||||
      </label><span></span></li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    </span>
 | 
			
		||||
    <div class="ant-transfer-list-body-not-found">Not Found</div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
`;
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
import { mount } from '@vue/test-utils'
 | 
			
		||||
import { renderToString } from '@vue/server-test-utils'
 | 
			
		||||
import List from '../list'
 | 
			
		||||
 | 
			
		||||
const listCommonProps = {
 | 
			
		||||
  prefixCls: 'ant-transfer-list',
 | 
			
		||||
  dataSource: [{
 | 
			
		||||
    key: 'a',
 | 
			
		||||
    title: 'a',
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'b',
 | 
			
		||||
    title: 'b',
 | 
			
		||||
  }, {
 | 
			
		||||
    key: 'c',
 | 
			
		||||
    title: 'c',
 | 
			
		||||
    disabled: true,
 | 
			
		||||
  }],
 | 
			
		||||
  checkedKeys: ['a'],
 | 
			
		||||
  notFoundContent: 'Not Found',
 | 
			
		||||
  lazy: false,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
describe('List', () => {
 | 
			
		||||
  it('should render correctly', () => {
 | 
			
		||||
    const props = {
 | 
			
		||||
      propsData: listCommonProps,
 | 
			
		||||
    }
 | 
			
		||||
    const wrapper = renderToString(List, props)
 | 
			
		||||
    expect(wrapper).toMatchSnapshot()
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should check top Checkbox while all available items are checked', () => {
 | 
			
		||||
    const props = {
 | 
			
		||||
      propsData: {
 | 
			
		||||
        ...listCommonProps,
 | 
			
		||||
        checkedKeys: ['a', 'b'],
 | 
			
		||||
      },
 | 
			
		||||
    }
 | 
			
		||||
    const wrapper = mount(List, props)
 | 
			
		||||
    expect(wrapper.find('.ant-transfer-list-header').find({
 | 
			
		||||
      name: 'ACheckbox',
 | 
			
		||||
    }).props().checked)
 | 
			
		||||
      .toBeTruthy()
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
import { mount } from '@vue/test-utils'
 | 
			
		||||
import { renderToString } from '@vue/server-test-utils'
 | 
			
		||||
import Search from '../search'
 | 
			
		||||
 | 
			
		||||
describe('Search', () => {
 | 
			
		||||
  it('should show cross icon when input value exists', () => {
 | 
			
		||||
    const wrapper = mount(Search)
 | 
			
		||||
 | 
			
		||||
    expect(wrapper).toMatchSnapshot()
 | 
			
		||||
 | 
			
		||||
    wrapper.setProps({ value: 'a' })
 | 
			
		||||
 | 
			
		||||
    expect(wrapper).toMatchSnapshot()
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
		Loading…
	
		Reference in New Issue