Commit Graph

808 Commits

Author SHA1 Message Date
Solly Ross fda40d8927 Fix broken tests from changing default screen size
Commit 795fca23dc changed the default
size from 640 to 240.  This broke a couple tests which depended on
the default size being 640.  Those tests have now been fixed.
2014-11-17 14:19:19 -05:00
samhed bd6874e087 We should use the globally declared UI variable 2014-11-13 17:22:48 +01:00
samhed 795fca23dc Modify minimum width of clear to accomodate smaller screens 2014-11-11 16:29:06 +01:00
Solly a86f97e284 Merge pull request #410 from kanaka/docs/contributing-guidelines
Added in guidelines for contributing to noVNC
2014-11-06 11:15:11 -05:00
Solly Ross dbaf49f570 Added in guidelines for contributing to noVNC
In CONTRIBUTING.md, you can now find a set of guidelines for
contributing to the noVNC project.  They detail coding style
information, requirements for pull requests, and how to run
the unit tests.
2014-11-02 13:27:06 -05:00
Solly Ross ec31f82eda Fix Cursor Issue When Using True Color
This fixes an issue where, when using true color, the changeCursor
function would not actually write the cursor to the target array.

Fixes #407
2014-10-29 19:18:34 -04:00
Samuel e2f1ff8048 Merge pull request #402 from julien-f/patch-1
Fix subprotocols
2014-10-01 16:46:35 +02:00
Julien Fontanet 58ca1978ea Fix subprotocols
Broken by b1dee94788
2014-10-01 16:30:39 +02:00
Solly Ross 3257d9f265 Force Travis to use Node 0.11.13
The latest version of Node.js has a bug that
affects the Karma test runner.  A patch has been
merged to Karma, but has not landed in a version
yet.  Until a new version of Karma is released,
we should keep node at 0.11.13.

See karma-runner/karma#1182

(cherry picked from commit 9af2346a0cead634f3af5f390770ea65929c1f4a)
2014-09-30 12:21:03 -04:00
Solly 2930403a11 Merge pull request #397 from kanaka/refactor/use-object-defineproperty
Make Utils.js use Object.define to modify Array
2014-09-30 11:57:10 -04:00
Solly Ross f9fd0313b8 Make Utils.js use Object.define to modify Array
Previously, we were modifying Array's prototype using
simple assignment.  This can mess with enumeration/iteration.
Thus, we now use Object.defineProperty with enumerable set to
false.

See #366
2014-09-22 22:30:19 -04:00
Solly Ross 58529d347b Correct Travis CI Badge URL
The readme was using the URL for the 'refactor/cleanup'
branch, which doesn't exist anymore.  It now uses
the badge for the master branch as it should.
2014-09-22 21:49:17 -04:00
Solly Ross b11bb5c385 Add support for Relative Paths in the Test Runner
This patch adds support for using relative paths
with the '-r' or '--relative' methods.  This can
be useful if you want to output HTML (with the
'--output-html' option) and use it in a webpage.

Additionally, the '-o' was removed from the documentation
of '--output-html', since it hasn't worked for that in a
while ('-o' means open in browser instead).
2014-09-22 21:42:32 -04:00
Solly Ross 0b0b0433b5 Fix Race Condition in Display#clear on IE10
There was a race condition in Display#clear on IE10
because we resize and then clear that causes the canvas
to not actually end up cleared.  Clearing the current
viewport first solves the issue.  It doesn't appear to
affect other platforms, so it's inside a engine check
(`Util.Engine.trident === 6`).  Once we stop supporting
IE10, we should just remove this, because it's not the best
to have Engine-specific code.
2014-09-22 21:37:04 -04:00
Solly Ross 3b4fd003c2 Fixed broken mouse test in test.rfb.js
Because we use the XOR (`^`) operator, the button mask must be
set before a MouseUp event happens, otherwise we'll send a pointer
event like it was a MouseDown event.  The button mask was not set
in one of the tests, so the test was failing.
2014-09-19 15:14:34 -04:00
Solly Ross 53762c31fe 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.
2014-09-19 14:51:15 -04:00
Solly Ross cfc02e5e2b Fixed presence detection bug in utils.set_defaults
Previously, Utils.set_defaults was using `if(conf[keys[i]])`
to check for the presence of a configuration key.  This would
fail if `conf[keys[i]]` happened to be false.  Instead, we now
use `if(keys[i] in conf)`, which simply checks for the presence
of the key in the conf object.
2014-09-19 14:48:00 -04:00
Solly Ross d02a99f0c8 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
2014-09-19 14:18:45 -04:00
Solly Ross f0e4548b16 Fix Travis Sauce Tunnel Issues
Travis is failing because Sauce can't find the appropriate tunnelid.
This should fix that but setting the tunnel id to be the Travis
job number.
2014-09-19 12:56:53 -04:00
Solly e4e9a9b97f Merge pull request #391 from mandre/fix_invalid_property
Fix invalid updateState property on RFB preventing noVNC to load
2014-09-19 12:35:27 -04:00
Solly Ross 2c9623b5a7 Fixed assertion collision issues
When run via karma, all the tests are loaded into the same page.
This was causing a collision in the 'displayed' assertion dealing
with using viewportLoc.

The assertions are now in their own file, pulled in by tests that
need them.  Additionally, several tests which only set fb_width
and fb_height were correct to set viewportLoc as well.

Closes #392

Also-Authored-By: Martin André (github: mandre)
2014-09-19 12:16:06 -04:00
Solly Ross f8f95d6023 Added Sauce Auth Details for Travis CI
This will enable Travis CI to run tests on Sauce Labs
(thanks to OpenSauce, their free program for Open
Source Software)
2014-09-19 11:43:58 -04:00
Martin André 77bd04f833 Fix invalid updateState property of RFB
It was changed to `onUpdateState` in
b1dee94788.
2014-09-17 16:56:13 +09:00
Martin André 7caa9c20c2 Prevent noVNC loading error when invalid property is set on object
Util.set_defaults should accommodate with missing properties to prevent
'Uncaught TypeError: Cannot read property 'call' of undefined' error.
2014-09-17 16:50:05 +09:00
Solly 0ca7cf4867 Merge pull request #368 from DirectXMan12/refactor/cleanup
Cleanup and test all the things (plus ditching Crockford)!
2014-09-15 16:50:20 -04:00
Solly Ross e6af0f60b0 Add support for Travis CI and SauceLabs Testing
This adds support for Travis CI and SauceLabs
testing.  Testing on SauceLabs in done via
the Karma test runner.  Note that encrypted
Sauce username and access key values need
to be inserted into .travis.yml as global
environment variables.  Additionally, the
local test runner (which is still useful
for debugging tests and code) was updated
to reflect that the 'node_modules' folder
now gets placed in the root directory.
2014-09-15 16:46:02 -04:00
Solly Ross bbbf42bb5a Cleanup: UI code
File: ui.js
Tests Added: False

Changes:
- Fix JSHint errors
- add some curly braces to improve clarity
- move variable declarations to relevant locations instead of at the top
  of methods
2014-09-15 16:46:02 -04:00
Solly Ross b1dee94788 Cleanup: RFB Client
File: rfb.js (also websock.js)
Tests Added: True

Changes:
- De-Crockford-ified rfb.js
- Added methods to websock.js to skip bytes in the receive queue
2014-09-15 16:46:02 -04:00
Solly Ross 1e13775bd5 Cleanup: Display Helper
File: display.js
Tests Added: True (preliminary)

Changes:
- De-crockford-ified the file

NOTE: the tests included for display.js cover basic functionality, but
are by no means nearly as comprehensive as the ones presented for
rfb.js.
2014-09-15 16:46:02 -04:00
Solly Ross 2cccf7530c Cleanup: WebSocket Helper
File: websock.js
Tests Added: True
Changes:
- Cleaned up JSHint errors
- Converted to normal JS constructor pattern with "private" fields and
  methods now simply being prepended by underscores
- Added a "bind" polyfill for use in PhantomJS 1.x in util.js
- Added FakeWebSocket to fill in for actual WebSocket objects when
  testing
- Made exception handler actually log exception name and message,
  to console, in addition to stack trace
2014-09-15 16:46:02 -04:00
Solly Ross ee7d4c61c6 Cleanup: Webutil code
File: webutil.js
Tests Added: False
Changes:
- Fixed JSHint Errors (global "use strict", spaces)
- added some newline characters when appropriate for readability
- moved variable declarations to the places they were actually used
  for readability
2014-09-15 16:46:02 -04:00
Solly Ross 31f169e86f Cleanup: Keyboard code
File: keyboard.js
Tests Added: False (already present)
Changes:
- Fixed JSHint Errors
- Moved functions outside loops
- Added proper include directives to tests
2014-09-15 16:46:02 -04:00
Solly Ross d6e281baf6 Cleanup: Input code
File: input.js
Tests Added: False (already present partially -- see below)
Changes:
- Fixed JSHint Errors
- Converted to normal non-Crockford constructors

NOTE: while there are tests for the actual key-detecting functionality,
      the tests do not cover the actual Keyboard and Mouse objects
      themselves.
2014-09-15 16:46:02 -04:00
Solly Ross d21cd6c164 Cleanup: Util code
File: util.js
Tests Added: True (partial -- for logging and array push methods)
Changes:
- Fixed JSHint Errors (indentation, semicolons, global "use strict")
- Made browser detection methods more readable
- added some newline characters when appropriate for readability
- throw Errors not strings!
- Removed conf_defaults, and added make_properties and set_defaults
  instead (see below)

The removal of conf_defaults and switch to make_properties and
set_defaults is to facilitate the switch over to normal Javascript
constructors instead of Crockford-style constructors.  Now, methods
are added to the objects prototype (and thus make properties is called
outside the constructor).
2014-09-15 16:46:02 -04:00
Solly Ross fb64ed2135 Cleanup: DES code
File: des.js
Tests Added: False
Changes:
- Fixed JSHint Errors
- Improved whitespace around operators
2014-09-15 16:46:02 -04:00
Solly Ross f8e9b9f1bf Cleanup and Test: base64.js
This is the first commit in a series of commits
which improve the readability of some of the code
and add tests.

File: base64.js
Tests Added: True
Changes:
- Improved indentation
- Fixed JSHint errors
- Moved loop variables to be declared in the loop for better readability
  (N.B. Javascript does not have block scoping, so the variables are
  still technically available outside the loop -- it just makes the code
  clearer to place them inside the loop, since they are only used there)
2014-09-15 16:46:02 -04:00
Solly Ross 95eb681bbb Support the "NOTUNNEL" tunnel type for TightVNC
Previously, tight auth was supported without any support for tunnels,
even the no-op tunnel.  No, the no-op tunnel type is supported.
2014-09-15 16:46:02 -04:00
Solly Ross 91127741be Support running all tests from the root directory
Previously, if you did not specify a tests file,
you had to be in the 'tests' directory for the
"run all tests" functionality to work.  Now it
will work in any directory.
2014-09-15 16:44:36 -04:00
samhed 960752ea53 fixes an error that was made in the merge with the last sync with websockify. 2014-08-19 13:49:55 +02:00
Solly Ross 9b731d3a58 Fix race condition in test runner
Previously, there would be a case where if your tests took
too long to run, the casper test runner would only report
on certain tests.  This has been fixed.
2014-06-03 17:42:28 -04:00
Solly Ross 93af721a27 Output error events from provider in test runner
Now, 'error' events from the test runner are output to stderr.
Additionally, when debug is enabled, debug output is logged to
stderr instead of stdout (as was the case previously).
2014-06-03 16:58:37 -04:00
Solly Ross 7187bc121f Fixed typo in run_from_console.js 2014-06-03 13:15:02 -04:00
Solly Ross d906dfc953 Add support for injecting test helper files
Now, the phrase `requires test modules: ` may be place in a comment
in a file to require modules local to the test directory, similarly
to the way the `require local modules: ` line may be used to inject
files in the 'include' directory.  This is useful for when common
fakes need to be injected into a test.
2014-06-03 11:17:33 -04:00
Solly Ross 4a4643c05d Support automatically opening test HTML in browser
When using the '-g' option with run_from_console.js, you can
now pass the '-o' option to automatically open the generated
HTML file in your default browser.  This relies on the 'open'
NPM module.
2014-06-03 11:17:29 -04:00
Samuel dd3a8a1b6d Merge pull request #363 from kosmasgiannis/query_parse
Better parsing of query string variables
2014-05-06 09:13:18 +02:00
Giannis Kosmas d8c0953567 Better parsing of query string variables 2014-05-05 23:23:48 +03:00
Solly Ross c77938efc9 Fix for scroll offset in Util.getPosition()
Previously, Util.getPosition didn't deal with scrolling
particularly well.  This fixes that by calculating the
scroll offset when dealing with getting mouse positions.

Credit to @erikgull and @emmar for the initial version of
the fix.  Credit to Brian Huismanfor the initial code.

Closes #295
Relevant to #258
2014-05-05 14:51:32 -04:00
samhed 082027dc87 Sync with websockify
Pull 90b519edf0c1857d
2014-04-14 14:45:15 +02:00
samhed 60a415ae1c Credit for this fix goes to Jesper Dam (https://github.com/Medical-Insight/noVNC/tree/fix-ie10-keyboard).
Fix keyboard handling for IE10 (issue #352)
* Keyboard events in IE10 do not provide any useful information on the properties 'which', 'char' or 'charCode'. Instead, it seems to store the char code in the keyCode property.
2014-04-14 13:26:52 +02:00
samhed 8f4a291b16 Updated the comment in vnc.html to reflect the changes made in last commit. 2014-04-07 16:58:59 +02:00