Dialog: add destroyOnClose attribute (#16455)

* Dialog: add destroyOnClose attribute

* update
This commit is contained in:
hetech
2019-07-24 17:31:35 +08:00
committed by iamkun
parent 11bfd555b9
commit d238c768a6
7 changed files with 51 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
import { createVue, destroyVM } from '../util';
import { createVue, destroyVM, waitImmediate } from '../util';
describe('Dialog', () => {
let vm;
@@ -289,4 +289,31 @@ describe('Dialog', () => {
}, 500);
}, 10);
});
it('destroyOnClose', async() => {
vm = createVue({
template: `
<div>
<el-dialog :title="title" :visible.sync="visible" destroy-on-close>
<input />
</el-dialog>
</div>
`,
data() {
return {
title: 'dialog test',
visible: true
};
}
}, true);
const dialog = vm.$children[0];
await waitImmediate();
dialog.$el.querySelector('input').value = '123';
dialog.$el.click();
await waitImmediate();
vm.visible = true;
await waitImmediate();
expect(dialog.$el.querySelector('input').value).to.be.equal('');
});
});