mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-10-31 11:32:09 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			48 lines
		
	
	
		
			967 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			967 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import Icon from '..';
 | |
| import { mount } from '../../../test/utils';
 | |
| 
 | |
| test('render icon with builtin icon name', () => {
 | |
|   const wrapper = mount(Icon, {
 | |
|     propsData: {
 | |
|       name: 'success'
 | |
|     }
 | |
|   });
 | |
|   expect(wrapper).toMatchSnapshot();
 | |
| });
 | |
| 
 | |
| test('render icon with url name', () => {
 | |
|   const wrapper = mount(Icon, {
 | |
|     propsData: {
 | |
|       name: 'https://img.yzcdn.com/icon.jpg'
 | |
|     }
 | |
|   });
 | |
|   expect(wrapper).toMatchSnapshot();
 | |
| });
 | |
| 
 | |
| test('render icon with local image', () => {
 | |
|   const wrapper = mount(Icon, {
 | |
|     propsData: {
 | |
|       name: '/assets/icon.jpg'
 | |
|     }
 | |
|   });
 | |
|   expect(wrapper).toMatchSnapshot();
 | |
| });
 | |
| 
 | |
| test('render icon default slot', () => {
 | |
|   const wrapper = mount({
 | |
|     render(h) {
 | |
|       return h(Icon, { props: { name: 'success' } }, ['Default slot']);
 | |
|     }
 | |
|   });
 | |
|   expect(wrapper).toMatchSnapshot();
 | |
| });
 | |
| 
 | |
| test('tag prop', () => {
 | |
|   const wrapper = mount(Icon, {
 | |
|     propsData: {
 | |
|       tag: 'div'
 | |
|     }
 | |
|   });
 | |
|   expect(wrapper).toMatchSnapshot();
 | |
| });
 |