summaryrefslogtreecommitdiffstatshomepage
path: root/test/attributes/hx-error-url.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/attributes/hx-error-url.js')
-rw-r--r--test/attributes/hx-error-url.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/attributes/hx-error-url.js b/test/attributes/hx-error-url.js
index 1984edcc..3ee46aa7 100644
--- a/test/attributes/hx-error-url.js
+++ b/test/attributes/hx-error-url.js
@@ -18,4 +18,15 @@ describe("hx-error-url attribute", function(){
this.server.respond();
this.server.respond();
});
+
+ it('Submits a POST with error content on bad request w/ data-* prefix', function()
+ {
+ this.server.respondWith("POST", "/error", function(xhr){
+ should.equal(JSON.parse(xhr.requestBody).detail.xhr.status, 404);
+ });
+ var btn = make('<button data-hx-error-url="/error" hx-get="/bad">Click Me!</button>')
+ btn.click();
+ this.server.respond();
+ this.server.respond();
+ });
})