test for iframe v-on

This commit is contained in:
Evan You 2014-09-17 11:47:31 -04:00
parent 5a68ab8412
commit 69d33e4591
1 changed files with 18 additions and 1 deletions

View File

@ -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)
})
})