diff --git a/test/unit/pjax_fallback.js b/test/unit/pjax_fallback.js index c63b5baa..e93a187b 100644 --- a/test/unit/pjax_fallback.js +++ b/test/unit/pjax_fallback.js @@ -357,4 +357,22 @@ asyncTest("POST with data string"+s, function() { }) }) +asyncTest("handle form submit"+s, function() { + var frame = this.frame + + frame.$(frame.document).on("submit", "form", function(event) { + frame.$.pjax.submit(event, "#main") + }) + + this.loaded = function() { + var env = JSON.parse(frame.$("#env").text()) + var expected = {foo: "1", bar: "2"} + if (!disabled) expected._pjax = "#main" + deepEqual(env['rack.request.query_hash'], expected) + start() + } + + frame.$("form").submit() +}) + }) diff --git a/test/views/home.erb b/test/views/home.erb index b1ab6464..02d2d8b7 100644 --- a/test/views/home.erb +++ b/test/views/home.erb @@ -8,6 +8,11 @@
  • Main
  • +
    + + +
    +