@@ -38,7 +38,7 @@ describe('htmlEntrypoint', function() {
3838
3939 fixturify . writeSync ( tmpLocation , project ) ;
4040
41- let { html, scripts } = htmlEntrypoint ( tmpLocation , 'index.html' ) ;
41+ let { html, scripts } = htmlEntrypoint ( 'my-app' , tmpLocation , 'index.html' ) ;
4242
4343 expect ( html ) . to . be . equalHTML ( project [ 'index.html' ] ) ;
4444 expect ( scripts ) . to . deep . equal ( [ ] ) ;
@@ -61,7 +61,7 @@ describe('htmlEntrypoint', function() {
6161
6262 fixturify . writeSync ( tmpLocation , project ) ;
6363
64- let { html, scripts } = htmlEntrypoint ( tmpLocation , 'index.html' ) ;
64+ let { html, scripts } = htmlEntrypoint ( 'my-app' , tmpLocation , 'index.html' ) ;
6565
6666 expect ( html ) . to . be . equalHTML ( project [ 'index.html' ] ) ;
6767 expect ( scripts ) . to . deep . equal ( [
@@ -88,7 +88,7 @@ describe('htmlEntrypoint', function() {
8888
8989 fixturify . writeSync ( tmpLocation , project ) ;
9090
91- let { html, scripts } = htmlEntrypoint ( tmpLocation , 'index.html' ) ;
91+ let { html, scripts } = htmlEntrypoint ( 'my-app' , tmpLocation , 'index.html' ) ;
9292
9393 expect ( html ) . to . be . equalHTML ( `
9494 <html>
@@ -119,7 +119,7 @@ describe('htmlEntrypoint', function() {
119119
120120 fixturify . writeSync ( tmpLocation , project ) ;
121121
122- let { html } = htmlEntrypoint ( tmpLocation , 'index.html' ) ;
122+ let { html } = htmlEntrypoint ( 'my-app' , tmpLocation , 'index.html' ) ;
123123
124124 expect ( html ) . to . be . equalHTML ( `
125125 <html>
@@ -148,7 +148,7 @@ describe('htmlEntrypoint', function() {
148148
149149 fixturify . writeSync ( tmpLocation , project ) ;
150150
151- let { html, scripts } = htmlEntrypoint ( tmpLocation , 'index.html' ) ;
151+ let { html, scripts } = htmlEntrypoint ( 'my-app' , tmpLocation , 'index.html' ) ;
152152
153153 expect ( html ) . to . be . equalHTML ( `
154154 <html>
@@ -178,7 +178,7 @@ describe('htmlEntrypoint', function() {
178178
179179 fixturify . writeSync ( tmpLocation , project ) ;
180180
181- let { html, scripts } = htmlEntrypoint ( tmpLocation , 'index.html' ) ;
181+ let { html, scripts } = htmlEntrypoint ( 'my-app' , tmpLocation , 'index.html' ) ;
182182
183183 expect ( html ) . to . be . equalHTML ( `
184184 <html>
@@ -207,7 +207,7 @@ describe('htmlEntrypoint', function() {
207207
208208 fixturify . writeSync ( tmpLocation , project ) ;
209209
210- let { html, scripts } = htmlEntrypoint ( tmpLocation , 'index.html' ) ;
210+ let { html, scripts } = htmlEntrypoint ( 'my-app' , tmpLocation , 'index.html' ) ;
211211
212212 expect ( html ) . to . be . equalHTML ( `
213213 <html>
@@ -218,4 +218,47 @@ describe('htmlEntrypoint', function() {
218218 ` ) ;
219219 expect ( scripts ) . to . deep . equal ( [ ] ) ;
220220 } ) ;
221+
222+ it ( 'extracts configs from meta' , function ( ) {
223+ let tmpobj = tmp . dirSync ( ) ;
224+ let tmpLocation = tmpobj . name ;
225+
226+ let project = {
227+ 'index.html' : `
228+ <html>
229+ <meta name="my-app/config/environment" content="%7B%22rootURL%22%3A%22%2Fcustom-root-url%2F%22%7D" >
230+ <body>
231+ <script src="/custom-root-url/bar.js"></script>
232+ </body>
233+ </html>
234+ ` ,
235+ } ;
236+
237+ fixturify . writeSync ( tmpLocation , project ) ;
238+ let { config } = htmlEntrypoint ( 'my-app' , tmpLocation , 'index.html' ) ;
239+ expect ( config ) . to . deep . equal ( {
240+ 'my-app' : { APP : { autoboot : false } , rootURL : '/custom-root-url/' } ,
241+ } ) ;
242+ } ) ;
243+
244+ it ( 'understands customized rootURL' , function ( ) {
245+ let tmpobj = tmp . dirSync ( ) ;
246+ let tmpLocation = tmpobj . name ;
247+
248+ let project = {
249+ 'index.html' : `
250+ <html>
251+ <meta name="my-app/config/environment" content="%7B%22rootURL%22%3A%22%2Fcustom-root-url%2F%22%7D" >
252+ <body>
253+ <script src="/custom-root-url/bar.js"></script>
254+ </body>
255+ </html>
256+ ` ,
257+ } ;
258+
259+ fixturify . writeSync ( tmpLocation , project ) ;
260+
261+ let { scripts } = htmlEntrypoint ( 'my-app' , tmpLocation , 'index.html' ) ;
262+ expect ( scripts ) . to . deep . equal ( [ `${ tmpLocation } /bar.js` ] ) ;
263+ } ) ;
221264} ) ;
0 commit comments