diff options
author | Samuel Mannehed <samuel@cendio.se> | 2021-12-10 00:40:59 +0100 |
---|---|---|
committer | Samuel Mannehed <samuel@cendio.se> | 2021-12-13 11:20:13 +0100 |
commit | a7b96087d764c86407ec629035ed39154c34d7c7 (patch) | |
tree | 7eb0801361b386919d8e28ad915e1e214b5a2b3a | |
parent | a78a7bf8aa0d8d321a8d17fe547c0b01f28197bf (diff) | |
download | novnc-a7b96087d764c86407ec629035ed39154c34d7c7.tar.gz |
Add some explanatory comments to test.rfb.js
-rw-r--r-- | tests/test.rfb.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/test.rfb.js b/tests/test.rfb.js index 98d5629..59b9cdf 100644 --- a/tests/test.rfb.js +++ b/tests/test.rfb.js @@ -74,6 +74,9 @@ describe('Remote Frame Buffer Protocol Client', function () { let fakeResizeObserver = null; const realObserver = window.ResizeObserver; + // Since we are using fake timers we don't actually want + // to wait for the browser to observe the size change, + // that's why we use a fake ResizeObserver class FakeResizeObserver { constructor(handler) { this.fire = handler; @@ -783,14 +786,18 @@ describe('Remote Frame Buffer Protocol Client', function () { 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 ]; - // First message should trigger a resize - + // This property is indirectly used as a marker for the first update client._supportsSetDesktopSize = false; + // First message should trigger a resize + client._sock._websocket._receiveData(new Uint8Array(incoming)); + // It should match the current size of the container, + // not the reported size from the server expect(RFB.messages.setDesktopSize).to.have.been.calledOnce; - expect(RFB.messages.setDesktopSize).to.have.been.calledWith(sinon.match.object, 70, 80, 0, 0); + expect(RFB.messages.setDesktopSize).to.have.been.calledWith( + sinon.match.object, 70, 80, 0, 0); RFB.messages.setDesktopSize.resetHistory(); |