I am using vue-i18n and the v-t directive. In my unit tests for my component, I would like to be able to test that the correct language key was supplied for the button (or other component).
I can mock out the $t function easily enough with:
config.mocks = {
$t: (key) => key
};
but I can't do the same thing with v-t. This doesn't fill the key into the innerText or innerHTML of the element:
localVue.directive('t', (el: HTMLElement, key: any) => {
return key.value;
});
Has anybody figured out how to mock the v-t directive to do something like this?
I am mounting (not shallowMount'ing) the component under test.