Debian Codegraph @

test/tests/end2end/oob.js

raw symbols SCIP
1 describe('Out of Band Swaps', function() {
2 afterEach(function() {
3 cleanupTest()
4 })
5
6 it('Basic OOB swap works', async function() {
7 // Set up mock response
8 mockResponse('GET', '/demo', new MockResponse(
9 `<div id="result">Success!</div>
10 <htmx-action type="partial" hx-target="#d2">
11 <div id="d3">Success OOB!<p></p></div>
12 </htmx-action>`));
13 // Create test button
14 createProcessedHTML(`
15 <button id="btn1" hx-action="/demo">Button</button>
16 <div id="d1">Div 1</div>
17 <div id="d2">Div 2</div>
18 `);
19 // Click the button
20 find('#btn1').click()
21 await forRequest();
22 // verify the oob swap occurred
23 assertTextContentIs('#d3', "Success OOB!");
24 })
25 })