diff options
Diffstat (limited to 'test/attributes/hx-post.js')
-rw-r--r-- | test/attributes/hx-post.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/attributes/hx-post.js b/test/attributes/hx-post.js index 4b548018..6734e30d 100644 --- a/test/attributes/hx-post.js +++ b/test/attributes/hx-post.js @@ -20,4 +20,17 @@ describe("hx-post attribute", function(){ this.server.respond(); btn.innerHTML.should.equal("Posted!"); }); + + it('issues a POST request with proper headers w/ data-* prefix', function() + { + this.server.respondWith("POST", "/test", function(xhr){ + should.equal(xhr.requestHeaders['X-HTTP-Method-Override'], undefined); + xhr.respond(200, {}, "Posted!"); + }); + + var btn = make('<button data-hx-post="/test">Click Me!</button>') + btn.click(); + this.server.respond(); + btn.innerHTML.should.equal("Posted!"); + }); }) |