@@ -4,7 +4,7 @@ const lab = exports.lab = Lab.script();
44const describe = lab . experiment ;
55const expect = Code . expect ;
66const it = lab . it ;
7- const render = require ( '../spec-helpers' ) . render ;
7+ const { render } = require ( '../spec-helpers' ) ;
88
99describe ( 'partial and block helpers' , function ( ) {
1010 it ( 'should insert partial into the corresponding block' , function ( done ) {
@@ -46,4 +46,32 @@ describe('partial and block helpers', function () {
4646 done ( ) ;
4747 } ) ;
4848 } ) ;
49+
50+ it ( 'should successfully render template' , function ( done ) {
51+ const templateContent = "some-content" ;
52+ const templates = {
53+ "layout/base" : templateContent ,
54+ template : `{{#JSONparse '{"layout/base":{}}'}}{{#partial this}}{{/partial}}{{/JSONparse}}{{>layout/base}}` ,
55+ } ;
56+ render ( 'template' , { } , { } , { } , templates ) . then ( result => {
57+ expect ( result ) . to . be . equal ( templateContent ) ;
58+ done ( ) ;
59+ } ) ;
60+ } ) ;
61+
62+ it ( 'should successfully render template with context' , function ( done ) {
63+ const templateContent = "Hello, world!" ;
64+ const templates = {
65+ template : `{{#partial "base"}}Hello, world!{{/partial}}{{#partial notPartials}}{{/partial}}{{> base}}` ,
66+ } ;
67+ const context = {
68+ notPartials : {
69+ "base" : { }
70+ }
71+ }
72+ render ( 'template' , context , { } , { } , templates ) . then ( result => {
73+ expect ( result ) . to . be . equal ( templateContent ) ;
74+ done ( ) ;
75+ } ) ;
76+ } ) ;
4977} ) ;
0 commit comments