Fix bugs and add tests #145

Merged
BehindTheMath merged 11 commits from fix/bugs-and-add-tests into master 2018-04-09 22:36:33 -05:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit a42ae57448 - Show all commits

View File

@@ -1,15 +1,17 @@
var attrState = "data-pjax-state"
robinnorth commented 2018-04-09 15:06:00 -05:00 (Migrated from github.com)
Review

This, and line 12 could be abstracted to use var attrState = "data-pjax-state", as in attach-link

This, and line 12 could be abstracted to use `var attrState = "data-pjax-state"`, as in `attach-link`
BehindTheMath commented 2018-04-09 15:18:15 -05:00 (Migrated from github.com)
Review

True.

True.
module.exports = function(el) {
switch (el.tagName.toLowerCase()) {
case "a":
// only attach link if el does not already have link attached
if (!el.hasAttribute("data-pjax-state")) {
if (!el.hasAttribute(attrState)) {
this.attachLink(el)
}
break
case "form":
// only attach link if el does not already have link attached
if (!el.hasAttribute("data-pjax-state")) {
if (!el.hasAttribute(attrState)) {
this.attachForm(el)
}
break

View File

@@ -65,7 +65,7 @@ tape("test attach form preventDefaulted events", function(t) {
var loadUrlCalled = false
var form = document.createElement("form")
// This needs to be before the call to attachFormk()
// This needs to be before the call to attachForm()
on(form, "submit", function(event) { event.preventDefault() })
attachForm.call({