Skip to content

Commit

Permalink
Add currently failing test as per bigskysoftware/htmx#2616
Browse files Browse the repository at this point in the history
  • Loading branch information
Telroshan committed Jul 21, 2024
1 parent 30fd22f commit ea99b31
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/include-vals/test/ext/include-vals.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,23 @@ describe('include-vals extension', function() {
this.server.respond()
params.foo.should.equal('bar')
})

it('Includes stringified object properly', function() {
var params = {}
this.server.respondWith('POST', '/test', function(xhr) {
params = getParameters(xhr)
xhr.respond(200, {}, 'clicked')
})

make(`<form hx-ext="include-vals" include-vals="foo: {'value1':'bar','value2':'test'}" hx-post="/test">
<input type="text" name="value" value="text">
<button id="btn">Click me</button>
</form>`)
var btn = byId("btn")
btn.click()
this.server.respond()

params.value.should.equal('text')
params.foo.should.equal('{"value1":"bar","value2":"test"}')
})
})

0 comments on commit ea99b31

Please sign in to comment.