I have a component that watches a data object suggestions. When I mount the component and then call wrapper.setData({ suggestions: [] }); the watcher does not fire, as I put a console.log on the watcher to verify. If I set the watcher to be "immediate: true" then it will fire once. Is there something else I should do to trigger the watcher in a testing environment? I tried wrapper.vm.$nextTick to no avail.
const defaultProps = {
suggestions: [
{
data: ["clifford kits", "friendly chemistry", "phonics"]
}
],
inputProps: {
id: "autosuggest__input"
}
};
it("can render suggestions", async () => {
const wrapper = mount(Autosuggest, {
propsData: defaultProps
});
const input = wrapper.find("input");
expect(input.hasAttribute("id", defaultProps.inputProps.id));
input.trigger("click");
wrapper.setData({
searchInput: "G",
suggestions: [
{
data: ["friendly chemistry", "phonics"]
}
]
});
input.trigger("keydown.down");
const renderer = createRenderer();
renderer.renderToString(wrapper.vm, (err, str) => {
expect(str).toMatchSnapshot();
});
});
Thanks for the bug report 馃榾
I've added a fix in the dev branch. It will be released in beta.5
Same issue here using setComputed(). It is related?
Yes :P, sorry. Can you make a new issue @disitec
@eddyerburgh has the setComputed been fixed already?
If not then i'll open an issue
+1
Sorry for the delay guys, I saw this an forgot to reply.
I've updated setComputed to run the correct watchers. It'll be released in beta.7 in the next couple of days 馃檪
Most helpful comment
Sorry for the delay guys, I saw this an forgot to reply.
I've updated setComputed to run the correct watchers. It'll be released in beta.7 in the next couple of days 馃檪