summaryrefslogtreecommitdiff
path: root/tests/test.rfb.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test.rfb.js')
-rw-r--r--tests/test.rfb.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/test.rfb.js b/tests/test.rfb.js
index 75d1e11..ad00edf 100644
--- a/tests/test.rfb.js
+++ b/tests/test.rfb.js
@@ -111,11 +111,12 @@ describe('Remote Frame Buffer Protocol Client', function () {
};
// Avoiding printing the entire Websock buffer on errors
- Websock.prototype.toString = function () { return "[object Websock]"; };
+ Websock.prototype.inspect = function () { return "[object Websock]"; };
});
after(function () {
- delete Websock.prototype.toString;
+ Websock.prototype._allocateBuffers = Websock.prototype._oldAllocateBuffers;
+ delete Websock.prototype.inspect;
this.clock.restore();
window.requestAnimationFrame = raf;
window.ResizeObserver = realObserver;
@@ -432,6 +433,22 @@ describe('Remote Frame Buffer Protocol Client', function () {
new Uint8Array([97, 98, 99]));
});
+ it('should mask unsupported characters', function () {
+ client.clipboardPasteFrom('abc€');
+
+ expect(RFB.messages.clientCutText).to.have.been.calledOnce;
+ expect(RFB.messages.clientCutText).to.have.been.calledWith(client._sock,
+ new Uint8Array([97, 98, 99, 63]));
+ });
+
+ it('should mask characters, not UTF-16 code points', function () {
+ client.clipboardPasteFrom('😂');
+
+ expect(RFB.messages.clientCutText).to.have.been.calledOnce;
+ expect(RFB.messages.clientCutText).to.have.been.calledWith(client._sock,
+ new Uint8Array([63]));
+ });
+
it('should send an notify if extended clipboard is supported by server', function () {
// Send our capabilities
let data = [3, 0, 0, 0];