Forráskód Böngészése

Fixed Typo Causing MouseUp to not Register

There was a typo in one of the instances of the _buttonMask field
(it was written as _buttonMaks), causing MouseUp to never be sent.
This has been rectified, and the unit tests for the mouse handler
have been changed to check for explicitly sending mouseup and
mousedown.

Fixes #393
Solly Ross 11 éve
szülő
commit
d02a99f0c8
2 módosított fájl, 15 hozzáadás és 1 törlés
  1. 1 1
      include/rfb.js
  2. 14 0
      tests/test.rfb.js

+ 1 - 1
include/rfb.js

@@ -550,7 +550,7 @@ var RFB;
             if (down) {
             if (down) {
                 this._mouse_buttonMask |= bmask;
                 this._mouse_buttonMask |= bmask;
             } else {
             } else {
-                this._mouse_buttonMaks ^= bmask;
+                this._mouse_buttonMask ^= bmask;
             }
             }
 
 
             if (this._viewportDrag) {
             if (this._viewportDrag) {

+ 14 - 0
tests/test.rfb.js

@@ -1512,6 +1512,20 @@ describe('Remote Frame Buffer Protocol Client', function() {
                 expect(client._sock.send).to.have.been.calledWith(pointer_msg);
                 expect(client._sock.send).to.have.been.calledWith(pointer_msg);
             });
             });
 
 
+            it('should send a mask of 1 on mousedown', function () {
+                client._mouse._onMouseButton(10, 12, 1, 0x001);
+                expect(client._sock.send).to.have.been.calledOnce;
+                var pointer_msg = RFB.messages.pointerEvent(10, 12, 0x001);
+                expect(client._sock.send).to.have.been.calledWith(pointer_msg);
+            });
+
+            it('should send a mask of 0 on mouseup', function () {
+                client._mouse._onMouseButton(10, 12, 0, 0x001);
+                expect(client._sock.send).to.have.been.calledOnce;
+                var pointer_msg = RFB.messages.pointerEvent(10, 12, 0x000);
+                expect(client._sock.send).to.have.been.calledWith(pointer_msg);
+            });
+
             it('should send a pointer event on mouse movement', function () {
             it('should send a pointer event on mouse movement', function () {
                 client._mouse._onMouseMove(10, 12);
                 client._mouse._onMouseMove(10, 12);
                 expect(client._sock.send).to.have.been.calledOnce;
                 expect(client._sock.send).to.have.been.calledOnce;