summaryrefslogtreecommitdiffstatshomepage
path: root/www/static/test/core/internals.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/static/test/core/internals.js')
-rw-r--r--www/static/test/core/internals.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/www/static/test/core/internals.js b/www/static/test/core/internals.js
index e3d4f96d..9b6d0b97 100644
--- a/www/static/test/core/internals.js
+++ b/www/static/test/core/internals.js
@@ -107,6 +107,11 @@ describe('Core htmx internals Tests', function() {
htmx._('shouldCancel')({ type: 'submit', target: anchorThatShouldNotCancel }, form).should.equal(false)
htmx._('shouldCancel')({ type: 'click', target: divThatShouldNotCancel }, form).should.equal(false)
+ // check elements inside links getting click events should cancel parent links
+ var anchorWithButton = make("<a href='/foo'><button></button></a>")
+ htmx._('shouldCancel')({ type: 'click', target: anchorWithButton.firstChild }, anchorWithButton).should.equal(true)
+ htmx._('shouldCancel')({ type: 'click', target: anchorWithButton.firstChild }, anchorWithButton.firstChild).should.equal(true)
+
form = make('<form id="f1">' +
'<input id="insideInput" type="submit">' +
'<button id="insideFormBtn"></button>' +