+1
-1
@@ -1,6 +1,6 @@
|
|||||||
node_js:
|
node_js:
|
||||||
- '4'
|
|
||||||
- '6'
|
- '6'
|
||||||
|
- '7'
|
||||||
sudo: false
|
sudo: false
|
||||||
language: node_js
|
language: node_js
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -58,14 +58,6 @@ function Choo (opts) {
|
|||||||
bus.prependListener('pushState', updateHistory.bind(null, 'push'))
|
bus.prependListener('pushState', updateHistory.bind(null, 'push'))
|
||||||
bus.prependListener('replaceState', updateHistory.bind(null, 'replace'))
|
bus.prependListener('replaceState', updateHistory.bind(null, 'replace'))
|
||||||
|
|
||||||
function updateHistory (mode, href) {
|
|
||||||
if (href) window.history[mode + 'State']({}, null, href)
|
|
||||||
bus.emit('render')
|
|
||||||
setTimeout(function () {
|
|
||||||
scrollIntoView()
|
|
||||||
}, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opts.href !== false) {
|
if (opts.href !== false) {
|
||||||
nanohref(function (location) {
|
nanohref(function (location) {
|
||||||
var href = location.href
|
var href = location.href
|
||||||
@@ -76,6 +68,14 @@ function Choo (opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateHistory (mode, href) {
|
||||||
|
if (href) window.history[mode + 'State']({}, null, href)
|
||||||
|
bus.emit('render')
|
||||||
|
setTimeout(function () {
|
||||||
|
scrollIntoView()
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
rerender = nanoraf(function () {
|
rerender = nanoraf(function () {
|
||||||
if (hasPerformance && timingEnabled) {
|
if (hasPerformance && timingEnabled) {
|
||||||
window.performance.mark('choo:renderStart')
|
window.performance.mark('choo:renderStart')
|
||||||
|
|||||||
@@ -1 +1,17 @@
|
|||||||
// var tape = require('tape')
|
var tape = require('tape')
|
||||||
|
|
||||||
|
var html = require('./html')
|
||||||
|
var choo = require('./')
|
||||||
|
|
||||||
|
tape('should render on the server', function (t) {
|
||||||
|
var app = choo()
|
||||||
|
app.route('/', function (state, emit) {
|
||||||
|
return html`
|
||||||
|
<p>Hello filthy planet</p>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
var res = app.toString('/')
|
||||||
|
var exp = '<p>Hello filthy planet</p>'
|
||||||
|
t.equal(res.toString(), exp, 'result was OK')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user