| 1 | describe('Core htmx AJAX Verbs', function() { |
| 2 | beforeEach(function() { |
| 3 | this.server = makeServer() |
| 4 | clearWorkArea() |
| 5 | }) |
| 6 | afterEach(function() { |
| 7 | this.server.restore() |
| 8 | clearWorkArea() |
| 9 | }) |
| 10 | |
| 11 | it('handles basic posts properly', function() { |
| 12 | this.server.respondWith('POST', '/test', 'post') |
| 13 | var div = make('<div hx-post="/test">click me</div>') |
| 14 | div.click() |
| 15 | this.server.respond() |
| 16 | div.innerHTML.should.equal('post') |
| 17 | }) |
| 18 | |
| 19 | it('handles basic put properly', function() { |
| 20 | this.server.respondWith('PUT', '/test', 'put') |
| 21 | var div = make('<div hx-put="/test">click me</div>') |
| 22 | div.click() |
| 23 | this.server.respond() |
| 24 | div.innerHTML.should.equal('put') |
| 25 | }) |
| 26 | |
| 27 | it('handles basic patch properly', function() { |
| 28 | this.server.respondWith('PATCH', '/test', 'patch') |
| 29 | var div = make('<div hx-patch="/test">click me</div>') |
| 30 | div.click() |
| 31 | this.server.respond() |
| 32 | div.innerHTML.should.equal('patch') |
| 33 | }) |
| 34 | |
| 35 | it('handles basic delete properly', function() { |
| 36 | this.server.respondWith('DELETE', '/test', 'delete') |
| 37 | var div = make('<div hx-delete="/test">click me</div>') |
| 38 | div.click() |
| 39 | this.server.respond() |
| 40 | div.innerHTML.should.equal('delete') |
| 41 | }) |
| 42 | }) |