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

var assert = require('assert');
var jsdom_global = require('jsdom-global');
var vis = require('../dist/vis');
var Graph3d = vis.Graph3d;
describe('Graph3d', function () {
before(function() {
//console.log('before!');
this.jsdom_global = jsdom_global(
"<div id='mynetwork'></div>",
{ skipWindowCheck: true}
);
this.container = document.getElementById('mynetwork');
});
it('accepts new option values on defined instance', function () {
assert(this.container !== null, 'Container div not found');
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(this.container, data, options);
assert.equal(graph.style, DOT_STYLE, "Style not set to expected 'dot'");
graph.setOptions({ style: 'bar'}); // Call should just work, no exception thrown
assert.equal(graph.style, BAR_STYLE, "Style not set to expected 'bar'");
});
after(function() {
//console.log('after!');
this.jsdom_global();
});
});