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
merged 3 commits into from Jan 9, 2019

Conversation

@matt-gadd
Copy link
Contributor

commented Jan 9, 2019

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

@agubler
agubler approved these changes Jan 9, 2019

@matt-gadd matt-gadd merged commit 48551cb into dojo:master Jan 9, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.