From 574a674381d6449b509396b6d17c4ca94674ea1c Mon Sep 17 00:00:00 2001 From: Martin Stamm Date: Wed, 23 Mar 2022 11:39:15 +0100 Subject: [PATCH] fix(drilldown): create overlays on `viewer.open` --- .../drilldown/DrilldownOverlayBehavior.js | 2 +- test/fixtures/bpmn/collapsed-sub-process.bpmn | 2 +- test/spec/ModelerSpec.js | 40 +++++++++++-------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/lib/features/drilldown/DrilldownOverlayBehavior.js b/lib/features/drilldown/DrilldownOverlayBehavior.js index 1e845483..738e9e21 100644 --- a/lib/features/drilldown/DrilldownOverlayBehavior.js +++ b/lib/features/drilldown/DrilldownOverlayBehavior.js @@ -80,7 +80,7 @@ export default function DrilldownOverlayBehavior( }, true); - eventBus.on('import.done', function() { + eventBus.on('import.render.complete', function() { elementRegistry.filter(function(e) { return self.canDrillDown(e); }).map(function(el) { diff --git a/test/fixtures/bpmn/collapsed-sub-process.bpmn b/test/fixtures/bpmn/collapsed-sub-process.bpmn index 2efd45a2..c2305f1b 100644 --- a/test/fixtures/bpmn/collapsed-sub-process.bpmn +++ b/test/fixtures/bpmn/collapsed-sub-process.bpmn @@ -160,7 +160,7 @@ - + diff --git a/test/spec/ModelerSpec.js b/test/spec/ModelerSpec.js index a6b6a3a1..8c12445d 100644 --- a/test/spec/ModelerSpec.js +++ b/test/spec/ModelerSpec.js @@ -710,38 +710,44 @@ describe('Modeler', function() { describe('drill down', function() { - function verifyDrilldown(xml) { + function verifyDrilldown() { - return createModeler(xml).then(function() { - var drilldown = container.querySelector('.bjs-drilldown'); - var breadcrumbs = container.querySelector('.bjs-breadcrumbs'); - var djsContainer = container.querySelector('.djs-container'); + var drilldown = container.querySelector('.bjs-drilldown'); + var breadcrumbs = container.querySelector('.bjs-breadcrumbs'); + var djsContainer = container.querySelector('.djs-container'); - // assume - expect(drilldown).to.exist; - expect(breadcrumbs).to.exist; - expect(djsContainer.classList.contains('bjs-breadcrumbs-shown')).to.be.false; + // assume + expect(drilldown).to.exist; + expect(breadcrumbs).to.exist; + expect(djsContainer.classList.contains('bjs-breadcrumbs-shown')).to.be.false; - // when - drilldown.click(); - - // then - expect(djsContainer.classList.contains('bjs-breadcrumbs-shown')).to.be.true; - }); + // when + drilldown.click(); + // then + expect(djsContainer.classList.contains('bjs-breadcrumbs-shown')).to.be.true; } it('should allow drill down into collapsed sub-process', function() { var xml = require('../fixtures/bpmn/collapsed-sub-process.bpmn'); + return createModeler(xml).then(verifyDrilldown); + }); - return verifyDrilldown(xml); + + it('should allow drill down into collapsed sub-process after viewer.open', function() { + var xml = require('../fixtures/bpmn/collapsed-sub-process.bpmn'); + return createModeler(xml) + .then(function() { + return modeler.open('rootProcess_diagram'); + }) + .then(verifyDrilldown); }); it('should allow drill down into legacy collapsed sub-process', function() { var xml = require('../fixtures/bpmn/collapsed-sub-process-legacy.bpmn'); - return verifyDrilldown(xml); + return createModeler(xml).then(verifyDrilldown); });