summaryrefslogtreecommitdiffstatshomepage
path: root/test/attributes/hx-boost.js
diff options
context:
space:
mode:
authorcarson <carson@leaddyno.com>2020-05-17 05:22:19 -0700
committercarson <carson@leaddyno.com>2020-05-17 05:22:19 -0700
commit3aa8c64754c323f367fae64342f4ac9c20ea5a3d (patch)
tree6de764954d60c019fb87359007919bb56f0fe8f1 /test/attributes/hx-boost.js
parente1e4f25b0ef21e96eda192e69ab89e207dd7f617 (diff)
downloadhtmx-3aa8c64754c323f367fae64342f4ac9c20ea5a3d.tar.gz
htmx-3aa8c64754c323f367fae64342f4ac9c20ea5a3d.zip
le big re-rename
Diffstat (limited to 'test/attributes/hx-boost.js')
-rw-r--r--test/attributes/hx-boost.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/attributes/hx-boost.js b/test/attributes/hx-boost.js
new file mode 100644
index 00000000..41dfb29e
--- /dev/null
+++ b/test/attributes/hx-boost.js
@@ -0,0 +1,52 @@
+describe("hx-boost attribute", function() {
+
+ beforeEach(function () {
+ this.server = makeServer();
+ clearWorkArea();
+ });
+ afterEach(function () {
+ this.server.restore();
+ clearWorkArea();
+ });
+
+ it('handles basic anchor properly', function () {
+ this.server.respondWith("GET", "/test", "Boosted");
+ var div = make('<div hx-target="this" hx-boost="true"><a id="a1" href="/test">Foo</a></div>');
+ var a = byId('a1');
+ a.click();
+ this.server.respond();
+ div.innerHTML.should.equal("Boosted");
+ })
+
+
+ it('handles basic form post properly', function () {
+ this.server.respondWith("POST", "/test", "Boosted");
+ this.server.respondWith("POST", "/test", "Boosted");
+ var div = make('<div hx-target="this" hx-boost="true"><form id="f1" action="/test" method="post"><button id="b1">Submit</button></form></div>');
+ var btn = byId('b1');
+ btn.click();
+ this.server.respond();
+ div.innerHTML.should.equal("Boosted");
+ })
+
+ it('handles basic form get properly', function () {
+ this.server.respondWith("GET", "/test", "Boosted");
+ var div = make('<div hx-target="this" hx-boost="true"><form id="f1" action="/test" method="get"><button id="b1">Submit</button></form></div>');
+ var btn = byId('b1');
+ btn.click();
+ this.server.respond();
+ div.innerHTML.should.equal("Boosted");
+ })
+
+ it('handles basic form with no explicit method property', function () {
+ this.server.respondWith("GET", "/test", "Boosted");
+ var div = make('<div hx-target="this" hx-boost="true"><form id="f1" action="/test"><button id="b1">Submit</button></form></div>');
+ var btn = byId('b1');
+ btn.click();
+ this.server.respond();
+ div.innerHTML.should.equal("Boosted");
+ })
+
+
+});
+