diff options
author | carson <carson@leaddyno.com> | 2020-05-17 05:22:19 -0700 |
---|---|---|
committer | carson <carson@leaddyno.com> | 2020-05-17 05:22:19 -0700 |
commit | 3aa8c64754c323f367fae64342f4ac9c20ea5a3d (patch) | |
tree | 6de764954d60c019fb87359007919bb56f0fe8f1 /test/attributes/hx-patch.js | |
parent | e1e4f25b0ef21e96eda192e69ab89e207dd7f617 (diff) | |
download | htmx-3aa8c64754c323f367fae64342f4ac9c20ea5a3d.tar.gz htmx-3aa8c64754c323f367fae64342f4ac9c20ea5a3d.zip |
le big re-rename
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!"); + }); +}) |