Evan You 11 лет назад
Родитель
Сommit
69d33e4591
1 измененных файлов с 18 добавлено и 1 удалено
  1. 18 1
      test/unit/specs/directives/on_spec.js

+ 18 - 1
test/unit/specs/directives/on_spec.js

@@ -80,7 +80,24 @@ if (_.inBrowser) {
     })
 
     it('iframe', function () {
-      // TODO
+      // iframes only gets contentWindow when inserted
+      // into the document
+      document.body.appendChild(el)
+      var spy = jasmine.createSpy()
+      var vm = new Vue({
+        el: el,
+        template: '<iframe v-on="click:test"></iframe>',
+        methods: {
+          test: spy
+        }
+      })
+      var iframeDoc = el.firstChild.contentDocument
+      trigger(iframeDoc, 'click')
+      expect(spy.calls.count()).toBe(1)
+      vm.$destroy()
+      trigger(iframeDoc, 'click')
+      expect(spy.calls.count()).toBe(1)
+      document.body.removeChild(el)
     })
 
   })