describe("hx-vars attribute", function() { beforeEach(function () { this.server = makeServer(); clearWorkArea(); }); afterEach(function () { this.server.restore(); clearWorkArea(); }); it('basic hx-vars works', 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.click(); this.server.respond(); 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.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); params['v1'].should.equal("test"); params['v2'].should.equal("42"); xhr.respond(200, {}, "Clicked!") }); var div = make('') div.click(); this.server.respond(); div.innerHTML.should.equal("Clicked!"); }); it('hx-vars can be on parents', function () { this.server.respondWith("POST", "/vars", function (xhr) { var params = getParameters(xhr); params['i1'].should.equal("test"); xhr.respond(200, {}, "Clicked!") }); make('