vant/packages/notice-bar/test/index.spec.js
2019-04-30 14:48:10 +08:00

31 lines
620 B
JavaScript

import NoticeBar from '..';
import { mount } from '../../../test/utils';
test('close event', () => {
const wrapper = mount(NoticeBar, {
propsData: {
mode: 'closeable'
}
});
const close = wrapper.find('.van-notice-bar__right-icon');
close.trigger('click');
expect(wrapper.emitted('close')).toBeTruthy();
});
test('left-icon slot', () => {
const wrapper = mount({
template: `
<notice-bar>
Content
<template v-slot:left-icon>Custom Left Icon</template>
</notice-bar>
`,
components: {
NoticeBar
}
});
expect(wrapper).toMatchSnapshot();
});