2020-06-23 00:09:42 +05:30
|
|
|
export const getKey = name => `$_gl_jest_${name}`;
|
|
|
|
|
|
|
|
export const getBinding = (el, name) => el[getKey(name)];
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
const writeBindingToElement = (el, { name, value, arg, modifiers }) => {
|
|
|
|
el[getKey(name)] = {
|
|
|
|
value,
|
|
|
|
arg,
|
|
|
|
modifiers,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
export const createMockDirective = () => ({
|
2020-07-28 23:09:34 +05:30
|
|
|
bind(el, binding) {
|
|
|
|
writeBindingToElement(el, binding);
|
|
|
|
},
|
|
|
|
|
|
|
|
update(el, binding) {
|
|
|
|
writeBindingToElement(el, binding);
|
2020-06-23 00:09:42 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
unbind(el, { name }) {
|
|
|
|
delete el[getKey(name)];
|
|
|
|
},
|
|
|
|
});
|