Files
pjax/tests/lib/proto/parse-element.js

32 lines
713 B
JavaScript
Raw Permalink Normal View History

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