feat(Dialog): add open、close event (#4633)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
import Dialog from '..';
|
||||
import DialogVue from '../Dialog';
|
||||
import DialogComponent from '../Dialog';
|
||||
import { mount, later, trigger } from '../../../test/utils';
|
||||
|
||||
test('Dialog function call', async () => {
|
||||
@@ -33,7 +33,7 @@ test('Dialog function call', async () => {
|
||||
});
|
||||
|
||||
test('before close', () => {
|
||||
const wrapper = mount(DialogVue, {
|
||||
const wrapper = mount(DialogComponent, {
|
||||
propsData: {
|
||||
value: true,
|
||||
showCancelButton: true,
|
||||
@@ -72,11 +72,11 @@ test('set default options', () => {
|
||||
|
||||
test('register component', () => {
|
||||
Vue.use(Dialog);
|
||||
expect(Vue.component(DialogVue.name)).toBeTruthy();
|
||||
expect(Vue.component(DialogComponent.name)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('button color', () => {
|
||||
const wrapper = mount(DialogVue, {
|
||||
const wrapper = mount(DialogComponent, {
|
||||
propsData: {
|
||||
value: true,
|
||||
showCancelButton: true,
|
||||
@@ -88,7 +88,7 @@ test('button color', () => {
|
||||
});
|
||||
|
||||
test('button text', () => {
|
||||
const wrapper = mount(DialogVue, {
|
||||
const wrapper = mount(DialogComponent, {
|
||||
propsData: {
|
||||
value: true,
|
||||
showCancelButton: true,
|
||||
@@ -100,11 +100,11 @@ test('button text', () => {
|
||||
});
|
||||
|
||||
test('dialog component', () => {
|
||||
expect(Dialog.Component).toEqual(DialogVue);
|
||||
expect(Dialog.Component).toEqual(DialogComponent);
|
||||
});
|
||||
|
||||
test('default slot', () => {
|
||||
const wrapper = mount(DialogVue, {
|
||||
const wrapper = mount(DialogComponent, {
|
||||
propsData: {
|
||||
value: true
|
||||
},
|
||||
@@ -116,7 +116,7 @@ test('default slot', () => {
|
||||
});
|
||||
|
||||
test('title slot', () => {
|
||||
const wrapper = mount(DialogVue, {
|
||||
const wrapper = mount(DialogComponent, {
|
||||
propsData: {
|
||||
value: true
|
||||
},
|
||||
@@ -126,3 +126,11 @@ test('title slot', () => {
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('open & close event', () => {
|
||||
const wrapper = mount(DialogComponent);
|
||||
wrapper.vm.value = true;
|
||||
expect(wrapper.emitted('open')).toBeTruthy();
|
||||
wrapper.vm.value = false;
|
||||
expect(wrapper.emitted('close')).toBeTruthy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user