Skip to content

Commit

Permalink
test: test that $root emitted an event (#1078)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyerburgh committed Dec 24, 2018
1 parent a0528ca commit 92c3f71
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/specs/wrapper/emitted.spec.js
@@ -1,4 +1,4 @@
import { createLocalVue } from '~vue/test-utils'
import { createLocalVue, createWrapper } from '~vue/test-utils'
import { describeWithShallowAndMount, vueVersion } from '~resources/utils'
import { itDoNotRunIf } from 'conditional-specs'
import Vue from 'vue'
Expand Down Expand Up @@ -158,4 +158,14 @@ describeWithShallowAndMount('emitted', mountingMethod => {

expect(wrapper.find({ name: 'bar' }).emitted('foo')).to.exist
})

it('captures emitted events on $root instance', () => {
const wrapper = mountingMethod({
render: h => h('div')
})

wrapper.vm.$root.$emit('foo')
const rootWrapper = createWrapper(wrapper.vm.$root)
expect(rootWrapper.emitted('foo')).to.exist
})
})

0 comments on commit 92c3f71

Please sign in to comment.