Skip to content

Commit

Permalink
chore(test): import explicit files
Browse files Browse the repository at this point in the history
This prepares us to migrate diagram-js to an ES module.

Related to #863
  • Loading branch information
nikku committed Mar 12, 2024
1 parent 0370a9a commit ab01120
Show file tree
Hide file tree
Showing 167 changed files with 798 additions and 775 deletions.
8 changes: 4 additions & 4 deletions test/TestHelper.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export * from './helper';
export * from './helper/index.js';

import {
insertCSS
} from './helper';
} from './helper/index.js';

import diagramCSS from '../assets/diagram-js.css';

Expand All @@ -14,8 +14,8 @@ insertCSS('diagram-js-testing.css',
);


import BoundsMatchers from './matchers/BoundsMatchers';
import ConnectionMatchers from './matchers/ConnectionMatchers';
import BoundsMatchers from './matchers/BoundsMatchers.js';
import ConnectionMatchers from './matchers/ConnectionMatchers.js';

/* global chai */

Expand Down
8 changes: 4 additions & 4 deletions test/matchers/BoundsMatchers.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { pick } from 'min-dash';

/**
* @typedef {import('../../lib/util/Types').Dimensions} Dimensions
* @typedef {import('../../lib/util/Types').Point} Point
* @typedef {import('../../lib/util/Types').Rect} Rect
* @typedef {import('../../lib/util/Types').RectTRBL} RectTRBL
* @typedef {import('../../lib/util/Types.js').Dimensions} Dimensions
* @typedef {import('../../lib/util/Types.js').Point} Point
* @typedef {import('../../lib/util/Types.js').Rect} Rect
* @typedef {import('../../lib/util/Types.js').RectTRBL} RectTRBL
*/

var BOUNDS_ATTRS = [ 'x', 'y', 'width', 'height' ],
Expand Down
2 changes: 1 addition & 1 deletion test/matchers/BoundsMatchersSpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
create
} from 'lib/model';
} from 'lib/model/index.js';


describe('matchers/BoundsMatchers', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/matchers/ConnectionMatchers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { pick } from 'min-dash';

/**
* @typedef {import('../../lib/util/Types').Point} Point
* @typedef {import('../../lib/util/Types.js').Point} Point
*/

var POSITION_ATTRS = [ 'x', 'y' ];
Expand Down
2 changes: 1 addition & 1 deletion test/matchers/ConnectionMatchersSpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
create
} from 'lib/model';
} from 'lib/model/index.js';


describe('matchers/ConnectionMatchers', function() {
Expand Down
10 changes: 5 additions & 5 deletions test/spec/command/CommandInterceptorSpec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import inherits from 'inherits-browser';

import {
bootstrapDiagram,
inject
} from 'test/TestHelper';

import inherits from 'inherits-browser';
} from 'test/TestHelper.js';

import cmdModule from 'lib/command';
import cmdModule from 'lib/command/index.js';

import CommandInterceptor from 'lib/command/CommandInterceptor';
import CommandInterceptor from 'lib/command/CommandInterceptor.js';


// example commands
Expand Down
4 changes: 2 additions & 2 deletions test/spec/command/CommandStackSpec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
bootstrapDiagram,
inject
} from 'test/TestHelper';
} from 'test/TestHelper.js';


import cmdModule from 'lib/command';
import cmdModule from 'lib/command/index.js';

// example commands

Expand Down
25 changes: 14 additions & 11 deletions test/spec/connection-preview/ConnectionPreviewSpec.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import {
query as domQuery
} from 'min-dom';

import {
isDefined
} from 'min-dash';

import {
bootstrapDiagram,
inject
} from 'test/TestHelper';
} from 'test/TestHelper.js';

import TestContainer from 'mocha-test-container-support';

import modelingModule from 'lib/features/modeling';
import connectionPreviewModule from 'lib/features/connection-preview';

import BaseLayouter from 'lib/layout/BaseLayouter';
import CroppingConnectionDocking from 'lib/layout/CroppingConnectionDocking';
import modelingModule from 'lib/features/modeling/index.js';
import connectionPreviewModule from 'lib/features/connection-preview/index.js';

import {
query as domQuery
} from 'min-dom';
import { isDefined } from 'min-dash';
import BaseLayouter from 'lib/layout/BaseLayouter.js';
import CroppingConnectionDocking from 'lib/layout/CroppingConnectionDocking.js';

import { getMid } from '../../../lib/layout/LayoutUtil';
import { getMid } from '../../../lib/layout/LayoutUtil.js';

var testModules = [
modelingModule,
Expand Down
18 changes: 9 additions & 9 deletions test/spec/core/CanvasSpec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
import {
bootstrapDiagram,
getDiagramJS,
inject
} from 'test/TestHelper';

import TestContainer from 'mocha-test-container-support';

import { merge } from 'min-dash';

import {
Expand All @@ -17,7 +9,15 @@ import {
classes as svgClasses
} from 'tiny-svg';

import { getChildren as getChildrenGfx } from 'lib/util/GraphicsUtil';
import TestContainer from 'mocha-test-container-support';

import {
bootstrapDiagram,
getDiagramJS,
inject
} from 'test/TestHelper.js';

import { getChildren as getChildrenGfx } from 'lib/util/GraphicsUtil.js';


describe('Canvas', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/core/ElementRegistrySpec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
bootstrapDiagram,
inject
} from 'test/TestHelper';
} from 'test/TestHelper.js';


describe('ElementRegistry', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/core/EventBusSpec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import EventBus from 'lib/core/EventBus';
import EventBus from 'lib/core/EventBus.js';


describe('core/EventBus', function() {
Expand Down
10 changes: 5 additions & 5 deletions test/spec/core/GraphicsFactorySpec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
bootstrapDiagram,
inject
} from 'test/TestHelper';

import {
classes as svgClasses
} from 'tiny-svg';

import {
bootstrapDiagram,
inject
} from 'test/TestHelper.js';


describe('GraphicsFactory', function() {

Expand Down
7 changes: 4 additions & 3 deletions test/spec/draw/DefaultRendererSpec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { create } from 'tiny-svg';

import {
bootstrapDiagram,
inject
} from 'test/TestHelper';
import { create } from 'tiny-svg';
} from 'test/TestHelper.js';

import drawModule from 'lib/draw';
import drawModule from 'lib/draw/index.js';


describe('draw - DefaultRenderer', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/draw/StylesSpec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Styles from 'lib/draw/Styles';
import Styles from 'lib/draw/Styles.js';


describe('draw/Styles', function() {
Expand Down
5 changes: 2 additions & 3 deletions test/spec/environment/MockingSpec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {
bootstrapDiagram,
inject
} from 'test/TestHelper';
} from 'test/TestHelper.js';


import EventBus from 'lib/core/EventBus';
import EventBus from 'lib/core/EventBus.js';


describe('environment/Mocking', function() {
Expand Down
12 changes: 6 additions & 6 deletions test/spec/features/align-elements/AlignElementsSpec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { forEach, sortBy } from 'min-dash';

import {
bootstrapDiagram,
inject
} from 'test/TestHelper';

import { forEach, sortBy } from 'min-dash';
} from 'test/TestHelper.js';

import alignElementsModule from 'lib/features/align-elements';
import modelingModule from 'lib/features/modeling';
import testRules from './rules';
import alignElementsModule from 'lib/features/align-elements/index.js';
import modelingModule from 'lib/features/modeling/index.js';
import testRules from './rules/index.js';


describe('features/align-elements', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/features/align-elements/rules/TestRules.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import inherits from 'inherits-browser';

import RuleProvider from 'lib/features/rules/RuleProvider';
import RuleProvider from 'lib/features/rules/RuleProvider.js';

export default function TestRules(eventBus) {
RuleProvider.call(this, eventBus);
Expand Down
2 changes: 1 addition & 1 deletion test/spec/features/align-elements/rules/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestRules from './TestRules';
import TestRules from './TestRules.js';

export default {
__init__: [ 'testRules' ],
Expand Down
31 changes: 16 additions & 15 deletions test/spec/features/attach-support/AttachSupportSpec.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { createCanvasEvent as canvasEvent } from '../../../util/MockEvents';
import { pick } from 'min-dash';

import { query as domQuery } from 'min-dom';

import { classes as svgClasses } from 'tiny-svg';

import { createCanvasEvent as canvasEvent } from '../../../util/MockEvents.js';

import {
bootstrapDiagram,
inject
} from 'test/TestHelper';
} from 'test/TestHelper.js';

import { pick } from 'min-dash';

import attachSupportModule from 'lib/features/attach-support';
import labelSupportModule from 'lib/features/label-support';
import modelingModule from 'lib/features/modeling';
import moveModule from 'lib/features/move';
import replaceModule from 'lib/features/replace';
import spaceToolModule from 'lib/features/space-tool';
import rulesModule from './rules';
import attachSupportModule from 'lib/features/attach-support/index.js';
import labelSupportModule from 'lib/features/label-support/index.js';
import modelingModule from 'lib/features/modeling/index.js';
import moveModule from 'lib/features/move/index.js';
import replaceModule from 'lib/features/replace/index.js';
import spaceToolModule from 'lib/features/space-tool/index.js';
import rulesModule from './rules/index.js';

import { getNewAttachShapeDelta } from 'lib/util/AttachUtil';
import { getNewAttachShapeDelta } from 'lib/util/AttachUtil.js';

import { query as domQuery } from 'min-dom';

import { classes as svgClasses } from 'tiny-svg';

var ATTACH = { attach: true };
var NO_ATTACH = { attach: false };
Expand Down
5 changes: 3 additions & 2 deletions test/spec/features/attach-support/rules/AttachRules.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import inherits from 'inherits-browser';

import RuleProvider from 'lib/features/rules/RuleProvider';

import { forEach } from 'min-dash';

import RuleProvider from 'lib/features/rules/RuleProvider.js';


export default function AttachRules(eventBus) {
RuleProvider.call(this, eventBus);
}
Expand Down
2 changes: 1 addition & 1 deletion test/spec/features/attach-support/rules/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AttachRules from './AttachRules';
import AttachRules from './AttachRules.js';

export default {
__init__: [ 'attachRules' ],
Expand Down
20 changes: 10 additions & 10 deletions test/spec/features/auto-place/AutoPlaceSpec.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { assign } from 'min-dash';

import {
bootstrapDiagram,
inject
} from 'test/TestHelper';
} from 'test/TestHelper.js';

import autoPlaceModule from 'lib/features/auto-place';
import coreModule from 'lib/core';
import modelingModule from 'lib/features/modeling';
import selectionModule from 'lib/features/selection';
import autoPlaceModule from 'lib/features/auto-place/index.js';
import coreModule from 'lib/core/index.js';
import modelingModule from 'lib/features/modeling/index.js';
import selectionModule from 'lib/features/selection/index.js';

import { getMid } from 'lib/layout/LayoutUtil';
import { getMid } from 'lib/layout/LayoutUtil.js';

import {
findFreePosition,
generateGetNextPosition,
getConnectedAtPosition,
getConnectedDistance
} from 'lib/features/auto-place/AutoPlaceUtil';

import { assign } from 'min-dash';
} from 'lib/features/auto-place/AutoPlaceUtil.js';

import { DEFAULT_DISTANCE } from 'lib/features/auto-place/AutoPlaceUtil';
import { DEFAULT_DISTANCE } from 'lib/features/auto-place/AutoPlaceUtil.js';


describe('features/auto-place', function() {
Expand Down
20 changes: 10 additions & 10 deletions test/spec/features/auto-resize/AutoResizeSpec.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import inherits from 'inherits-browser';

import {
bootstrapDiagram,
inject
} from 'test/TestHelper';
} from 'test/TestHelper.js';

import {
createCanvasEvent as canvasEvent
} from '../../../util/MockEvents';
} from '../../../util/MockEvents.js';

import modelingModule from 'lib/features/modeling';
import autoResizeModule from 'lib/features/auto-resize';
import createModule from 'lib/features/create';
import replaceModule from 'lib/features/replace';
import modelingModule from 'lib/features/modeling/index.js';
import autoResizeModule from 'lib/features/auto-resize/index.js';
import createModule from 'lib/features/create/index.js';
import replaceModule from 'lib/features/replace/index.js';

import AutoResizeProvider from 'lib/features/auto-resize/AutoResizeProvider';
import AutoResize from 'lib/features/auto-resize/AutoResize';

import inherits from 'inherits-browser';
import AutoResizeProvider from 'lib/features/auto-resize/AutoResizeProvider.js';
import AutoResize from 'lib/features/auto-resize/AutoResize.js';


/**
Expand Down
Loading

0 comments on commit ab01120

Please sign in to comment.