forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d8-app.js
53 lines (52 loc) · 1.36 KB
/
d8-app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'use strict';
/* globals print, Ember, SimpleDOM */
let Router = Ember.Router.extend({
location: 'none',
rootURL: '/',
});
Router.map(function () {
this.route('my-route', { path: '/my-route' }, function () {});
});
Ember.TEMPLATES['index'] = Ember.HTMLBars.template({
id: null,
block:
'{"statements":[["text","index"]],"locals":[],"named":[],"yields":[],"blocks":[],"hasPartials":false}',
meta: {},
});
Ember.TEMPLATES['my-route/index'] = Ember.HTMLBars.template({
id: null,
block:
'{"statements":[["text","my-route"]],"locals":[],"named":[],"yields":[],"blocks":[],"hasPartials":false}',
meta: {},
});
let App = Ember.Application.extend({
Router: Router,
autoboot: false,
});
let app = new App();
let serializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap);
let doc = new SimpleDOM.Document();
let options = {
isBrowser: false,
document: doc,
rootElement: doc.body,
shouldRender: true,
};
app
.visit('/', options)
.then(function (instance) {
print(serializer.serialize(doc.body));
let router = instance.lookup('router:main');
return router.transitionTo('/my-route');
})
.then(function () {
return new Ember.RSVP.Promise(function (resolve) {
Ember.run.schedule('afterRender', resolve);
});
})
.then(function () {
print(serializer.serialize(doc.body));
})
.catch(function (err) {
print(err.stack);
});