From 74c4abe1be97550477ef281c71ed972798f40327 Mon Sep 17 00:00:00 2001 From: carson Date: Sat, 27 Feb 2021 17:43:58 -0700 Subject: [PATCH] add test for shouldCancel() contribution by Bo Peng --- test/core/internals.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/core/internals.js b/test/core/internals.js index 1af2293c..e9513420 100644 --- a/test/core/internals.js +++ b/test/core/internals.js @@ -41,4 +41,24 @@ describe("Core htmx internals Tests", function() { chai.expect(htmx._("tokenizeString")("aa.aa")).to.be.deep.equal(['aa', '.', 'aa']); }) + it("tags respond correctly to shouldCancel", function() { + var anchorThatShouldCancel = make(""); + htmx._("shouldCancel")(anchorThatShouldCancel).should.equal(true); + + var anchorThatShouldNotCancel = make(""); + htmx._("shouldCancel")(anchorThatShouldNotCancel).should.equal(false); + + var form = make("
"); + htmx._("shouldCancel")(form).should.equal(true); + + var form = make("
"); + var input = byId("i1"); + htmx._("shouldCancel")(input).should.equal(true); + + var form = make("