From 484725b15fd93402c48fb42d1eb3691760c490c7 Mon Sep 17 00:00:00 2001 From: hetech Date: Thu, 2 Aug 2018 11:27:30 +0800 Subject: [PATCH] Dialog: ignore width when fullscreen is true (#12203) --- packages/dialog/src/component.vue | 6 +++--- test/unit/specs/dialog.spec.js | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/dialog/src/component.vue b/packages/dialog/src/component.vue index 879dd2106..e0dad52b2 100644 --- a/packages/dialog/src/component.vue +++ b/packages/dialog/src/component.vue @@ -129,11 +129,11 @@ computed: { style() { let style = {}; - if (this.width) { - style.width = this.width; - } if (!this.fullscreen) { style.marginTop = this.top; + if (this.width) { + style.width = this.width; + } } return style; } diff --git a/test/unit/specs/dialog.spec.js b/test/unit/specs/dialog.spec.js index bf12c29d1..9aea6a4a1 100644 --- a/test/unit/specs/dialog.spec.js +++ b/test/unit/specs/dialog.spec.js @@ -134,8 +134,10 @@ describe('Dialog', () => { }; it('fullscreen', () => { - vm = getDialogVm('fullscreen'); - expect(vm.$el.querySelector('.el-dialog').classList.contains('is-fullscreen')).to.true; + vm = getDialogVm('fullscreen width="40%"'); + const dialogEl = vm.$el.querySelector('.el-dialog'); + expect(dialogEl.classList.contains('is-fullscreen')).to.true; + expect(dialogEl.style.width).to.be.empty; }); it('top', () => {