* Fix bug when checking if elements were parsed already
parse-element.js checks if the element was already parsed by
checking for the `data-pjax-click-state` attribute. However, this
attribute was not added until the link is clicked.
Originally, there was a separate attribute, `data-pjax-enabled`,
which tracked if the element was parsed already, but that was
changed in 9a86044.
This commit merges the attributes for mouse clicks and key presses
into one and adds that attribute when the element is initially
parsed.
* More bug fixes
* Fix documentation for currentUrlFullReload
* Ignore lines from coverage if they can't be tested
* Refactor attach-link and attach-form
* Fix and refactors tests
* Add tests
* Add TS definitions for options.requestOptions
* Code cleanup
24 lines
696 B
JavaScript
24 lines
696 B
JavaScript
var tape = require("tape")
|
|
|
|
var evalScript = require("../../lib/eval-script")
|
|
|
|
tape("test evalScript method", function(t) {
|
|
document.body.className = ""
|
|
|
|
var script = document.createElement("script")
|
|
script.innerHTML = "document.body.className = 'executed'"
|
|
|
|
t.equal(document.body.className, "", "script hasn't been executed yet")
|
|
|
|
evalScript(script)
|
|
t.equal(document.body.className, "executed", "script has been properly executed")
|
|
|
|
script.innerHTML = "document.write('failure')"
|
|
var bodyText = "document.write hasn't been executed"
|
|
document.body.text = bodyText
|
|
evalScript(script)
|
|
t.equal(document.body.text, bodyText, "document.write hasn't been executed")
|
|
|
|
t.end()
|
|
})
|