Skip to content

Commit 48d48aa

Browse files
committed
2 tests fixed.
1 parent a20f7a6 commit 48d48aa

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

src/control-bar/control-bar.spec.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
1-
import { BehaviorController } from '../behaviors/behavior-controller';
21
import { Dom } from '../core/dom';
3-
import { Definition } from '../definition';
4-
import { DesignerConfiguration } from '../designer-configuration';
5-
import { DesignerContext } from '../designer-context';
2+
import { createDesignerContextStub } from '../test-tools/stubs';
63
import { ControlBar } from './control-bar';
74

85
describe('ControlBar', () => {
96
it('create() creates bar', () => {
107
const parent = Dom.element('div');
11-
const definition: Definition = {
12-
properties: {},
13-
sequence: []
14-
};
15-
const configuration: DesignerConfiguration = {
16-
editors: {
17-
globalEditorProvider: () => document.createElement('div'),
18-
stepEditorProvider: () => document.createElement('div')
19-
},
20-
steps: {},
21-
toolbox: {
22-
groups: []
23-
}
24-
};
25-
const bc = new BehaviorController();
26-
27-
const context = new DesignerContext(definition, bc, configuration);
8+
const context = createDesignerContextStub();
289

2910
const bar = ControlBar.create(parent, context);
3011

src/test-tools/stubs.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { BehaviorController } from '../behaviors/behavior-controller';
2+
import { Dom } from '../core/dom';
23
import { ComponentType, Definition, Step } from '../definition';
34
import { DesignerConfiguration } from '../designer-configuration';
45
import { DesignerContext } from '../designer-context';
6+
import { LayoutController } from '../layout-controller';
57

68
export function createDesignerConfigurationStub(): DesignerConfiguration {
79
return {
@@ -34,5 +36,8 @@ export function createDefinitionStub(): Definition {
3436
}
3537

3638
export function createDesignerContextStub(): DesignerContext {
37-
return new DesignerContext(createDefinitionStub(), new BehaviorController(), createDesignerConfigurationStub());
39+
const parent = Dom.element('div');
40+
const bc = new BehaviorController();
41+
const lc = new LayoutController(parent);
42+
return new DesignerContext(createDefinitionStub(), bc, lc, createDesignerConfigurationStub(), false, false);
3843
}

0 commit comments

Comments
 (0)