@eclipse-glsp/server 1.1.0-RC05 → 1.1.0-next.385269d.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/command/command-stack.d.ts +7 -6
- package/lib/common/command/command-stack.d.ts.map +1 -1
- package/lib/common/command/command-stack.js +6 -6
- package/lib/common/command/command-stack.js.map +1 -1
- package/lib/common/command/command-stack.spec.js +31 -31
- package/lib/common/command/command-stack.spec.js.map +1 -1
- package/lib/common/command/command.d.ts +7 -6
- package/lib/common/command/command.d.ts.map +1 -1
- package/lib/common/command/command.js +19 -15
- package/lib/common/command/command.js.map +1 -1
- package/lib/common/command/command.spec.js +8 -8
- package/lib/common/command/command.spec.js.map +1 -1
- package/lib/common/command/recording-command.d.ts +15 -15
- package/lib/common/command/recording-command.d.ts.map +1 -1
- package/lib/common/command/recording-command.js +10 -10
- package/lib/common/command/recording-command.js.map +1 -1
- package/lib/common/command/recording-command.spec.js +8 -8
- package/lib/common/command/recording-command.spec.js.map +1 -1
- package/lib/common/command/undo-redo-action-handler.d.ts +2 -2
- package/lib/common/command/undo-redo-action-handler.d.ts.map +1 -1
- package/lib/common/command/undo-redo-action-handler.js +4 -4
- package/lib/common/command/undo-redo-action-handler.js.map +1 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js +1 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
- package/lib/common/index.d.ts +3 -1
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +3 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/operations/operation-action-handler.d.ts +1 -1
- package/lib/common/operations/operation-action-handler.d.ts.map +1 -1
- package/lib/common/operations/operation-action-handler.js +3 -3
- package/lib/common/operations/operation-action-handler.js.map +1 -1
- package/lib/common/test/mock-util.d.ts +7 -1
- package/lib/common/test/mock-util.d.ts.map +1 -1
- package/lib/common/test/mock-util.js +23 -1
- package/lib/common/test/mock-util.js.map +1 -1
- package/lib/common/utils/layout-util.d.ts +1 -1
- package/lib/common/utils/layout-util.d.ts.map +1 -1
- package/lib/common/utils/layout-util.js +3 -3
- package/lib/common/utils/layout-util.js.map +1 -1
- package/package.json +4 -4
- package/src/common/command/command-stack.spec.ts +32 -32
- package/src/common/command/command-stack.ts +10 -9
- package/src/common/command/command.spec.ts +9 -10
- package/src/common/command/command.ts +23 -19
- package/src/common/command/recording-command.spec.ts +8 -8
- package/src/common/command/recording-command.ts +19 -19
- package/src/common/command/undo-redo-action-handler.ts +4 -4
- package/src/common/features/layout/computed-bounds-action-handler.ts +2 -2
- package/src/common/index.ts +3 -1
- package/src/common/operations/operation-action-handler.ts +3 -3
- package/src/common/test/mock-util.ts +21 -0
- package/src/common/utils/layout-util.ts +1 -1
|
@@ -25,11 +25,13 @@ import {
|
|
|
25
25
|
EdgeTypeHint,
|
|
26
26
|
InitializeClientSessionParameters,
|
|
27
27
|
MaybeArray,
|
|
28
|
+
MaybePromise,
|
|
28
29
|
Point,
|
|
29
30
|
RequestEditValidationAction,
|
|
30
31
|
ShapeTypeHint,
|
|
31
32
|
ValidationStatus
|
|
32
33
|
} from '@eclipse-glsp/protocol';
|
|
34
|
+
import { expect } from 'chai';
|
|
33
35
|
import { Container } from 'inversify';
|
|
34
36
|
import { MessageConnection } from 'vscode-jsonrpc';
|
|
35
37
|
import { ActionDispatcher } from '../actions/action-dispatcher';
|
|
@@ -53,6 +55,25 @@ export async function delay(ms: number): Promise<void> {
|
|
|
53
55
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Consumes a maybe async function and checks for error
|
|
60
|
+
* @param method - The function to check
|
|
61
|
+
* @param message - Optional message to match with error message
|
|
62
|
+
*/
|
|
63
|
+
export async function expectToThrowAsync(toEvaluate: () => MaybePromise<void>, message?: string): Promise<void> {
|
|
64
|
+
let err: Error | undefined = undefined;
|
|
65
|
+
try {
|
|
66
|
+
await toEvaluate();
|
|
67
|
+
} catch (error: any) {
|
|
68
|
+
err = error;
|
|
69
|
+
}
|
|
70
|
+
if (message) {
|
|
71
|
+
expect(err?.message).to.be.equal(message);
|
|
72
|
+
} else {
|
|
73
|
+
expect(err).to.be.an('Error');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
56
77
|
export function createClientSession(
|
|
57
78
|
id: string,
|
|
58
79
|
diagramType: string,
|
|
@@ -27,7 +27,7 @@ import { getOrThrow, GLSPServerError } from './glsp-server-error';
|
|
|
27
27
|
* @param index The model index.
|
|
28
28
|
* @returns The changed element.
|
|
29
29
|
*/
|
|
30
|
-
export function
|
|
30
|
+
export function applyElementAndBounds(bounds: ElementAndBounds, index: GModelIndex): GBoundsAware | undefined {
|
|
31
31
|
const element = getOrThrow(index.get(bounds.elementId), 'Model element not found! ID: ' + bounds.elementId);
|
|
32
32
|
if (isGBoundsAware(element)) {
|
|
33
33
|
if (bounds.newPosition !== undefined) {
|