File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ class ExpressVueRenderer {
4646 // Options.mergeDataObject(data);
4747 if ( vueOptions ) {
4848 Options . vue = Models . Defaults . mergeObjects ( Options . vue , vueOptions ) ;
49+ if ( vueOptions . layout ) {
50+ Options . layout = Models . Defaults . mergeObjects ( Options . layout , vueOptions . layout ) ;
51+ }
4952 }
5053 Options . component = componentPath ;
5154
Original file line number Diff line number Diff line change @@ -34,3 +34,36 @@ test('renders App object', t => {
3434 t . fail ( error . stack ) ;
3535 } ) ;
3636} ) ;
37+
38+
39+ test ( 'renders App object with custom layout' , t => {
40+ const vueOptionsWithLayout = {
41+ layout : {
42+ html : {
43+ start : 'html-start' ,
44+ end : 'html-end' ,
45+ } ,
46+ body : {
47+ start : 'body-start' ,
48+ end : 'body-end'
49+ } ,
50+ template : {
51+ start : "template-start" ,
52+ end : "template-end"
53+ } ,
54+ }
55+ } ;
56+ const renderer = new ExpressVueRenderer ( options ) ;
57+ return renderer . createAppObject ( 'main' , data , vueOptionsWithLayout )
58+ . then ( app => {
59+ t . is ( app . template . html . start , "html-start" ) ;
60+ t . is ( app . template . html . end , "html-end" ) ;
61+ t . is ( app . template . body . start , "body-start" ) ;
62+ t . is ( app . template . body . end , "body-end" ) ;
63+ t . is ( app . template . template . start , "template-start" ) ;
64+ t . is ( app . template . template . end , "template-end" ) ;
65+ } )
66+ . catch ( error => {
67+ t . fail ( error . stack ) ;
68+ } ) ;
69+ } ) ;
You can’t perform that action at this time.
0 commit comments