'use strict'; require('../../../TestHelper'); /* global bootstrapViewer, inject */ var labelEditingModule = require('../../../../lib/features/label-editing'), coreModule = require('../../../../lib/core'); 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'); var testModules = [ labelEditingModule, coreModule ]; beforeEach(bootstrapViewer(diagramXML, { modules: testModules })); describe('basics', function() { 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()).toBe(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