TouchInteractionEventsSpec.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import {
  2. bootstrapDiagram,
  3. inject
  4. } from 'test/TestHelper';
  5. import {
  6. forEach
  7. } from 'min-dash';
  8. import touchInteractionModule from 'lib/features/touch';
  9. describe('features/touch', function() {
  10. describe('bootstrap', function() {
  11. beforeEach(bootstrapDiagram({ modules: [ touchInteractionModule ] }));
  12. it('should bootstrap diagram with component', inject(function(eventBus, canvas) {
  13. // given
  14. var touchEvents = [
  15. 'shape.tap',
  16. 'shape.dbltap',
  17. 'shape.click',
  18. 'shape.dblclick',
  19. 'connection.tap',
  20. 'connection.dbltap',
  21. 'connection.click',
  22. 'connection.dblclick',
  23. 'canvas.click',
  24. 'canvas.tap'
  25. ];
  26. forEach(touchEvents, function(eventName) {
  27. eventBus.on(eventName, function(e) {
  28. console.log(eventName, e);
  29. });
  30. });
  31. canvas.addShape({ id: 's1', x: 100, y: 200, width: 50, height: 50 });
  32. canvas.addShape({ id: 's2', x: 300, y: 200, width: 50, height: 50 });
  33. canvas.addConnection({ id: 'c1', waypoints: [ { x: 150, y: 225 }, { x: 300, y: 225 } ] });
  34. }));
  35. });
  36. });