diff options
Diffstat (limited to 'test/attributes/hx-delete.js')
-rw-r--r-- | test/attributes/hx-delete.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/attributes/hx-delete.js b/test/attributes/hx-delete.js new file mode 100644 index 00000000..42892e31 --- /dev/null +++ b/test/attributes/hx-delete.js @@ -0,0 +1,23 @@ +describe("hx-delete attribute", function(){ + beforeEach(function() { + this.server = makeServer(); + clearWorkArea(); + }); + afterEach(function() { + this.server.restore(); + clearWorkArea(); + }); + + it('issues a DELETE request with proper headers', function() + { + this.server.respondWith("DELETE", "/test", function(xhr){ + xhr.requestHeaders['X-HTTP-Method-Override'].should.equal('DELETE'); + xhr.respond(200, {}, "Deleted!"); + }); + + var btn = make('<button hx-delete="/test">Click Me!</button>') + btn.click(); + this.server.respond(); + btn.innerHTML.should.equal("Deleted!"); + }); +}) |