Gitako/packages/pjax/tests/lib/proto/parse-element.js
EnixCoda 7e6feb621c
revert: use old pjax for Firefox compatibility
This reverts commit 8aaf55be59 and 0a4ee27
2020-04-06 19:16:36 +08:00

27 lines
685 B
JavaScript

var tape = require("tape")
var parseElement = require("../../../lib/proto/parse-element")
var pjax = {
attachLink: function() { return true },
attachForm: function() { return true }
}
tape("test parse element prototype method", function(t) {
t.doesNotThrow(function() {
var a = document.createElement("a")
parseElement.call(pjax, a)
}, "<a> element can be parsed")
t.doesNotThrow(function() {
var form = document.createElement("form")
parseElement.call(pjax, form)
}, "<form> element can be parsed")
t.throws(function() {
var el = document.createElement("div")
parseElement.call(pjax, el)
}, "<div> element cannot be parsed")
t.end()
})