File: hx-patch.js

package info (click to toggle)
htmx 4.0.0-alpha6-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 117,328 kB
  • sloc: javascript: 49,403; sh: 29; makefile: 7
file content (20 lines) | stat: -rw-r--r-- 537 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
describe('hx-patch attribute', function() {

    beforeEach(() => {
        setupTest(this.currentTest)
    })

    afterEach(() => {
        cleanupTest(this.currentTest)
    })

    it('issues a PATCH request', async function() {
        mockResponse('PATCH', '/test', 'Patched!')
        let btn = createProcessedHTML('<button hx-patch="/test">Click Me!</button>')
        btn.click()
        await forRequest()
        fetchMock.calls[0].request.method.should.equal('PATCH');
        btn.innerHTML.should.equal('Patched!')
    })

})