2014-05-06 08:19:23 +02:00
|
|
|
var tape = require("tape")
|
|
|
|
|
|
2014-10-14 08:23:56 +02:00
|
|
|
var parseElement = require("../../../lib/proto/parse-element")
|
2018-03-20 18:45:41 -04:00
|
|
|
|
|
|
|
|
var pjax = {
|
2017-09-18 14:13:39 +02:00
|
|
|
attachLink: function() { return true },
|
|
|
|
|
attachForm: function() { return true }
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-06 08:19:23 +02:00
|
|
|
tape("test parse element prototype method", function(t) {
|
|
|
|
|
t.doesNotThrow(function() {
|
|
|
|
|
var a = document.createElement("a")
|
2018-03-20 18:45:41 -04:00
|
|
|
parseElement.call(pjax, a)
|
2014-05-06 08:19:23 +02:00
|
|
|
}, "<a> element can be parsed")
|
|
|
|
|
|
2017-09-18 14:13:39 +02:00
|
|
|
t.doesNotThrow(function() {
|
2014-05-06 08:19:23 +02:00
|
|
|
var form = document.createElement("form")
|
2018-03-20 18:45:41 -04:00
|
|
|
parseElement.call(pjax, form)
|
2017-09-18 14:13:39 +02:00
|
|
|
}, "<form> element can be parsed")
|
2014-05-06 08:19:23 +02:00
|
|
|
|
2018-03-20 18:45:56 -04:00
|
|
|
t.throws(function() {
|
|
|
|
|
var el = document.createElement("div")
|
|
|
|
|
parseElement.call(pjax, el)
|
|
|
|
|
}, "<div> element cannot be parsed")
|
|
|
|
|
|
2014-05-06 08:19:23 +02:00
|
|
|
t.end()
|
|
|
|
|
})
|