mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-29 22:11:22 +00:00
23 lines
732 B
JavaScript
23 lines
732 B
JavaScript
describe("event-header extension", function() {
|
|
beforeEach(function () {
|
|
this.server = makeServer();
|
|
clearWorkArea();
|
|
});
|
|
afterEach(function () {
|
|
this.server.restore();
|
|
clearWorkArea();
|
|
});
|
|
|
|
it('Sends the Triggering-Event header', function () {
|
|
this.server.respondWith("GET", "/test", function (xhr) {
|
|
xhr.respond(200, {}, xhr.requestHeaders['Triggering-Event'])
|
|
});
|
|
var btn = make('<button hx-get="/test" hx-ext="event-header">Click Me!</button>')
|
|
btn.click();
|
|
this.server.respond();
|
|
var json = JSON.parse(btn.innerText);
|
|
json.type.should.equal("click");
|
|
json.target.should.equal("button");
|
|
});
|
|
|
|
}); |