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.

44 lines
925 B

  1. var DataSet = require('../lib/DataSet');
  2. var Timeline = require('../lib/timeline/Timeline');
  3. describe('Timeline', function () {
  4. before(function () {
  5. this.jsdom = require('jsdom-global')({
  6. pretendToBeVisual: true
  7. });
  8. global['Element'] = window.Element;
  9. global['requestAnimationFrame'] = function(cb) {
  10. cb();
  11. };
  12. });
  13. after(function () {
  14. this.jsdom();
  15. });
  16. it('should not throw when updating data in close succession', function (done) {
  17. var timeline = new Timeline(document.createElement('div'), []);
  18. var events = [
  19. {start: new Date(), id: 1},
  20. {start: new Date(), id: 2}
  21. ];
  22. timeline
  23. .setItems(new DataSet(events));
  24. setTimeout(function() {
  25. timeline
  26. .setItems(new DataSet([
  27. {start: new Date(), id: 3},
  28. {start: new Date(), id: 4},
  29. {start: new Date(), id: 5}
  30. ]));
  31. done();
  32. }, 5);
  33. timeline
  34. .setSelection([events[0].id], {animation: false});
  35. });
  36. });