summaryrefslogtreecommitdiffstatshomepage
path: root/test/ext/path-deps.js
diff options
context:
space:
mode:
authorJohan Vosloo <johan@headspacetech.com>2020-12-30 14:49:21 +0100
committerJohan Vosloo <johan@headspacetech.com>2020-12-30 14:49:21 +0100
commitb46e8ab10f1e267bb635ee7afa4fc016229537d7 (patch)
treed8ba4893f61b3281b089a80d05839a7b93d27e58 /test/ext/path-deps.js
parent53ba918f0914450d75af60da1ac049e6d9c12865 (diff)
downloadhtmx-b46e8ab10f1e267bb635ee7afa4fc016229537d7.tar.gz
htmx-b46e8ab10f1e267bb635ee7afa4fc016229537d7.zip
Added tests
Diffstat (limited to 'test/ext/path-deps.js')
-rw-r--r--test/ext/path-deps.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/ext/path-deps.js b/test/ext/path-deps.js
index 8dea9f70..315bd0b4 100644
--- a/test/ext/path-deps.js
+++ b/test/ext/path-deps.js
@@ -138,5 +138,24 @@ describe("path-deps extension", function() {
div.innerHTML.should.equal("Deps fired!");
});
+ it('path-deps api basic refresh case works', function () {
+ this.server.respondWith("GET", "/test", "Path deps fired!");
+ var div = make('<div hx-get="/test" hx-trigger="path-deps" path-deps="/test">FOO</div>')
+ PathDeps.refresh("/test");
+ this.server.respond();
+ div.innerHTML.should.equal("Path deps fired!");
+ });
+
+ it('path-deps api parent path case works', function () {
+ this.server.respondWith("GET", "/test1", "Path deps 1 fired!");
+ this.server.respondWith("GET", "/test2", "Path deps 2 fired!");
+ var div = make('<div hx-get="/test1" hx-trigger="path-deps" path-deps="/test/child">FOO</div>')
+ var div2 = make('<div hx-get="/test2" hx-trigger="path-deps" path-deps="/test">BAR</div>')
+ PathDeps.refresh("/test/child");
+ this.server.respond();
+ div.innerHTML.should.equal("Path deps 1 fired!");
+ this.server.respond();
+ div2.innerHTML.should.equal("Path deps 2 fired!");
+ });
-}); \ No newline at end of file
+});