pane-axis-element-spec.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const PaneAxis = require('../src/pane-axis');
  2. const PaneContainer = require('../src/pane-container');
  3. const Pane = require('../src/pane');
  4. const buildPane = () =>
  5. new Pane({
  6. applicationDelegate: atom.applicationDelegate,
  7. config: atom.config,
  8. deserializerManager: atom.deserializers,
  9. notificationManager: atom.notifications,
  10. viewRegistry: atom.views
  11. });
  12. describe('PaneAxisElement', () =>
  13. it('correctly subscribes and unsubscribes to the underlying model events on attach/detach', function() {
  14. const container = new PaneContainer({
  15. config: atom.config,
  16. applicationDelegate: atom.applicationDelegate,
  17. viewRegistry: atom.views
  18. });
  19. const axis = new PaneAxis({}, atom.views);
  20. axis.setContainer(container);
  21. const axisElement = axis.getElement();
  22. const panes = [buildPane(), buildPane(), buildPane()];
  23. jasmine.attachToDOM(axisElement);
  24. axis.addChild(panes[0]);
  25. expect(axisElement.children[0]).toBe(panes[0].getElement());
  26. axisElement.remove();
  27. axis.addChild(panes[1]);
  28. expect(axisElement.children[2]).toBeUndefined();
  29. jasmine.attachToDOM(axisElement);
  30. expect(axisElement.children[2]).toBe(panes[1].getElement());
  31. axis.addChild(panes[2]);
  32. expect(axisElement.children[4]).toBe(panes[2].getElement());
  33. }));