mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-28 05:21:18 +00:00
Add braces test
This commit is contained in:
parent
5acd554a5c
commit
d464b91d1e
@ -20,6 +20,18 @@ describe("hx-vals attribute", function() {
|
||||
div.innerHTML.should.equal("Clicked!");
|
||||
});
|
||||
|
||||
it('basic hx-vals works with braces', function () {
|
||||
this.server.respondWith("POST", "/vars", function (xhr) {
|
||||
var params = getParameters(xhr);
|
||||
params['i1'].should.equal("test");
|
||||
xhr.respond(200, {}, "Clicked!")
|
||||
});
|
||||
var div = make("<div hx-post='/vars' hx-vals='{\"i1\":\"test\"}'></div>")
|
||||
div.click();
|
||||
this.server.respond();
|
||||
div.innerHTML.should.equal("Clicked!");
|
||||
});
|
||||
|
||||
it('multiple hx-vals works', function () {
|
||||
this.server.respondWith("POST", "/vars", function (xhr) {
|
||||
var params = getParameters(xhr);
|
||||
|
@ -20,6 +20,18 @@ describe("hx-vars attribute", function() {
|
||||
div.innerHTML.should.equal("Clicked!");
|
||||
});
|
||||
|
||||
it('hx-vars works with braces', function () {
|
||||
this.server.respondWith("POST", "/vars", function (xhr) {
|
||||
var params = getParameters(xhr);
|
||||
params['i1'].should.equal("test");
|
||||
xhr.respond(200, {}, "Clicked!")
|
||||
});
|
||||
var div = make('<div hx-post="/vars" hx-vars="{i1:\'test\'}"></div>')
|
||||
div.click();
|
||||
this.server.respond();
|
||||
div.innerHTML.should.equal("Clicked!");
|
||||
});
|
||||
|
||||
it('multiple hx-vars works', function () {
|
||||
this.server.respondWith("POST", "/vars", function (xhr) {
|
||||
var params = getParameters(xhr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user