summaryrefslogtreecommitdiffstatshomepage
path: root/test/attributes/hx-push-url.js
diff options
context:
space:
mode:
authorcarson <carson@leaddyno.com>2020-05-23 04:52:52 -0700
committercarson <carson@leaddyno.com>2020-05-23 04:52:52 -0700
commitba6d38e9dd0f61cca373e2e660c99b5e23f73a6b (patch)
treeb90aebcc597706a3e5cb4509924c13b1e5ad3d0e /test/attributes/hx-push-url.js
parent8b6aec296013588e7acc64eab5878f1cef818f1b (diff)
downloadhtmx-ba6d38e9dd0f61cca373e2e660c99b5e23f73a6b.tar.gz
htmx-ba6d38e9dd0f61cca373e2e660c99b5e23f73a6b.zip
Fix https://github.com/bigskysoftware/htmx/issues/19
clean up uses of getRawAttribute() and add a `data-*` test for all attribute tests.
Diffstat (limited to 'test/attributes/hx-push-url.js')
-rw-r--r--test/attributes/hx-push-url.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/attributes/hx-push-url.js b/test/attributes/hx-push-url.js
index c76d6aa4..4559d57a 100644
--- a/test/attributes/hx-push-url.js
+++ b/test/attributes/hx-push-url.js
@@ -120,4 +120,15 @@ describe("hx-push-url attribute", function() {
chai.assert(timeInMs < 300, "Should take less than 300ms on most platforms");
})
+ it("navigation should push an element into the cache w/ data-* prefix", function () {
+ this.server.respondWith("GET", "/test", "second");
+ getWorkArea().innerHTML.should.be.equal("");
+ var div = make('<div data-hx-push-url="true" data-hx-get="/test">first</div>');
+ div.click();
+ this.server.respond();
+ getWorkArea().textContent.should.equal("second")
+ var cache = JSON.parse(localStorage.getItem(KUTTY_HISTORY_CACHE));
+ cache.length.should.equal(1);
+ });
+
}); \ No newline at end of file