summaryrefslogtreecommitdiffstatshomepage
path: root/test/attributes/hx-indicator.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-indicator.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-indicator.js')
-rw-r--r--test/attributes/hx-indicator.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/attributes/hx-indicator.js b/test/attributes/hx-indicator.js
index 7b1503bf..1385eb42 100644
--- a/test/attributes/hx-indicator.js
+++ b/test/attributes/hx-indicator.js
@@ -33,4 +33,20 @@ describe("hx-indicator attribute", function(){
a1.classList.contains("htmx-request").should.equal(false);
a2.classList.contains("htmx-request").should.equal(false);
});
+
+ it('Indicator classes are properly put on element with explicit indicator w/ data-* prefix', function()
+ {
+ this.server.respondWith("GET", "/test", "Clicked!");
+ var btn = make('<button hx-get="/test" data-hx-indicator="#a1, #a2">Click Me!</button>')
+ var a1 = make('<a id="a1"></a>')
+ var a2 = make('<a id="a2"></a>')
+ btn.click();
+ btn.classList.contains("htmx-request").should.equal(false);
+ a1.classList.contains("htmx-request").should.equal(true);
+ a2.classList.contains("htmx-request").should.equal(true);
+ this.server.respond();
+ btn.classList.contains("htmx-request").should.equal(false);
+ a1.classList.contains("htmx-request").should.equal(false);
+ a2.classList.contains("htmx-request").should.equal(false);
+ });
})