[improvement] rename packages dir to src (#3659)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders demo correctly 1`] = `
|
||||
<div>
|
||||
<div>
|
||||
<div class="van-sidebar van-hairline--top-bottom"><a class="van-sidebar-item van-sidebar-item--select van-hairline">
|
||||
<div class="van-sidebar-item__text">标签名称
|
||||
<!---->
|
||||
</div>
|
||||
</a> <a class="van-sidebar-item van-hairline">
|
||||
<div class="van-sidebar-item__text">标签名称<div class="van-info van-sidebar-item__info">8</div>
|
||||
</div>
|
||||
</a> <a class="van-sidebar-item van-hairline">
|
||||
<div class="van-sidebar-item__text">标签名称<div class="van-info van-sidebar-item__info">99</div>
|
||||
</div>
|
||||
</a> <a class="van-sidebar-item van-hairline">
|
||||
<div class="van-sidebar-item__text">标签名称<div class="van-info van-sidebar-item__info">99+</div>
|
||||
</div>
|
||||
</a></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,4 @@
|
||||
import Demo from '../demo';
|
||||
import demoTest from '../../../test/demo-test';
|
||||
|
||||
demoTest(Demo);
|
||||
@@ -0,0 +1,39 @@
|
||||
import { mount } from '../../../test/utils';
|
||||
import Sidebar from '..';
|
||||
import SidebarItem from '../../sidebar-item';
|
||||
|
||||
test('event', () => {
|
||||
const onClick = jest.fn();
|
||||
const onChange = jest.fn();
|
||||
const wrapper = mount({
|
||||
template: `
|
||||
<sidebar @change="onChange">
|
||||
<sidebar-item @click="onClick">Text</sidebar-item>
|
||||
</sidebar>
|
||||
`,
|
||||
components: {
|
||||
Sidebar,
|
||||
SidebarItem
|
||||
},
|
||||
methods: {
|
||||
onClick,
|
||||
onChange
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.find('.van-sidebar-item').trigger('click');
|
||||
expect(onClick).toHaveBeenCalledWith(0);
|
||||
expect(onChange).toHaveBeenCalledWith(0);
|
||||
wrapper.vm.$destroy();
|
||||
});
|
||||
|
||||
test('without parent', () => {
|
||||
const consoleError = console.error;
|
||||
try {
|
||||
console.error = jest.fn();
|
||||
mount(Sidebar);
|
||||
} catch (err) {
|
||||
console.error = consoleError;
|
||||
expect(err).toBeTruthy();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user