forked from choojs/choo
-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.js
31 lines (28 loc) · 880 Bytes
/
test.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
var tape = require('tape')
var h = require('hyperscript')
var html = require('nanohtml')
var raw = require('nanohtml/raw')
var choo = require('./')
tape('should render on the server with nanohtml', function (t) {
var app = choo()
app.view(function (state, emit) {
var strong = '<strong>Hello filthy planet</strong>'
return html`
<p>${raw(strong)}</p>
`
})
var res = app.toString()
var exp = '<p><strong>Hello filthy planet</strong></p>'
t.equal(res.toString().trim(), exp, 'result was OK')
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()
})