A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/testing-library/svelte-testing-library/issues/117 below:

How to test two way data-binding? · Issue #117 · testing-library/svelte-testing-library · GitHub

As far as I can tell, just passing in a variable into the render function doesn't enable two way data binding. Despite being an anti-pattern, two-way data binding is actually useful in a lot of cases, so it would be nice if there was a way to ensure that it works.

Edit:
I suppose you could also do something like

const utils = render(Input, { value: "" });
const component = utils.component.$$;
/*
* Update component such that value = asdf
*/
expect(component.ctx[component.props["value"]]).toBe("asdf")

But it's a bit repetitive and there's probably at least some justification in putting in a helper function into the library (since the framework supports it after all)

janosh, JPtenBerge, vdawg-git and efstajas


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4