Files
buuh/test.js
T

32 lines
880 B
JavaScript
Raw Normal View History

2017-05-24 13:02:33 +02:00
var tape = require('tape')
var h = require('hyperscript')
2017-05-24 13:02:33 +02:00
var html = require('./html')
2017-09-19 19:43:37 +01:00
var raw = require('./html/raw')
2017-05-24 13:02:33 +02:00
var choo = require('./')
tape('should render on the server with bel', function (t) {
2017-05-24 13:02:33 +02:00
var app = choo()
app.route('/', function (state, emit) {
2017-09-19 19:43:37 +01:00
var strong = '<strong>Hello filthy planet</strong>'
2017-05-24 13:02:33 +02:00
return html`
2017-09-19 19:43:37 +01:00
<p>${raw(strong)}</p>
2017-05-24 13:02:33 +02:00
`
})
var res = app.toString('/')
2017-09-19 19:43:37 +01:00
var exp = '<p><strong>Hello filthy planet</strong></p>'
t.equal(res.toString().trim(), exp, 'result was OK')
2017-05-24 13:02:33 +02:00
t.end()
})
tape('should render on the server with hyperscript', function (t) {
var app = choo()
app.route('/', function (state, emit) {
return h('p', h('strong', 'Hello filthy planet'))
})
var res = app.toString('/')
var exp = '<p><strong>Hello filthy planet</strong></p>'
t.equal(res.toString().trim(), exp, 'result was OK')
t.end()
})