-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve unit testing of Widgets #66
Comments
As well as this, it might be nice to build into the harness higher level support for asserting If we assert against const todos = [
{ id: 1, label: 'foo' },
{ id: 2, label: 'bar' }
];
const result = testWrapper(() => w(TodoList, { todos }));
assert.isTrue(result.equals(() => {
return v('ul', { classes: { 'todo-list': true } }, [
w(TodoItem, { key: 1, label: 'foo', completed: false }),
w(TodoItem, { key: 2, label: 'bar', completed: false })
]);
})); |
Good thoughts. I guess though it needs to be permissive. For example if there are additional attributes, like event handlers, the harness won't have access to those references. So either only report missing values or allowing non-primitive equality for certain properties. The thing too that we would want to avoid with something like that is people just copypasta their render function. |
Indeed. It would be similar to sinon's |
Is there overlap here with dojo/meta#131? |
That is where the PR will be raised for this. We will reference back to this issue from that repo, but we haven't published |
👍 gotcha |
@kitsonk can this be closed now given the test-extras and harness work? |
Agreed. |
Enhancement
We need a good set of unit tests for a widget, that can be run against a virtual DOM (e.g. JSDOM) as well as a unit test in the native DOM without being a functional test. We should only use intended public APIs and generate the events/use synthetic events to drive the tests instead of relying upon driving functionality to provide full unit coverage of the widgets.
The text was updated successfully, but these errors were encountered: