mirror of
https://github.com/bigskysoftware/htmx.git
synced 2026-01-19 23:26:10 +00:00
add test for shouldCancel() contribution by Bo Peng
This commit is contained in:
parent
a4412db6be
commit
74c4abe1be
@ -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("<a href='/foo'></a>");
|
||||
htmx._("shouldCancel")(anchorThatShouldCancel).should.equal(true);
|
||||
|
||||
var anchorThatShouldNotCancel = make("<a href='#'></a>");
|
||||
htmx._("shouldCancel")(anchorThatShouldNotCancel).should.equal(false);
|
||||
|
||||
var form = make("<form></form>");
|
||||
htmx._("shouldCancel")(form).should.equal(true);
|
||||
|
||||
var form = make("<form><input id='i1' type='submit'></form>");
|
||||
var input = byId("i1");
|
||||
htmx._("shouldCancel")(input).should.equal(true);
|
||||
|
||||
var form = make("<form><button id='b1' type='submit'></form>");
|
||||
var button = byId("b1");
|
||||
htmx._("shouldCancel")(button).should.equal(true);
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user