SnappingSpec.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import {
  2. bootstrapDiagram,
  3. inject
  4. } from 'test/TestHelper';
  5. import modelingModule from 'lib/features/modeling';
  6. import snappingModule from 'lib/features/snapping';
  7. import moveModule from 'lib/features/move';
  8. describe('features/snapping', function() {
  9. beforeEach(bootstrapDiagram({
  10. modules: [
  11. modelingModule,
  12. snappingModule,
  13. moveModule
  14. ]
  15. }));
  16. var rootShape, parentShape, childShape, childShape2, label, connection;
  17. beforeEach(inject(function(elementFactory, canvas) {
  18. rootShape = elementFactory.createRoot({
  19. id: 'root'
  20. });
  21. canvas.setRootElement(rootShape);
  22. parentShape = elementFactory.createShape({
  23. id: 'parent',
  24. x: 100, y: 100, width: 300, height: 300
  25. });
  26. canvas.addShape(parentShape, rootShape);
  27. childShape = elementFactory.createShape({
  28. id: 'child',
  29. x: 110, y: 110, width: 100, height: 100
  30. });
  31. canvas.addShape(childShape, parentShape);
  32. childShape2 = elementFactory.createShape({
  33. id: 'child2',
  34. x: 200, y: 110, width: 100, height: 100
  35. });
  36. canvas.addShape(childShape2, parentShape);
  37. label = elementFactory.createLabel({
  38. id: 'label1',
  39. x: 250, y: 110, width: 40, height: 40,
  40. hidden: true
  41. });
  42. canvas.addShape(label, parentShape);
  43. connection = elementFactory.createConnection({
  44. id: 'connection',
  45. waypoints: [ { x: 150, y: 150 }, { x: 150, y: 200 }, { x: 350, y: 150 } ],
  46. source: childShape,
  47. target: childShape2
  48. });
  49. canvas.addConnection(connection, parentShape);
  50. }));
  51. describe('bootstrap', function() {
  52. it('should bootstrap diagram with component', inject(function(snapping) {
  53. expect(snapping).to.exist;
  54. }));
  55. });
  56. });