Przeglądaj źródła

test for this.$data access in the created hook

Evan You 12 lat temu
rodzic
commit
ca2137d942
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      test/unit/specs/api.js

+ 6 - 1
test/unit/specs/api.js

@@ -923,10 +923,15 @@ describe('API', function () {
 
                 describe('created', function () {
                 
-                    it('should be called before compile', function () {
+                    it('should be called before compile and give access to all vm properties', function () {
                         
                         var called = false,
                             Test = Vue.extend({ created: function () {
+                                assert.ok(this.$data)
+                                assert.ok(this.$el)
+                                assert.ok(this.$)
+                                assert.ok(this.$compiler)
+                                assert.ok(this.$root)
                                 assert.ok(this.$options.ok)
                                 called = true
                             }})