summaryrefslogtreecommitdiffstatshomepage
path: root/test/core
diff options
context:
space:
mode:
Diffstat (limited to 'test/core')
-rw-r--r--test/core/regressions.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/core/regressions.js b/test/core/regressions.js
index a0f6724e..8f844cfb 100644
--- a/test/core/regressions.js
+++ b/test/core/regressions.js
@@ -212,4 +212,37 @@ describe("Core htmx Regression Tests", function(){
var input = byId("id_email");
input.value.should.equal("supertest@test.com");
});
+
+ it("script tags only execute once", function(done) {
+ window.i = 0; // set count to 0
+ this.server.respondWith('GET', '/test', '<script>console.trace(); window.i++</script>') // increment the count by 1
+
+ // make a div w/ a short settle delay to make the problem more obvious
+ var div = make('<div hx-get="/test" hx-swap="innerHTML settle:5ms"/>');
+ div.click();
+ this.server.respond()
+
+ setTimeout(function(){
+ window.i.should.equal(1);
+ delete window.i;
+ done();
+ }, 50)
+ })
+
+ it("script tags only execute once when nested", function(done) {
+ window.i = 0; // set count to 0
+ this.server.respondWith('GET', '/test', '<p>foo</p><div><script>console.trace(); window.i++</script></div>') // increment the count by 1
+
+ // make a div w/ a short settle delay to make the problem more obvious
+ var div = make('<div hx-get="/test" hx-swap="innerHTML settle:5ms"/>');
+ div.click();
+ this.server.respond()
+
+ setTimeout(function(){
+ window.i.should.equal(1);
+ delete window.i;
+ done();
+ }, 50)
+ })
+
});