From 53c65147334c68abdba9e7a38220d96fc45e160e Mon Sep 17 00:00:00 2001 From: Ray Nicholus Date: Fri, 3 Apr 2015 22:00:50 -0500 Subject: [PATCH] feat(patch): support PATCH requests closes #53 --- bower.json | 2 +- package.json | 2 +- test/ajax-form-tests.html | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index b6b31c2..7365758 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ajax-form", - "version": "1.5.4", + "version": "1.6.0", "authors": [ "Ray Nicholus" ], diff --git a/package.json b/package.json index 3fee2d8..839522f 100644 --- a/package.json +++ b/package.json @@ -17,5 +17,5 @@ "type": "git", "url": "https://github.com/rnicholus/ajax-form.git" }, - "version": "1.5.4" + "version": "1.6.0" } \ No newline at end of file diff --git a/test/ajax-form-tests.html b/test/ajax-form-tests.html index c202a02..d523b28 100644 --- a/test/ajax-form-tests.html +++ b/test/ajax-form-tests.html @@ -141,7 +141,7 @@ expect(ajaxForm.domReady.bind(typicalForm)).to.throw('Invalid method!'); }); - it('throws an error if the method is not "get", "post" or "put"', function() { + it('throws an error if the method is not "get", "post", "put", or "patch', function() { typicalForm.setAttribute('method', 'head'); expect(ajaxForm.domReady.bind(typicalForm)).to.throw('Invalid method!'); }); @@ -167,6 +167,13 @@ expect(typicalForm.addEventListener).to.have.been.calledWith('submit'); }); + + it('adds a listener to squelch submit events if the method is "patch"', function() { + typicalForm.setAttribute('method', 'patch'); + ajaxForm.domReady.call(typicalForm); + + expect(typicalForm.addEventListener).to.have.been.calledWith('submit'); + }); }); describe('form validation', function() {