-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Implement .collectWithParameters() and .collectAllParameters() #637
base: master
Are you sure you want to change the base?
Conversation
protected void collectAllParameters(final Collection<Param> result) { | ||
for (Param param : params) { | ||
if (param instanceof VarParam) { | ||
((VarParam) param).fn.collectAllParameters(result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this collecting nested hbars, for example {{#if (anotherHelper) }}
? or is this doing something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't seem to currently; an input of {{capitalize (lower firstName)}}
returns TagWithParams(capitalize, firstName, TagType.VAR)
If I include TagType.SUB_EXPRESSION
, it does work. Let me change the implementation to template.collectWithParameters(TagType.values())
@Test | ||
public void collectWithParamsForEachTest() throws IOException { | ||
List<TagWithParams> tagsWithParams = getTagsWithParameters("{{#each items as |item|}}{{i18n item}}{{/each}}"); | ||
assertEquals(tagsWithParams.size(), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm shouldn't there be two here? Tag("each", items)
and Tag("i18n", item)
?
Nice, this looks a lot more comprehensive than |
Guys, can you explain why do we need this? why existing implementation doesn't work? Also, I do a commit with a .jar file? Thanks |
Hey @jknack , we need this because we'd like to essentially verify some things before we render the In short: |
And no, we added the built |
can we add params to existing Tag class so we don't introduce a new TagWithParams class? Jar has been added to the pull with this commit. I can't merge this pull with the jar there |
Removed the jar |
@jknack not sure I follow; can you clarify? There doesn't seem to be an existing |
Codecov Report
@@ Coverage Diff @@
## master #637 +/- ##
=========================================
Coverage ? 87.21%
Complexity ? 863
=========================================
Files ? 79
Lines ? 3089
Branches ? 418
=========================================
Hits ? 2694
Misses ? 268
Partials ? 127 Continue to review full report at Codecov.
|
@jknack gentle bump; just want to make sure we're on the same page before writing more tests 👍 |
I thought there was a
With these changes a call to Cool? |
@jknack Reasons: |
Good stuff, let's make Param a public class. |
hey @jknack , finally got around to making the changes you suggested! let me know how it looks... I marked |
Create a new field for internal, unresolved storage
3651d7f
to
96e61bd
Compare
hey @jknack , wondering if you have any other thoughts/concerns about this PR, or if we could move it along somehow? thanks! |
P.S. I think since our last discussion, there's been an additional feature added - "internal data". This is so that special data can be passed along, that's not visible/accessible from the user's perspective, but helpers can access it. For instance, if a helper needs access to some special data called |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #637 +/- ##
============================================
- Coverage 87.30% 87.19% -0.11%
- Complexity 862 868 +6
============================================
Files 79 79
Lines 3079 3101 +22
Branches 437 419 -18
============================================
+ Hits 2688 2704 +16
- Misses 263 270 +7
+ Partials 128 127 -1 ☔ View full report in Codecov by Sentry. |
This PR implements
.collectWithParameters()
and.collectAllParameters()