Add braces test

This commit is contained in:
carson 2020-11-15 17:56:23 -07:00
parent 5acd554a5c
commit d464b91d1e
2 changed files with 24 additions and 0 deletions

View File

@ -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);

View File

@ -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);