Skip to content

Commit d1f8d0a

Browse files
committed
fixup: proper distance calculation
1 parent d23a8f1 commit d1f8d0a

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

packages/compass-data-modeling/src/utils/nodes-and-edges.spec.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@ const validateMixedType = async (
3030
function withoutObjectReactType(fields: NodeProps['fields']) {
3131
return fields.map((f) => ({
3232
...f,
33-
type:
34-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
35-
typeof f.type === 'object' &&
36-
(f?.type as any)?.$$typeof === Symbol.for('react.element')
37-
? 'object'
38-
: f.type,
33+
type: React.isValidElement(f.type) ? 'object' : f.type,
3934
}));
4035
}
4136

packages/compass-e2e-tests/tests/data-modeling-tab.test.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -265,17 +265,15 @@ async function dragDiagramToShowAndClick(
265265
.getLocation();
266266

267267
function getDistanceToElementCenter() {
268-
return (
268+
return Math.abs(
269269
Math.floor(
270-
elementPosition.x +
271-
elementSize.width / 2 -
272-
(diagramBackgroundPosition.x + 1)
273-
),
274-
Math.floor(
275-
elementPosition.y +
276-
elementSize.height / 2 -
277-
(diagramBackgroundPosition.y + 1)
278-
)
270+
elementPosition.x + elementSize.width / 2 - diagramBackgroundPosition.x
271+
) +
272+
Math.floor(
273+
elementPosition.y +
274+
elementSize.height / 2 -
275+
diagramBackgroundPosition.y
276+
)
279277
);
280278
}
281279

@@ -938,7 +936,7 @@ describe('Data Modeling tab', function () {
938936
await getDiagramNodes(browser, 2);
939937
});
940938

941-
it('allows field editing', async function () {
939+
it.only('allows field editing', async function () {
942940
const dataModelName = 'Test Edit Collection';
943941
await setupDiagram(browser, {
944942
diagramName: dataModelName,

0 commit comments

Comments
 (0)