Pārlūkot izejas kodu

Dialog: ignore width when fullscreen is true (#12203)

hetech 7 gadi atpakaļ
vecāks
revīzija
484725b15f
2 mainītis faili ar 7 papildinājumiem un 5 dzēšanām
  1. 3 3
      packages/dialog/src/component.vue
  2. 4 2
      test/unit/specs/dialog.spec.js

+ 3 - 3
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;
       }

+ 4 - 2
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', () => {