This repository was archived by the owner on Jul 30, 2018. It is now read-only.
Add ability to mock meta providers#68
Merged
kitsonk merged 2 commits intodojo:masterfrom Oct 26, 2017
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #68 +/- ##
==========================================
+ Coverage 99.05% 99.08% +0.02%
==========================================
Files 10 10
Lines 637 653 +16
Branches 158 160 +2
==========================================
+ Hits 631 647 +16
Partials 6 6
Continue to review full report at Codecov.
|
[ci skip]
bitpshr
approved these changes
Oct 25, 2017
| * @param actual The render, just after `afterRender` | ||
| */ | ||
| actualRender(actual: DNode) { | ||
| public actualRender(actual: DNode) { |
Member
There was a problem hiding this comment.
Why does this have to be explicitly marked as public?
Member
Author
There was a problem hiding this comment.
It is unnecessary, though we have been trying to be more explicit in the visibility operators. I can remove it if it is a concern. I forgot I did it.
smhigley
approved these changes
Oct 25, 2017
Contributor
smhigley
left a comment
There was a problem hiding this comment.
The API looks good. This will make Listbox tests much prettier :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: feature
The following has been addressed in the PR:
Description:
This PR provides the ability to mock meta providers.
Allows for mocking of meta providers when testing a widget. The method
.mockMeta()takes two arguments, first the meta provider class and the second argument being a map of methods to mock on the provider when the harness widget is created.For example, to provide mocked
Dimensionsfor a widget:The handle returned from the
.mockMetafunction can be used to remove the mocks.To facilitate usage under TypeScript, there is a special context type (
MetaMockContext) that is exported from theharnessmodule. This is designed to represent the run-time context of the mock methods, which will allow access tothis.invalidate()andthis.getNode()which may be required to create an appropriate mock.For example, to invalidate a widget via the meta provider mock:
Resolves #65