Skip to content

Commit 4c15924

Browse files
committed
Revert init order change
1 parent a22fca6 commit 4c15924

File tree

3 files changed

+2
-43
lines changed

3 files changed

+2
-43
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ Choo.prototype.start = function () {
138138
}
139139

140140
this._setCache(this.state)
141-
this._matchRoute()
142141
this._stores.forEach(function (initStore) {
143142
initStore(self.state)
144143
})
145144

145+
this._matchRoute()
146146
this._tree = this._prerender(this.state)
147147
assert.ok(this._tree, 'choo.start: no valid DOM node returned for location ' + this.state.href)
148148

@@ -212,11 +212,11 @@ Choo.prototype.toString = function (location, state) {
212212

213213
var self = this
214214
this._setCache(this.state)
215-
this._matchRoute(location)
216215
this._stores.forEach(function (initStore) {
217216
initStore(self.state)
218217
})
219218

219+
this._matchRoute(location)
220220
var html = this._prerender(this.state)
221221
assert.ok(html, 'choo.toString: no valid value returned for the route ' + location)
222222
assert(!Array.isArray(html), 'choo.toString: return value was an array for the route ' + location)

test/browser.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -191,27 +191,6 @@ tape('state should include location on render', function (t) {
191191
app.mount(container)
192192
})
193193

194-
tape('state should include location on store init', function (t) {
195-
t.plan(6)
196-
var app = choo()
197-
var container = init('/foo/bar/file.txt?bin=baz')
198-
app.use(store)
199-
app.route('/:first/:second/*', function (state, emit) {
200-
return html`<div></div>`
201-
})
202-
app.mount(container)
203-
204-
function store (state, emit) {
205-
var params = { first: 'foo', second: 'bar', wildcard: 'file.txt' }
206-
t.equal(state.href, '/foo/bar/file.txt', 'state has href')
207-
t.equal(state.route, ':first/:second/*', 'state has route')
208-
t.ok(state.hasOwnProperty('params'), 'state has params')
209-
t.deepEqual(state.params, params, 'params match')
210-
t.ok(state.hasOwnProperty('query'), 'state has query')
211-
t.deepEqual(state.query, { bin: 'baz' }, 'query match')
212-
}
213-
})
214-
215194
tape('state should include title', function (t) {
216195
t.plan(3)
217196
document.title = 'foo'

test/node.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -185,26 +185,6 @@ tape('state should include location on render', function (t) {
185185
t.end()
186186
})
187187

188-
tape('state should include location on store init', function (t) {
189-
t.plan(6)
190-
var app = choo()
191-
app.use(store)
192-
app.route('/:first/:second/*', function (state, emit) {
193-
return html`<div></div>`
194-
})
195-
app.toString('/foo/bar/file.txt?bin=baz')
196-
197-
function store (state, emit) {
198-
var params = { first: 'foo', second: 'bar', wildcard: 'file.txt' }
199-
t.equal(state.href, '/foo/bar/file.txt', 'state has href')
200-
t.equal(state.route, ':first/:second/*', 'state has route')
201-
t.ok(state.hasOwnProperty('params'), 'state has params')
202-
t.deepEqual(state.params, params, 'params match')
203-
t.ok(state.hasOwnProperty('query'), 'state has query')
204-
t.deepEqual(state.query, { bin: 'baz' }, 'query match')
205-
}
206-
})
207-
208188
tape('state should include cache', function (t) {
209189
t.plan(6)
210190
var app = choo()

0 commit comments

Comments
 (0)