element-ui/test/unit/specs/page-header.spec.js
2021-06-07 11:56:04 +08:00

25 lines
541 B
Vue

import { createVue, destroyVM, waitImmediate } from '../util';
import PageHeader from 'packages/page-header';
describe('PageHeader', () => {
let vm;
afterEach(() => {
destroyVM(vm);
});
it('render well and trigger back event', async() => {
vm = createVue(PageHeader, {
content: 'content'
});
expect(vm.$el).to.exist;
const spy = sinon.spy();
vm.$on('back', spy);
vm.$el.querySelector('.el-page-header__left').click();
await waitImmediate();
expect(spy.calledOnce).to.be.true;
});
});