describe('hx-get attribute', function() { beforeEach(() => { setupTest(this.currentTest) }) afterEach(() => { cleanupTest(this.currentTest) }) it('issues a GET request on click and swaps content', async function () { mockResponse('GET', '/test', 'Clicked!') let btn = createProcessedHTML(''); btn.click() await forRequest() playground().innerText.should.equal('Clicked!') }) it.skip('GET does not include surrounding data by default', async function () { // TODO do we want to drop this behavior except in the case of boosted links? mockResponse('GET', '/test', "Clicked!") createProcessedHTML('
') find('#b1').click() await forRequest() lastFetch().url.should.equal("/test"); assertTextContentIs("#p1", 'Clicked!') }) it('GET on form includes its own data by default', async function () { mockResponse('GET', '/test', "Clicked!") let form = createProcessedHTML(''); form.requestSubmit() await forRequest(); playground().innerHTML.should.equal('Clicked!') lastFetch().url.should.equal("/test?i1=value"); }) it('GET on form with existing parameters works properly', async function () { mockResponse('GET', '/test', "Clicked!") let form = createProcessedHTML(''); form.requestSubmit() await forRequest(); playground().innerHTML.should.equal('Clicked!') console.log("*********", lastFetch().url, "/test?foo=bar&i1=value") lastFetch().url.should.equal("/test?foo=bar&i1=value"); }) it('GET on form with existing parameters works properly', async function () { mockResponse('GET', '/test', "Clicked!") let form = createProcessedHTML(''); form.requestSubmit() await forRequest(); playground().innerHTML.should.equal('Clicked!') lastFetch().url.should.equal("/test?foo=bar&i1=value"); }) it('GET on form with anchor works properly and scrolls to anchor id', async function() { mockResponse('GET', '/test', '