@@ -202,6 +202,62 @@ describe("FastBoot", function() {
202202 }
203203 } ) ;
204204
205+ it ( "can reload the app using the same sandboxGlobals" , function ( ) {
206+ var fastboot = new FastBoot ( {
207+ distPath : fixture ( 'basic-app' ) ,
208+ sandboxGlobals : {
209+ foo : 5 ,
210+ najax : 'undefined' ,
211+ myVar : 'undefined'
212+ }
213+ } ) ;
214+
215+ return fastboot . visit ( '/' )
216+ . then ( r => r . html ( ) )
217+ . then ( html => expect ( html ) . to . match ( / W e l c o m e t o E m b e r / ) )
218+ . then ( hotReloadApp )
219+ . then ( ( ) => fastboot . visit ( '/foo' ) )
220+ . then ( r => r . html ( ) )
221+ . then ( ( html ) => {
222+ expect ( html ) . to . match ( / f o o f r o m s a n d b o x : 5 / ) ;
223+ expect ( html ) . to . match ( / n a j a x i n s a n d b o x : u n d e f i n e d / ) ;
224+ } ) ;
225+
226+ function hotReloadApp ( ) {
227+ fastboot . reload ( {
228+ distPath : fixture ( 'custom-sandbox' )
229+ } ) ;
230+ }
231+ } ) ;
232+
233+ it ( "can reload the app using the same sandbox class" , function ( ) {
234+ var fastboot = new FastBoot ( {
235+ distPath : fixture ( 'basic-app' ) ,
236+ sandbox : CustomSandbox ,
237+ sandboxGlobals : {
238+ myVar : 2 ,
239+ foo : 'undefined' ,
240+ najax : 'undefined'
241+ }
242+ } ) ;
243+
244+ return fastboot . visit ( '/' )
245+ . then ( r => r . html ( ) )
246+ . then ( html => expect ( html ) . to . match ( / W e l c o m e t o E m b e r / ) )
247+ . then ( hotReloadApp )
248+ . then ( ( ) => fastboot . visit ( '/foo' ) )
249+ . then ( r => r . html ( ) )
250+ . then ( ( html ) => {
251+ expect ( html ) . to . match ( / m y V a r i n s a n d b o x : 2 / ) ;
252+ } ) ;
253+
254+ function hotReloadApp ( ) {
255+ fastboot . reload ( {
256+ distPath : fixture ( 'custom-sandbox' )
257+ } ) ;
258+ }
259+ } ) ;
260+
205261 it ( "reads the config from package.json" , function ( ) {
206262 var fastboot = new FastBoot ( {
207263 distPath : fixture ( 'config-app' )
0 commit comments