SelectionVisualsSpec.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import {
  2. bootstrapDiagram,
  3. inject
  4. } from 'test/TestHelper';
  5. import selectionModule from 'lib/features/selection';
  6. import {
  7. query as domQuery
  8. } from 'min-dom';
  9. describe('features/selection/SelectionVisuals', function() {
  10. beforeEach(bootstrapDiagram({ modules: [ selectionModule ] }));
  11. describe('bootstrap', function() {
  12. beforeEach(bootstrapDiagram({ modules: [ selectionModule ] }));
  13. it('should bootstrap diagram with component', inject(function() {
  14. }));
  15. });
  16. describe('selection box', function() {
  17. var shape, shape2, connection;
  18. beforeEach(inject(function(elementFactory, canvas) {
  19. shape = elementFactory.createShape({
  20. id: 'child',
  21. x: 100, y: 100, width: 100, height: 100
  22. });
  23. canvas.addShape(shape);
  24. shape2 = elementFactory.createShape({
  25. id: 'child2',
  26. x: 300, y: 100, width: 100, height: 100
  27. });
  28. canvas.addShape(shape2);
  29. connection = elementFactory.createConnection({
  30. id: 'connection',
  31. waypoints: [ { x: 150, y: 150 }, { x: 150, y: 200 }, { x: 350, y: 150 } ],
  32. source: shape,
  33. target: shape2
  34. });
  35. canvas.addConnection(connection);
  36. }));
  37. it('should show box on select', inject(function(selection, canvas) {
  38. // when
  39. selection.select(connection);
  40. // then
  41. var gfx = canvas.getGraphics(connection),
  42. outline = domQuery('.djs-outline', gfx);
  43. expect(outline).to.exist;
  44. }));
  45. });
  46. });