summaryrefslogtreecommitdiffstatshomepage
path: root/test/attributes/kt-error-url.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/attributes/kt-error-url.js')
-rw-r--r--test/attributes/kt-error-url.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/attributes/kt-error-url.js b/test/attributes/kt-error-url.js
new file mode 100644
index 00000000..4a573ef1
--- /dev/null
+++ b/test/attributes/kt-error-url.js
@@ -0,0 +1,21 @@
+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();
+ });
+})