Skip to content
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

Assertion Templates #218

merged 3 commits into from Jan 9, 2019

Assertion Templates #218

merged 3 commits into from Jan 9, 2019


Copy link

Type: feature

The following has been addressed in the PR:

Asserting full render functions can be brittle and end up encapsulating lots of logic in tests. While asserting only portions of a render function does not potentially cover everything (because a render function is the smallest unit).

To solve the above problems, Assertion Templates allow the user to always assert against a full render, while allowing them to easily modify the assertion themselves per scenario.

The AssertionTemplate uses the existing selector api used elsewhere in harness, and supports an additional magic ~key selector which is erased on render, this allows the user to select nodes in the AssertionTemplate, without the key being in the actual render result itself.

The api for AssertionTemplate is very simple with the following api's:

  • getProperty - gets a property on a selected node
  • setProperty - sets a property on a selected node
  • getChildren - gets the children on a selected node
  • setChildren - sets the children on a selected node

AssertionTemplates are always immutable, setting a value will always result in a new AssertionTemplate being returned. This allows you to use assertions that build on top of other assertions.

Resolves #190

@matt-gadd matt-gadd merged commit 48551cb into dojo:master Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants