* Adds code coverage report the output of `npm test` and adds detailed html code coverage report using the command `npm run-script test-cov`
* Switch over to using functions in lib/ rather than dist/, so that code coverage stats are complete.
* Import vis at the top level to keep ItemSet passing
* Remove requirement for dist/vis in TimelineItemSet
* Network: preload images in options for all shape types
Fixes#3532
If the images option is set, preload it, even if the node shape is not `image` or `circularImage`.
This needs to be done because the user can switch to an image shape later, as is happening in the issue.
Option `image` is only mandatory for the image shapes.
There is no unit test for this, because it would need a mock object for Image and I didn't succeed in creating/finding one.
* Network: Handle null data gracefully
During testing I discovered that passing `null` for network data leads to a thrown error.
This adds a guard to prevent it, plus unit tests for regression.
* Use mock canvas object replacing `canvas`
Fixes#3515.
A mock canvas object is added to the unit tests, which makes usage of module `canvas` voluntary.
The issue with `canvas` is that it requires an external dependency to `cairo`. This complicates setting up a develop environment for `vis.js`
- Removed `canvas` from `package.json`
- Added section to README.md with instructions on how to install `canvas` instead.
* Removed debugger statements
* Updates for review
* Fixes for review
* Network: Prevent crash when dataChanged is triggered during initial setting of options
Fixes#3562.
Options `hidden` and `physics` can emit a `_dataChanged` event within `setOptions()`.
If this happens when setting options during the initialization of the `Network` instance, this leads
to an error thrown, because there is no DataSet instance connected yet to the instance.
This bug was introduced in `v4.21.0`. Unit tests have been added for this case.
* Edited comment
* Added unit test for Array.prototype mangling - first passing version
* Enhanced unit test for prototype stressing to catch more illegal for-in loops
* Fixed all for-in linting violations
* The next fix on Travis unit test failure
This is the next escalation on the war against the Travis unit tests failing (which came into being by yours truly).
By accident, I could recreate the unit test failure on my development machine. This led to a more directed effort to
squash the bug.
The insight here is that test `(window === undefined)` fails, but `(typeof window === 'undefined`)` succeeds. This undoubtedly has to do with the special status `window` has as a global object.
Changes:
- Added check on presence of `window` in `Canvas._requestNextFrame()`, fixed local source errors.
- Added catch clause in `CanvasRendered._determinePixelRatio()`
- small fix: raised timeout for the network `worldCup2014` unit test
* Preliminary refactoring in utils.js
* Added unit tests for extend routines, commenting and small fixes
* More unit tests for extend routines
* - Completed unit tests for extend routines in
- Small fixes and cleanup in `util.js`
- Removed `util.protoExtend()`, not used anywhere
* Added unit tests for known font options
* Network: Fixes sorting on Layout sorting, refactoring.
Fix for #3403
Chromium has divergent behaviour on sorting of `undefined` values, a check has been added for these.
The fix itself is small, it adds a check on `undefined` in the sorting function(s).
In addition:
- Fixed off-by-one error on tree index
- Refactored away checks on visibility by replacing `_isVisible()` with a Strategy pattern for direction
The latter removes a long-standing eyesore in `LayoutManager`; it's probably also faster.
There is some hope that these fixes will improve the hierarchical layout initialization, which has had
problems for quite a while.
* reformat code block
* Add next attempt to fix Travis unit test bug
* Fix unit test - timeout
* Adjustments for comment reviews
* Moved direction strategies to separate module; added fix for 'window is undefined'
This is the next escalation on the war against the Travis unit tests failing (which came into being by yours truly).
By accident, I could recreate the unit test failure on my development machine. This led to a more directed effort to
squash the bug.
The insight here is that test `(window === undefined)` fails, but `(typeof window === 'undefined`)` succeeds. This undoubtedly has to do with the special status `window` has as a global object.
Changes:
- Added check on presence of `window` in `Canvas._requestNextFrame()`, fixed local source errors.
- Added catch clause in `CanvasRendered._determinePixelRatio()`
- small fix: raised timeout for the network `worldCup2014` unit test
* added hexagon shape to the node.
* Updated function for hexagon shape.js
* Modifid the shape login for hexagon
* Remove this.translate from the Shape.js for hexagon
* updated hexagon draw logic
* Fixed code review comments and update the branch
* Updated changes in test.js
* First fix for opening clusters, added unit tests
* Added opening of child cluster to parent cluster
* Added more tests for multi-level clusters
* Commenting fixes
* Added unit tests for option allowSingleNodeCluster, fixes due to that
* Added test for allowSingleNodeCluster with nested clusters
* Fixes due to linting
* Removed TODO from code
Fix for #3367
Changes:
- Clustered nodes with shared connections are added to the same cluster
- joinCondition value `null` handled as `undefined`
- Fixed bug on adding clusters if joinCondition present and returns true
Unit tests have been added to `Network.test.js` for these changes.
* Added commenting for options, refactored choosify()
* Refactored updateLabelModule()
* added comment at node creation
* Completed fix for #3350
* parseOptions() different handling for bridged/extended; unit tests for reversal of options
* Fixes on linting and unit testing
* Enable unit testing for module Network
Adds mocks for certain components, in order to let module `Network` be run in unit tests.
Changes:
- Create a mock object for `hammer.js` when running browserless. The inspiration is taken from [here](https://github.com/uber/deck.gl/pull/658)
- Create a mock function for `window.requestAnimationFrame()` when running browserless in `network/modules/CanvasRenderer.js`
- Added unit test for `Network` to show that unit testing for it now works
- Fixed naming of container in `test/Graph3d.test.js`
Since `hammer.js` is also used in other modules, this fix is potentially an enabler for full-module unit tests for those as well.
* Cleanup unit test Network
* Fix for unit test
* Added example networks to unit test
* Fix error in loading disassemblerExample
* Network unit test final fixes
* Adjusted comments
* First working version of updating clustered edge
* Added fix for #1315 as well
* Enable unit testing for module Network
Adds mocks for certain components, in order to let module `Network` be run in unit tests.
Changes:
- Create a mock object for `hammer.js` when running browserless. The inspiration is taken from [here](https://github.com/uber/deck.gl/pull/658)
- Create a mock function for `window.requestAnimationFrame()` when running browserless in `network/modules/CanvasRenderer.js`
- Added unit test for `Network` to show that unit testing for it now works
- Fixed naming of container in `test/Graph3d.test.js`
Since `hammer.js` is also used in other modules, this fix is potentially an enabler for full-module unit tests for those as well.
* Cleanup unit test Network
* Added unit test for fix issue #1218
* Adding test for #1315 - Interim save
* Completed unit test and fixes for #1315
* Added fixes for #1291
* Added unit test for #1219
* Added header comment for Clustering.js, small fixes
* Fix for unit test
* Added example networks to unit test
* Fix error in loading disassemblerExample
* Network unit test final fixes
* Fixes for linting
* Fixed essential typo
* Fixed linting error
* Fixed unit test
* Fixed unit test again