mustache / spec

The Mustache spec.
MIT License
364 stars 71 forks source link

Add a test for not interpolating rendered section output #32

Open cjerdonek opened 12 years ago

cjerdonek commented 12 years ago

In contrast to lambda return values, the output of rendering a section should not be parsed. I think a test case would be helpful here to draw a distinction with that behavior. Test case included.

The attached test case would also clarify that nested sections should be evaluated "outside-in" rather than "inside-out." For example--

data: { outer: true, inner: true, template: '{{planet}}', planet: 'Earth'}
template: '{{#outer}}{{planet}} : Interpolate? {{#inner}}{{template}}{{/inner}}{{/outer}}'
groue commented 12 years ago

Very interesting test, quite related to issue #19.

pvande commented 12 years ago

Good catch on both this and #31; the latter is covered implicitly (read: accidentally) by the specs for dotted names, but both of these are clearly oversights in the spec at large. I'll get these merged into both the v1.0.x and v1.1.x specs soon.

Thanks!

cjerdonek commented 12 years ago

Thanks, @pvande and @groue. groue, on the subject of related issues, I arrived at this test case in the process of thinking about issue #30 -- specifically the order in which lambdas should be evaluated that occur in nested sections (descending towards the leaves in the depth-first traversal or ascending up from them).

I may have one more test case to offer that is similarly related -- on the subject of lambdas.