Parcourir la source

test for wait-for static component

Evan You il y a 11 ans
Parent
commit
428bc4f72a
1 fichiers modifiés avec 16 ajouts et 1 suppressions
  1. 16 1
      test/unit/specs/directives/component_spec.js

+ 16 - 1
test/unit/specs/directives/component_spec.js

@@ -263,7 +263,22 @@ if (_.inBrowser) {
       expect(el.innerHTML).toBe('<ul><li>1</li><li>2</li></ul>')
     })
 
-    it('wait-for', function (done) {
+    it('wait-for for static component', function () {
+      var vm = new Vue({
+        el: el,
+        template: '<view-a wait-for="ok"></view-a>',
+        components: {
+          'view-a': {
+            template: 'AAA'
+          }
+        }
+      })
+      expect(el.textContent).toBe('')
+      vm._children[0].$emit('ok')
+      expect(el.textContent).toBe('AAA')
+    })
+
+    it('wait-for for dynamic components', function (done) {
       var vm = new Vue({
         el: el,
         data: {