summaryrefslogtreecommitdiffstatshomepage
path: root/test/attributes/hx-push-url.js
diff options
context:
space:
mode:
authorcarson <carson@leaddyno.com>2020-06-30 10:45:38 -0700
committercarson <carson@leaddyno.com>2020-06-30 10:45:38 -0700
commitb22b1d104c2a7e7097923c3d7a66e1d19ff56c04 (patch)
tree61eb96fa822ac0893e1697aa6408613c4ee300af /test/attributes/hx-push-url.js
parent4f3cf2d889ff549422ed2bb135fc5775f7e54dab (diff)
parent2fbe230853512b05f0ead8afaf63517280204b86 (diff)
downloadhtmx-b22b1d104c2a7e7097923c3d7a66e1d19ff56c04.tar.gz
htmx-b22b1d104c2a7e7097923c3d7a66e1d19ff56c04.zip
Merge remote-tracking branch 'origin/dev' into dev
Diffstat (limited to 'test/attributes/hx-push-url.js')
-rw-r--r--test/attributes/hx-push-url.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/attributes/hx-push-url.js b/test/attributes/hx-push-url.js
index e137d4a0..a1bad296 100644
--- a/test/attributes/hx-push-url.js
+++ b/test/attributes/hx-push-url.js
@@ -13,7 +13,7 @@ describe("hx-push-url attribute", function() {
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME);
});
- it("navigation should push an element into the cache ", function () {
+ it("navigation should push an element into the cache when true", function () {
this.server.respondWith("GET", "/test", "second");
getWorkArea().innerHTML.should.be.equal("");
var div = make('<div hx-push-url="true" hx-get="/test">first</div>');
@@ -22,6 +22,19 @@ describe("hx-push-url attribute", function() {
getWorkArea().textContent.should.equal("second")
var cache = JSON.parse(localStorage.getItem(HTMX_HISTORY_CACHE_NAME));
cache.length.should.equal(1);
+ cache[0].url.should.equal("/test");
+ });
+
+ it("navigation should push an element into the cache when string", function () {
+ this.server.respondWith("GET", "/test", "second");
+ getWorkArea().innerHTML.should.be.equal("");
+ var div = make('<div hx-push-url="/abc123" hx-get="/test">first</div>');
+ div.click();
+ this.server.respond();
+ getWorkArea().textContent.should.equal("second")
+ var cache = JSON.parse(localStorage.getItem(HTMX_HISTORY_CACHE_NAME));
+ cache.length.should.equal(1);
+ cache[0].url.should.equal("/abc123");
});
it("restore should return old value", function () {