vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

  1. var assert = require('assert');
  2. var jsdom_global = require('jsdom-global');
  3. var vis = require('../dist/vis');
  4. var Graph3d = vis.Graph3d;
  5. describe('Graph3d', function () {
  6. before(function() {
  7. //console.log('before!');
  8. this.jsdom_global = jsdom_global(
  9. "<div id='mynetwork'></div>",
  10. { skipWindowCheck: true}
  11. );
  12. this.container = document.getElementById('mynetwork');
  13. });
  14. it('accepts new option values on defined instance', function () {
  15. assert(this.container !== null, 'Container div not found');
  16. var BAR_STYLE = 0; // from var STYLE in Settings.js
  17. var DOT_STYLE = 3; // idem
  18. var data = [
  19. {x:0, y:0, z: 10},
  20. {x:0, y:1, z: 20},
  21. {x:1, y:0, z: 30},
  22. {x:1, y:1, z: 40},
  23. ];
  24. var options = {
  25. style: 'dot'
  26. };
  27. var graph = new vis.Graph3d(this.container, data, options);
  28. assert.equal(graph.style, DOT_STYLE, "Style not set to expected 'dot'");
  29. graph.setOptions({ style: 'bar'}); // Call should just work, no exception thrown
  30. assert.equal(graph.style, BAR_STYLE, "Style not set to expected 'bar'");
  31. });
  32. after(function() {
  33. //console.log('after!');
  34. this.jsdom_global();
  35. });
  36. });