@@ -293,15 +293,17 @@ describe('Core htmx API test', function() {
293293 div . innerHTML . should . equal ( 'foo!' )
294294 } )
295295
296- // it('ajax api falls back to targeting body if target and source not set', function() {
297- // this.server.respondWith('GET', '/test', 'foo!')
298- // var div = make("<div id='d1'></div>")
299- // const saveBody = document.body.innerHTML
300- // htmx.ajax('GET', '/test', {})
301- // this.server.respond()
302- // document.body.innerHTML.should.equal('foo!')
303- // document.body.innerHTML = saveBody
304- // })
296+ it ( 'ajax api falls back to targeting body if target and source not set' , function ( ) {
297+ var target
298+ this . server . respondWith ( 'GET' , '/test' , 'foo!' )
299+ htmx . on ( document . body , 'htmx:configRequest' , function ( evt ) {
300+ target = evt . detail . target
301+ return false
302+ } )
303+ htmx . ajax ( 'GET' , '/test' , { swap : 'none' } )
304+ this . server . respond ( )
305+ target . should . equal ( document . body )
306+ } )
305307
306308 it ( 'ajax api works with swapSpec' , function ( ) {
307309 this . server . respondWith ( 'GET' , '/test' , "<p class='test'>foo!</p>" )
0 commit comments