diff --git a/test/core/regressions.js b/test/core/regressions.js index 3b7fec9d7..a668bb4b6 100644 --- a/test/core/regressions.js +++ b/test/core/regressions.js @@ -109,27 +109,6 @@ describe('Core htmx Regression Tests', function() { defaultPrevented.should.equal(true) }) - it('a modified click trigger on a form does not prevent the default behaviour of other elements - https://github.com/bigskysoftware/htmx/issues/2755', function(done) { - var defaultPrevented = 'unset' - make('') - make('
') - - htmx.on('#datefield', 'click', function(evt) { - // we need to wait so the state of the evt is finalized - setTimeout(() => { - defaultPrevented = evt.defaultPrevented - try { - defaultPrevented.should.equal(false) - done() - } catch (err) { - done(err) - } - }, 0) - }) - - byId('datefield').click() - }) - it('two elements can listen for the same event on another element', function() { this.server.respondWith('GET', '/test', 'triggered') @@ -292,3 +271,24 @@ describe('Core htmx Regression Tests', function() { }, 50) }) }) + +it('a modified click trigger on a form does not prevent the default behaviour of other elements - https://github.com/bigskysoftware/htmx/issues/2755', function(done) { + var defaultPrevented = 'unset' + make('') + make('
') + + htmx.on('#datefield', 'click', function(evt) { + // we need to wait so the state of the evt is finalized + setTimeout(() => { + defaultPrevented = evt.defaultPrevented + try { + defaultPrevented.should.equal(false) + done() + } catch (err) { + done(err) + } + }, 0) + }) + + byId('datefield').click() +}) diff --git a/test/manual/form-trigger.html b/test/manual/form-trigger.html new file mode 100644 index 000000000..ea5b168ed --- /dev/null +++ b/test/manual/form-trigger.html @@ -0,0 +1,29 @@ + + + + Mocha Tests + + + + + + + + + + + +

Working Checkbox and Datepicker

+

A modified click trigger on a form, doesn't prevent the default behaviour of other elements

+

The checkbox can be checked, a click on the datepicker symbol opens the datepicker flyout

+ + + + + +
+ +
+ + +