diff options
author | carson <carson@leaddyno.com> | 2020-05-23 04:52:52 -0700 |
---|---|---|
committer | carson <carson@leaddyno.com> | 2020-05-23 04:52:52 -0700 |
commit | ba6d38e9dd0f61cca373e2e660c99b5e23f73a6b (patch) | |
tree | b90aebcc597706a3e5cb4509924c13b1e5ad3d0e /test/attributes/hx-patch.js | |
parent | 8b6aec296013588e7acc64eab5878f1cef818f1b (diff) | |
download | htmx-ba6d38e9dd0f61cca373e2e660c99b5e23f73a6b.tar.gz htmx-ba6d38e9dd0f61cca373e2e660c99b5e23f73a6b.zip |
Fix https://github.com/bigskysoftware/htmx/issues/19
clean up uses of getRawAttribute() and add a `data-*` test for all attribute tests.
Diffstat (limited to 'test/attributes/hx-patch.js')
-rw-r--r-- | test/attributes/hx-patch.js | 13 |
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!"); + }); }) |