describe('htmx.config.metaCharacter functionality', function() { beforeEach(function() { setupTest(this); htmx.config.metaCharacter = "-"; }); afterEach(function() { cleanupTest(); htmx.config.metaCharacter = null; }); it('works with inherited modifier using custom meta character', async function() { mockResponse('GET', '/test', 'Success'); createProcessedHTML('
'); find('#btn').click() await forRequest(); var output = find("#output"); output.innerText.should.equal("Success") }); it('works with append modifier using custom meta character', function() { const container = createDisconnectedHTML( '
' + ' ' + '
' ); const button = container.querySelector('button'); const result = htmx.__attributeValue(button, 'hx-vals'); assert.equal(result, '"a":1,"b":2'); }); it('works with inherited-append modifier using custom meta character', function() { const container = createDisconnectedHTML( '
' + '
' + ' ' + '
' + '
' ); const button = container.querySelector('button'); const result = htmx.__attributeValue(button, 'hx-vals'); assert.equal(result, '"a":1,"b":2,"c":3'); }); it('normalizes attribute names using custom meta character', function() { const div = createDisconnectedHTML( '
' ); assert.equal(htmx.__attributeValue(div, 'hx-ws:connect'), '/ws'); assert.equal(htmx.__attributeValue(div, 'hx-ws:send'), ''); }); it('onLoad works with custom meta character', function() { let fired = false; htmx.onLoad(() => fired = true); createProcessedHTML('
Test
'); assert.isTrue(fired); }); it('works with hx-on events using custom meta character', async function() { let eventFired = false; createProcessedHTML(''); find('#btn').click(); await htmx.timeout(50); assert.equal(window.testEvent, true); delete window.testEvent; }); });