diff --git a/test/components.test.js b/test/components.test.js
index 9ad7d52..6ac9c24 100644
--- a/test/components.test.js
+++ b/test/components.test.js
@@ -4,6 +4,7 @@ import { mount, defaultOptions, loadVueMetaPlugin } from './utils'
import GoodbyeWorld from './fixtures/goodbye-world.vue'
import HelloWorld from './fixtures/hello-world.vue'
import KeepAlive from './fixtures/keep-alive.vue'
+import Changed from './fixtures/changed.vue'
const getMetaInfo = component => _getMetaInfo(defaultOptions, component)
@@ -76,4 +77,21 @@ describe('client', () => {
const metaInfo = wrapper.vm.$meta().inject()
expect(metaInfo.title.text()).toEqual('
Hello World')
})
+
+ test('changed function is called', () => {
+ const parentComponent = new Vue({ render: h => h('div') })
+ const wrapper = mount(Changed, { localVue: Vue, parentComponent })
+
+ let context
+ const changed = jest.fn(function() {
+ context = this
+ })
+ wrapper.setData({ changed })
+ wrapper.setData({ childVisible: true })
+
+ wrapper.vm.$parent.$meta().refresh()
+ expect(changed).toHaveBeenCalledTimes(1)
+ // TODO: this isnt what the docs say
+ expect(context._uid).not.toBe(wrapper.vm._uid)
+ })
})
diff --git a/test/fixtures/changed.vue b/test/fixtures/changed.vue
new file mode 100644
index 0000000..20a6de5
--- /dev/null
+++ b/test/fixtures/changed.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+