File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import Route from '@ember/routing/route' ;
2+ import { inject as service } from '@ember/service' ;
3+
4+ export default class ApplicationRoute extends Route {
5+ @service fastboot ;
6+
7+ model ( ) {
8+ if ( this . fastboot . isFastBoot ) {
9+ const shoebox = this . fastboot . shoebox ;
10+ shoebox . put ( 'key1' , { newZealand : 'beautiful' } ) ;
11+ shoebox . put ( 'key2' , { moa : '20 foot tall bird!' } ) ;
12+ }
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ import Route from '@ember/routing/route' ;
2+
3+ export default class BoomRoute extends Route {
4+ model ( ) {
5+ throw 'BOOM' ;
6+ }
7+ }
Original file line number Diff line number Diff line change 1+ import Route from '@ember/routing/route' ;
2+
3+ export default class ImportsRoute extends Route {
4+ model ( ) {
5+ return {
6+ importStatus : window . browserImportStatus || 'FastBoot default default value'
7+ } ;
8+ }
9+ }
Original file line number Diff line number Diff line change 1+ import Route from '@ember/routing/route' ;
2+
3+ export default class PostsRoute extends Route {
4+ }
Original file line number Diff line number Diff line change 1+ {{ outlet }}
Original file line number Diff line number Diff line change 1+ FastBoot compatible vendor file: {{ model.importStatus }}
Original file line number Diff line number Diff line change 1+ <h3 >Posts Route!</h3 >
2+ {{ outlet }}
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const RSVP = require ( 'rsvp' ) ;
4+ const request = RSVP . denodeify ( require ( 'request' ) ) ;
5+ const expect = require ( 'chai' ) . use ( require ( 'chai-string' ) ) . expect ;
6+ const { startServer, stopServer } = require ( '../../test-libs/index' ) ;
7+
8+ describe . only ( 'shoebox - put' , function ( ) {
9+ this . timeout ( 20000 ) ;
10+
11+ before ( function ( ) {
12+ return startServer ( {
13+ command : 'serve'
14+ } ) ;
15+
16+ } ) ;
17+
18+ after ( function ( ) {
19+ return stopServer ( ) ;
20+ } ) ;
21+
22+ it . only ( 'put items into the shoebox' , async ( ) => {
23+ const response = await request ( {
24+ url : 'http://localhost:49741/' ,
25+ headers : {
26+ 'Accept' : 'text/html'
27+ }
28+ } )
29+
30+ expect ( response . statusCode ) . to . equal ( 200 ) ;
31+ expect ( response . body ) . to . contain (
32+ '<script type="fastboot/shoebox" id="shoebox-key1">' +
33+ '{"newZealand":"beautiful"}' +
34+ '</script>'
35+ ) ;
36+
37+ expect ( response . body ) . to . contain (
38+ '<script type="fastboot/shoebox" id="shoebox-key2">' +
39+ '{"moa":"20 foot tall bird!"}' +
40+ '</script>'
41+ ) ;
42+ } ) ;
43+ } ) ;
Original file line number Diff line number Diff line change 1+ import { module , test } from 'qunit' ;
2+ import { setupTest } from 'ember-qunit' ;
3+
4+ module ( 'Unit | Route | boom' , function ( hooks ) {
5+ setupTest ( hooks ) ;
6+
7+ test ( 'it exists' , function ( assert ) {
8+ let route = this . owner . lookup ( 'route:boom' ) ;
9+ assert . ok ( route ) ;
10+ } ) ;
11+ } ) ;
Original file line number Diff line number Diff line change 1+ import { module , test } from 'qunit' ;
2+ import { setupTest } from 'ember-qunit' ;
3+
4+ module ( 'Unit | Route | imports' , function ( hooks ) {
5+ setupTest ( hooks ) ;
6+
7+ test ( 'it exists' , function ( assert ) {
8+ let route = this . owner . lookup ( 'route:imports' ) ;
9+ assert . ok ( route ) ;
10+ } ) ;
11+ } ) ;
You can’t perform that action at this time.
0 commit comments