diff --git a/lib/features/outline/index.js b/lib/features/outline/index.js index cc46d8abb..2e970f494 100644 --- a/lib/features/outline/index.js +++ b/lib/features/outline/index.js @@ -1,10 +1,15 @@ import Outline from './Outline'; import MultiSelectionOutline from './MultiSelectionOutline'; +import SelectionModule from '../selection'; + /** * @type { import('didi').ModuleDeclaration } */ export default { + __depends__: [ + SelectionModule + ], __init__: [ 'outline', 'multiSelectionOutline' ], outline: [ 'type', Outline ], multiSelectionOutline: [ 'type', MultiSelectionOutline ] diff --git a/test/spec/features/outline/MultiSelectionOutlineSpec.js b/test/spec/features/outline/MultiSelectionOutlineSpec.js index 51be76da7..fb5989b95 100644 --- a/test/spec/features/outline/MultiSelectionOutlineSpec.js +++ b/test/spec/features/outline/MultiSelectionOutlineSpec.js @@ -4,71 +4,60 @@ import { inject, } from 'test/TestHelper'; -import selectionModule from 'lib/features/selection'; +import outlineModule from 'lib/features/outline'; import { classes as domClasses, query as domQuery } from 'min-dom'; -describe('features/outline/MultiSelectionOutline', function() { - beforeEach(bootstrapDiagram({ modules: [ selectionModule ] })); +describe('features/outline - MultiSelectionOutline', function() { - describe('bootstrap', function() { + beforeEach(bootstrapDiagram({ modules: [ outlineModule ] })); - beforeEach(bootstrapDiagram({ modules: [ selectionModule ] })); - it('should bootstrap diagram with component', inject(function() { + var shape1, shape2, outline; - })); + beforeEach(inject(function(elementFactory, canvas, selection) { + shape1 = elementFactory.createShape({ + id: 'shape1', + x: 100, y: 100, width: 100, height: 100 + }); - }); + shape2 = elementFactory.createShape({ + id: 'shape2', + x: 300, y: 100, width: 100, height: 100 + }); + canvas.addShape(shape1); + canvas.addShape(shape2); - describe('multi selection outline', function() { + selection.select([ shape1, shape2 ]); - var shape1, shape2, outline; + outline = domQuery('.djs-selection-outline'); - beforeEach(inject(function(elementFactory, canvas, selection) { - shape1 = elementFactory.createShape({ - id: 'shape1', - x: 100, y: 100, width: 100, height: 100 - }); + })); - shape2 = elementFactory.createShape({ - id: 'shape2', - x: 300, y: 100, width: 100, height: 100 - }); - canvas.addShape(shape1); - canvas.addShape(shape2); + it('should show box', inject(function() { + expect(outline).to.exist; + })); - selection.select([ shape1, shape2 ]); - outline = domQuery('.djs-selection-outline'); + it('should add djs-multi-select marker', inject(function(selection, canvas) { - })); + // when + var element = canvas.getContainer(); + // then + expect(domClasses(element).has('djs-multi-select')).to.be.true; - it('should show box', inject(function() { - expect(outline).to.exist; - })); + // but when + selection.select(null); + // then + expect(domClasses(element).has('djs-multi-select')).to.be.false; + })); - it('should add djs-multi-select marker', inject(function(selection, canvas) { - - // when - var element = canvas.getContainer(); - - // then - expect(domClasses(element).has('djs-multi-select')).to.be.true; - - // but when - selection.select(null); - - // then - expect(domClasses(element).has('djs-multi-select')).to.be.false; - })); - }); }); diff --git a/test/spec/features/outline/OutlineSpec.js b/test/spec/features/outline/OutlineSpec.js index 8ec3300ed..ee3adb2c4 100755 --- a/test/spec/features/outline/OutlineSpec.js +++ b/test/spec/features/outline/OutlineSpec.js @@ -3,7 +3,7 @@ import { inject } from 'test/TestHelper'; -import selectionModule from 'lib/features/selection'; +import outlineModule from 'lib/features/outline'; import { query as domQuery @@ -16,9 +16,10 @@ import { } from 'tiny-svg'; -describe('features/outline/Outline', function() { +describe('features/outline - Outline', function() { + + beforeEach(bootstrapDiagram({ modules: [ outlineModule ] })); - beforeEach(bootstrapDiagram({ modules: [ selectionModule ] })); it('should expose API', inject(function(outline) {