diff options
author | Solly Ross <sross@redhat.com> | 2014-09-19 14:51:15 -0400 |
---|---|---|
committer | Solly Ross <sross@redhat.com> | 2014-09-19 14:51:15 -0400 |
commit | 53762c31fe21a7ac39f124cd3dfb0d3f894ebe7c (patch) | |
tree | 96bb3aa127cce52b6cfd089bb5b96d704dbdba2d /tests/test.display.js | |
parent | cfc02e5e2bccfe2c1a80e4097372b8423ce9d87a (diff) | |
download | novnc-53762c31fe21a7ac39f124cd3dfb0d3f894ebe7c.tar.gz |
Fixed Cursor URI Support Detection
There was a bug in cursor URI support detection due to the way
set_defaults now works -- the code was checking for `null`, whereas
when not set, options default to `undefined` unless otherwise
specified. The code now checks for either `null` or `undefined`.
Tests have been added to ensure that this works properly.
Diffstat (limited to 'tests/test.display.js')
-rw-r--r-- | tests/test.display.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test.display.js b/tests/test.display.js index 832970d..25adfbe 100644 --- a/tests/test.display.js +++ b/tests/test.display.js @@ -26,6 +26,40 @@ describe('Display/Canvas Helper', function () { return canvas; } + describe('checking for cursor uri support', function () { + beforeEach(function () { + this._old_change_cursor = Display.changeCursor; + }); + + it('should disable cursor URIs if there is no support', function () { + Display.changeCursor = function(target) { + target.style.cursor = undefined; + }; + var display = new Display({ target: document.createElement('canvas'), prefer_js: true, viewport: false }); + expect(display._cursor_uri).to.be.false; + }); + + it('should enable cursor URIs if there is support', function () { + Display.changeCursor = function(target) { + target.style.cursor = 'pointer'; + }; + var display = new Display({ target: document.createElement('canvas'), prefer_js: true, viewport: false }); + expect(display._cursor_uri).to.be.true; + }); + + it('respect the cursor_uri option if there is support', function () { + Display.changeCursor = function(target) { + target.style.cursor = 'pointer'; + }; + var display = new Display({ target: document.createElement('canvas'), prefer_js: true, viewport: false, cursor_uri: false }); + expect(display._cursor_uri).to.be.false; + }); + + afterEach(function () { + Display.changeCursor = this._old_change_cursor; + }); + }); + describe('viewport handling', function () { var display; beforeEach(function () { |