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.

43 lines
1.1 KiB

  1. var assert = require('assert');
  2. var jsdom_global = require('jsdom-global');
  3. var canvasMockify = require('./canvas-mock');
  4. var DataAxis = require('../lib/timeline/component/DataAxis');
  5. describe('DataAxis', function () {
  6. beforeEach(function() {
  7. this.jsdom_global = canvasMockify("<svg id='svg'></svg>");
  8. this.svg = this.container = document.getElementById('svg');
  9. this.body = {
  10. functions: {},
  11. emitter: {
  12. on: function() {}
  13. }
  14. };
  15. });
  16. afterEach(function() {
  17. this.jsdom_global();
  18. this.svg.remove();
  19. this.svg = undefined;
  20. });
  21. it('should work', function () {
  22. var dataAxis = new DataAxis(this.body, {}, this.svg, {});
  23. });
  24. describe('screenToValue', function () {
  25. it('can called be without an explicit redraw', function () {
  26. var dataAxis = new DataAxis(this.body, {}, this.svg, {});
  27. assert(isNaN(dataAxis.screenToValue(77)));
  28. });
  29. });
  30. describe('convertValue', function () {
  31. it('can called be without an explicit redraw', function () {
  32. var dataAxis = new DataAxis(this.body, {}, this.svg, {});
  33. assert(isNaN(dataAxis.convertValue(77)));
  34. });
  35. });
  36. });