diff options
Diffstat (limited to 'test/attributes/hx-patch.js')
-rw-r--r-- | test/attributes/hx-patch.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/attributes/hx-patch.js b/test/attributes/hx-patch.js new file mode 100644 index 00000000..5f4abd63 --- /dev/null +++ b/test/attributes/hx-patch.js @@ -0,0 +1,23 @@ +describe("hx-patch attribute", function(){ + beforeEach(function() { + this.server = makeServer(); + clearWorkArea(); + }); + afterEach(function() { + this.server.restore(); + clearWorkArea(); + }); + + it('issues a PATCH request with proper headers', 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 hx-patch="/test">Click Me!</button>') + btn.click(); + this.server.respond(); + btn.innerHTML.should.equal("Patched!"); + }); +}) |