mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-30 22:41:23 +00:00
32 lines
989 B
JavaScript
32 lines
989 B
JavaScript
describe("kutty Direct Swap", function () {
|
|
beforeEach(function () {
|
|
this.server = makeServer();
|
|
clearWorkArea();
|
|
});
|
|
afterEach(function () {
|
|
this.server.restore();
|
|
clearWorkArea();
|
|
});
|
|
|
|
it('handles basic response properly', function () {
|
|
this.server.respondWith("GET", "/test", "Clicked<div id='d1' kt-swap-oob='true'>Swapped</div>");
|
|
var div = make('<div kt-get="/test">click me</div>');
|
|
make('<div id="d1"></div>');
|
|
div.click();
|
|
this.server.respond();
|
|
div.innerHTML.should.equal("Clicked");
|
|
byId("d1").innerHTML.should.equal("Swapped");
|
|
})
|
|
|
|
it('handles no id match properly', function () {
|
|
this.server.respondWith("GET", "/test", "Clicked<div id='d1' kt-swap-oob='true'>Swapped</div>");
|
|
var div = make('<div kt-get="/test">click me</div>');
|
|
div.click();
|
|
this.server.respond();
|
|
div.innerText.should.equal("Clicked");
|
|
})
|
|
|
|
|
|
});
|
|
|