Ver Fonte

Merge pull request #518 from HugoDF/add-x-bind

new `x-bind` to object: fix transitions + tests
Caleb Porzio há 5 anos atrás
pai
commit
c681cf9ec0
2 ficheiros alterados com 4 adições e 4 exclusões
  1. 2 2
      src/directives/for.js
  2. 2 2
      test/bind.spec.js

+ 2 - 2
src/directives/for.js

@@ -36,7 +36,7 @@ export function handleForDirective(component, templateEl, expression, initialUpd
         currentEl.__x_for_key = currentKey
     })
 
-    removeAnyLeftOverElementsFromPreviousUpdate(currentEl)
+    removeAnyLeftOverElementsFromPreviousUpdate(currentEl, component)
 }
 
 // This was taken from VueJS 2.* core. Thanks Vue!
@@ -126,7 +126,7 @@ function lookAheadForMatchingKeyedElementAndMoveItIfFound(nextEl, currentKey) {
     }
 }
 
-function removeAnyLeftOverElementsFromPreviousUpdate(currentEl) {
+function removeAnyLeftOverElementsFromPreviousUpdate(currentEl, component) {
     var nextElementFromOldLoop = (currentEl.nextElementSibling && currentEl.nextElementSibling.__x_for_key !== undefined) ? currentEl.nextElementSibling : false
 
     while (nextElementFromOldLoop) {

+ 2 - 2
test/bind.spec.js

@@ -449,10 +449,10 @@ test('can bind an object of directives', async () => {
         return {
             show: false,
             trigger: {
-                '@click'() { this.show = ! this.show }
+                '@click': function () { this.show = ! this.show }
             },
             dialogue: {
-                'x-show'() { return this.show }
+                ['x-show']() { return this.show }
             },
         }
     }