throws targetError if you the target in responseHandling is invalid8ms ‣
var originalResponseHandling = htmx.config.responseHandling
try {
var error = false
var handler = htmx.on('htmx:targetError', function(evt) {
evt.detail.target.should.equal('#a-div')
error = true
})
htmx.config.responseHandling = originalResponseHandling.slice()
htmx.config.responseHandling.unshift({ code: '444', swap: true, target: '#a-div' })
var responseCode = null
this.server.respondWith('GET', '/test', function(xhr, id) {
xhr.respond(responseCode, { 'Content-Type': 'text/html' }, '' + responseCode)
})
responseCode = 444
var btn = make('<button hx-get="/test">Click Me!</button>')
btn.click()
this.server.respond()
btn.innerHTML.should.equal('Click Me!')
} catch (e) {
} finally {
htmx.config.responseHandling = originalResponseHandling
htmx.off('htmx:targetError', handler)
error.should.equal(true)
}