forked from almende/vis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a unit test for PR almende#3255 which fixes almende#3251. The unit test will fail without the PR merged. **NOTE:** This also adds module `canvas`, required for the unit test. This module proved to be quite fickly to install properly. During reviewing, please pay special attention to the proper installation of this modul. I.e. do following to test: ``` > npm install # If no errors, continue > npm test /tests/Graph3D.test.js # Run unit test isolated ```
- Loading branch information
1 parent
ad4d84d
commit a00e8f7
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var assert = require('assert'); | ||
var jsdom_global = require('jsdom-global'); | ||
var vis = require('../dist/vis'); | ||
var Graph3d = vis.Graph3d; | ||
|
||
|
||
describe('Graph3d', function () { | ||
var jsdom = jsdom_global("<div id='mynetwork'></div>"); | ||
var container = document.getElementById('mynetwork'); | ||
assert(container !== null, 'Container div not found'); | ||
|
||
it('accepts new option values on defined instance', function () { | ||
var BAR_STYLE = 0; // from var STYLE in Settings.js | ||
var DOT_STYLE = 3; // idem | ||
|
||
var data = [ | ||
{x:0, y:0, z: 10}, | ||
{x:0, y:1, z: 20}, | ||
{x:1, y:0, z: 30}, | ||
{x:1, y:1, z: 40}, | ||
]; | ||
|
||
var options = { | ||
style: 'dot' | ||
}; | ||
|
||
var graph = new vis.Graph3d(container, data, options); | ||
assert.equal(graph.style, DOT_STYLE, "Style not set to expected 'dot'"); | ||
|
||
graph.setOptions({ style: 'bar'}); // Call fails without PR #3255 | ||
assert.equal(graph.style, BAR_STYLE, "Style not set to expected 'bar'"); | ||
}); | ||
}); |