mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00
22 lines
651 B
JavaScript
22 lines
651 B
JavaScript
describe("kt-error-url attribute", function(){
|
|
beforeEach(function() {
|
|
this.server = makeServer();
|
|
clearWorkArea();
|
|
});
|
|
afterEach(function() {
|
|
this.server.restore();
|
|
clearWorkArea();
|
|
});
|
|
|
|
it('Submits a POST with error content on bad request', function()
|
|
{
|
|
this.server.respondWith("POST", "/error", function(xhr){
|
|
should.equal(JSON.parse(xhr.requestBody).detail.xhr.status, 404);
|
|
});
|
|
var btn = make('<button kt-error-url="/error" kt-get="/bad">Click Me!</button>')
|
|
btn.click();
|
|
this.server.respond();
|
|
this.server.respond();
|
|
});
|
|
})
|