Просмотр исходного кода

destroyed elements pass their styles onto others that are similar (#4232)

Dexter Miguel 9 лет назад
Родитель
Сommit
f80231773e
1 измененных файлов с 18 добавлено и 0 удалено
  1. 18 0
      test/unit/features/directives/style.spec.js

+ 18 - 0
test/unit/features/directives/style.spec.js

@@ -277,4 +277,22 @@ describe('Directive v-bind:style', () => {
       expect(style.marginLeft).toBe('40px')
     }).then(done)
   })
+
+  it('should not merge for different adjacent elements', (done) => {
+    const vm = new Vue({
+      template: '<div>' +
+                  '<section style="color: blue" v-if="!bool"></section>' +
+                  '<div></div>' +
+                  '<section style="margin: 0" v-if="bool"></section>' +
+                '</div>',
+      data: {
+        bool: false
+      }
+    }).$mount()
+    waitForUpdate(() => {
+      vm.bool = true
+    }).then(() => {
+      expect(vm.$el.children[1].style.color).not.toBe('blue')
+    }).then(done)
+  })
 })