Refactor the shared conditionals test cases#13047
Merged
chancancode merged 1 commit intomasterfrom Mar 3, 2016
Merged
Conversation
Member
Author
There was a problem hiding this comment.
@GavinJoyce I finally cracked the nut on how to test "without inverse" as part of the bigger test suite! The trick is to generate the if/unless as a pair, both without inverses. I think you can probably use this trick for the helpers too once you have implemented inline-unless.
1078159 to
4a3536b
Compare
Member
Author
There was a problem hiding this comment.
As per our usual protocol, we are supposed to be testing "update via mutation" and "reset via replacement" here.
ed573c3 to
8acd705
Compare
* Extract the apply “generators” logic into a more generic function
which allows us to pre-mix the BASIC_*_TESTS into a super class,
instead of having to repeat that every time you call `moduleFor`.
* Extend the “generators” concept to a more generic (very basic) mixin
system, which allows us to separate the test cases into groups.
* Instead of hard coding `true` and `false` inside the test cases, go
through a getter that can be overridden by the subclasses.
* Restructure the conditionals test classes to achieve better layering.
* Test `{{#if}}/{{#unless}}` without inverse as a “matrix item” instead
of a single test case which should give us better coverage. (The trick
is to generate them as a pair in `templateFor`.)
Most of these work is to make it possible to reuse the basic test cases
for `{{#each}}` tests, which will come in a different PR. This is needed
because `{{#each}}` has different rules about truthiness than the
“toggling” conditional constructs.
8acd705 to
84ac9b3
Compare
chancancode
added a commit
that referenced
this pull request
Mar 3, 2016
Refactor the shared conditionals test cases
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
BASIC_*_TESTSinto a super class, instead of having to repeat that every time you callmoduleFor.trueandfalseinside the test cases, go through a getter that can be overridden by the subclasses.{{#if}}/{{#unless}}without inverse as a “matrix item” instead of a single test case which should give us better coverage. (The trick is to generate them as a pair intemplateFor.)Most of these work is to make it possible to reuse the basic test cases for
{{#each}}tests, which will come in a different PR. This is needed because{{#each}}has different rules about truthiness than the “toggling” conditional constructs./cc @GavinJoyce @chadhietala @rwjblue