From 963eaff841c30d81d4ee5d69e81d5f0133a54052 Mon Sep 17 00:00:00 2001 From: Andrea Ambu Date: Fri, 15 Nov 2024 09:52:00 +0000 Subject: [PATCH] with tests --- src/ws/test/ext/ws.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ws/test/ext/ws.js b/src/ws/test/ext/ws.js index 3220b40..28590dd 100644 --- a/src/ws/test/ext/ws.js +++ b/src/ws/test/ext/ws.js @@ -618,6 +618,17 @@ describe('web-sockets extension', function() { this.messages[1].should.contains('"action":"B"') }) + it('maybeClose does not raise when there is no socket', function() { + var div = make('
div1
') + this.tickMock() + var internalData = div['htmx-internal-data'] + should.exist(internalData.webSocket) + delete internalData.webSocket + should.not.exist(internalData.webSocket) + div.parentNode.removeChild(div) + this.tickMock() + }) + describe('Send immediately', function() { function checkCallForWsBeforeSend(spy, wrapper, message, target) { // Utility function to always check the same for htmx:wsBeforeSend caught by a spy