'use strict'; require('../../../TestHelper'); /* global bootstrapViewer, inject */ var labelEditingModule = require('../../../../lib/features/label-editing'), coreModule = require('../../../../lib/core'), draggingModule = require('diagram-js/lib/features/dragging'); var LabelUtil = require('../../../../lib/features/label-editing/LabelUtil'); function triggerKeyEvent(element, event, code) { var e = document.createEvent('Events'); if (e.initEvent) { e.initEvent(event, true, true); } e.keyCode = code; e.which = code; return element.dispatchEvent(e); } describe('features - label-editing', function() { var diagramXML = require('../../../fixtures/bpmn/features/label-editing/labels.bpmn'); describe('basics', function() { var testModules = [ labelEditingModule, coreModule, draggingModule ]; beforeEach(bootstrapViewer(diagramXML, { modules: testModules })); it('should register on dblclick', inject(function(elementRegistry, directEditing, eventBus) { // given var shape = elementRegistry.get('task-nested-embedded'); // when eventBus.fire('element.dblclick', { element: shape }); // then expect(directEditing.isActive()).to.be.true; })); it('should cancel on ', inject(function(elementRegistry, directEditing, eventBus) { // given var shape = elementRegistry.get('task-nested-embedded'), task = shape.businessObject; var oldName = task.name; // activate eventBus.fire('element.dblclick', { element: shape }); // a