@@ -28,14 +28,35 @@ describe('helpers', function() {
2828 'raw block helper gets raw content' ) ;
2929 } ) ;
3030
31- it ( 'helper for nested raw block gets raw content' , function ( ) {
32- var string = '{{{{a}}}} {{{{b}}}} {{{{/b}}}} {{{{/a}}}}' ;
33- var helpers = {
34- a : function ( options ) {
31+ describe ( 'raw block parsing (with identity helper-function)' , function ( ) {
32+
33+ function runWithIdentityHelper ( template , expected ) {
34+ var helpers = {
35+ identity : function ( options ) {
3536 return options . fn ( ) ;
36- }
37- } ;
38- shouldCompileTo ( string , [ { } , helpers ] , ' {{{{b}}}} {{{{/b}}}} ' , 'raw block helper should get nested raw block as raw content' ) ;
37+ }
38+ } ;
39+ shouldCompileTo ( template , [ { } , helpers ] , expected ) ;
40+ }
41+
42+ it ( 'helper for nested raw block gets raw content' , function ( ) {
43+ runWithIdentityHelper ( '{{{{identity}}}} {{{{b}}}} {{{{/b}}}} {{{{/identity}}}}' , ' {{{{b}}}} {{{{/b}}}} ' ) ;
44+ } ) ;
45+
46+ it ( 'helper for nested raw block works with empty content' , function ( ) {
47+ runWithIdentityHelper ( '{{{{identity}}}}{{{{/identity}}}}' , '' ) ;
48+ } ) ;
49+
50+ it ( 'helper for nested raw block works if nested raw blocks are broken' , function ( ) {
51+ runWithIdentityHelper ( '{{{{identity}}}} {{{{a}}}} {{{{ {{{{/ }}}} }}}} {{{{/identity}}}}' , ' {{{{a}}}} {{{{ {{{{/ }}}} }}}} ' ) ;
52+ } ) ;
53+
54+ it ( 'helper for nested raw block throw exception when with missing closing braces' , function ( ) {
55+ var string = '{{{{a}}}} {{{{/a' ;
56+ shouldThrow ( function ( ) {
57+ Handlebars . compile ( string ) ( ) ;
58+ } ) ;
59+ } ) ;
3960 } ) ;
4061
4162 it ( 'helper block with identical context' , function ( ) {
0 commit comments