File tree Expand file tree Collapse file tree 2 files changed +34
-3
lines changed
main/java/com/github/jknack/handlebars
test/java/com/github/jknack/handlebars/issues Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -1254,7 +1254,8 @@ public Handlebars parentScopeResolution(final boolean parentScopeResolution) {
1254
1254
* <pre>
1255
1255
* {{> @partial-block}}
1256
1256
* </pre>
1257
- * Attention: If this is set to true, Handlebars works *much* slower!
1257
+ * Attention: If this is set to true, Handlebars works *much* slower! while rendering
1258
+ * partial blocks. Default is: true for compatibility reasons.
1258
1259
*
1259
1260
* @return If true partial blocks will be evaluated before the partial will be rendered
1260
1261
* to allow inline block side effects.
@@ -1271,7 +1272,8 @@ public boolean preEvaluatePartialBlocks() {
1271
1272
* <pre>
1272
1273
* {{> @partial-block}}
1273
1274
* </pre>
1274
- * Attention: If this is set to true, Handlebars works *much* slower!
1275
+ * Attention: If this is set to true, Handlebars works *much* slower! while rendering
1276
+ * partial blocks. Default is: true for compatibility reasons.
1275
1277
*
1276
1278
* @param preEvaluatePartialBlocks If true partial blocks will be evaluated before the
1277
1279
* partial will be rendered to allow inline block side
@@ -1290,7 +1292,8 @@ public void setPreEvaluatePartialBlocks(final boolean preEvaluatePartialBlocks)
1290
1292
* <pre>
1291
1293
* {{> @partial-block}}
1292
1294
* </pre>
1293
- * Attention: If this is set to true, Handlebars works *much* slower!
1295
+ * Attention: If this is set to true, Handlebars works *much* slower! while rendering
1296
+ * partial blocks. Default is: true for compatibility reasons.
1294
1297
*
1295
1298
* @param preEvaluatePartialBlocks If true partial blocks will be evaluated before the
1296
1299
* partial will be rendered to allow inline block side
Original file line number Diff line number Diff line change
1
+ package com .github .jknack .handlebars .issues ;
2
+
3
+ import com .github .jknack .handlebars .HandlebarsException ;
4
+ import com .github .jknack .handlebars .v4Test ;
5
+ import static org .junit .Assert .assertTrue ;
6
+ import static org .junit .Assert .fail ;
7
+ import org .junit .Test ;
8
+
9
+ public class Issue634 extends v4Test {
10
+
11
+ @ Test
12
+ public void shouldThrowHandlebarsExceptionWhenPartialBlockIsMissing () throws Exception {
13
+ try {
14
+ shouldCompileTo ("{{> my-partial}}" ,
15
+ $ ("partials" , $ ("my-partial" , "Hello {{> @partial-block}}" )), null );
16
+ fail ("Must throw HandlebarsException" );
17
+ } catch (HandlebarsException x ) {
18
+ assertTrue (x .getMessage ().contains ("does not provide a @partial-block" ));
19
+ }
20
+ }
21
+
22
+ @ Test
23
+ public void shouldNotThrowHandlebarsException () throws Exception {
24
+ shouldCompileTo ("{{#> my-partial}}634{{/my-partial}}" ,
25
+ $ ("partials" , $ ("my-partial" , "Hello {{> @partial-block}}" )), "Hello 634" );
26
+ }
27
+
28
+ }
You can’t perform that action at this time.
0 commit comments