Skip to content

Conversation

@matt-gadd
Copy link
Contributor

Type: feature

The following has been addressed in the PR:

Description:
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants