Add test confirming toString() works with min-document elements

This commit is contained in:
Ben Drucker
2016-07-04 08:07:54 -07:00
parent 5f4fda6646
commit 3fc66acdc3
2 changed files with 15 additions and 0 deletions
+1
View File
@@ -42,6 +42,7 @@
"insert-css": "^0.2.0",
"istanbul": "^0.4.4",
"karma-sauce-launcher": "^1.0.0",
"min-document": "~2.18.0",
"server-router": "^2.1.0",
"sheetify": "^5.0.0",
"standard": "^7.1.0",
+14
View File
@@ -1,4 +1,5 @@
const tape = require('tape')
const minDocument = require('min-document')
const choo = require('../../')
const view = require('../../html')
@@ -16,6 +17,19 @@ tape('should render on the server', function (t) {
t.equal(html, expected, 'strings are equal')
})
t.test('can render without a real DOM', function (t) {
t.plan(1)
const app = choo()
app.router((route) => [
route('/', () => minDocument.createElement('div'))
])
const html = app.toString('/')
const expected = '<div></div>'
t.equal(html, expected, 'strings are equal')
})
t.test('should accept a state object', function (t) {
t.plan(1)