summaryrefslogtreecommitdiffstatshomepage
path: root/test/attributes/kt-put.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/attributes/kt-put.js')
-rw-r--r--test/attributes/kt-put.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/attributes/kt-put.js b/test/attributes/kt-put.js
new file mode 100644
index 00000000..957a1522
--- /dev/null
+++ b/test/attributes/kt-put.js
@@ -0,0 +1,23 @@
+describe("kt-put attribute", function(){
+ beforeEach(function() {
+ this.server = makeServer();
+ clearWorkArea();
+ });
+ afterEach(function() {
+ this.server.restore();
+ clearWorkArea();
+ });
+
+ it('issues a PUT request with proper headers', function()
+ {
+ this.server.respondWith("PUT", "/test", function(xhr){
+ xhr.requestHeaders['X-HTTP-Method-Override'].should.equal('PUT');
+ xhr.respond(200, {}, "Putted!");
+ });
+
+ var btn = make('<button kt-put="/test">Click Me!</button>')
+ btn.click();
+ this.server.respond();
+ btn.innerHTML.should.equal("Putted!");
+ });
+})