summaryrefslogtreecommitdiffstatshomepage
path: root/test/attributes/hx-patch.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/attributes/hx-patch.js')
-rw-r--r--test/attributes/hx-patch.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/attributes/hx-patch.js b/test/attributes/hx-patch.js
index 5f4abd63..6f7a5e9d 100644
--- a/test/attributes/hx-patch.js
+++ b/test/attributes/hx-patch.js
@@ -20,4 +20,17 @@ describe("hx-patch attribute", function(){
this.server.respond();
btn.innerHTML.should.equal("Patched!");
});
+
+ it('issues a PATCH request with proper headers w/ data-* prefix', function()
+ {
+ this.server.respondWith("PATCH", "/test", function(xhr){
+ xhr.requestHeaders['X-HTTP-Method-Override'].should.equal('PATCH');
+ xhr.respond(200, {}, "Patched!");
+ });
+
+ var btn = make('<button data-hx-patch="/test">Click Me!</button>')
+ btn.click();
+ this.server.respond();
+ btn.innerHTML.should.equal("Patched!");
+ });
})