Browse Source

test for vm.$nextTick

Evan You 11 years ago
parent
commit
78f3a7cbe0
1 changed files with 19 additions and 0 deletions
  1. 19 0
      test/unit/specs/api/dom_spec.js

+ 19 - 0
test/unit/specs/api/dom_spec.js

@@ -178,5 +178,24 @@ if (_.inBrowser) {
 
 
     })
     })
 
 
+    describe('$nextTick', function () {
+
+      it('should work', function (done) {
+        var context
+        var called = false
+        vm.$nextTick(function () {
+          called = true
+          context = this
+        })
+        expect(called).toBe(false)
+        _.nextTick(function () {
+          expect(called).toBe(true)
+          expect(context).toBe(vm)
+          done()
+        })
+      })
+
+    })
+
   })
   })
 }
 }