Commit 939b77c4 authored by Paul Slaughter's avatar Paul Slaughter

Add Jest vue_mock_directive

**Why?**
- This is helpful at asserting that a specific value
  set on a specific directive of a component.
parent d12095b5
export const getKey = name => `$_gl_jest_${name}`;
export const getBinding = (el, name) => el[getKey(name)];
export const createMockDirective = () => ({
bind(el, { name, value, arg, modifiers }) {
el[getKey(name)] = {
value,
arg,
modifiers,
};
},
unbind(el, { name }) {
delete el[getKey(name)];
},
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment