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
This commit is contained in:
Solly Ross 2014-09-19 14:17:15 -04:00
parent f0e4548b16
commit d02a99f0c8
2 changed files with 15 additions and 1 deletions

View File

@ -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) {

View File

@ -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;