Skip to content

Commit f9f288c

Browse files
authored
fix: boxSizing COMPASS-9664 (#106)
1 parent 419fca2 commit f9f288c

File tree

6 files changed

+20
-14
lines changed

6 files changed

+20
-14
lines changed

src/components/canvas/canvas.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ const PRO_OPTIONS: ProOptions = {
3232
const ReactFlowWrapper = styled.div`
3333
height: 100%;
3434
background: ${props => props.theme.background};
35+
36+
*,
37+
*::before,
38+
*::after {
39+
box-sizing: border-box;
40+
}
3541
`;
3642

3743
const nodeTypes = {

src/components/edge/floating-edge.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('floating-edge', () => {
5757
expect(path).toHaveAttribute('id', 'orders-to-employees');
5858
expect(path).toHaveAttribute(
5959
'd',
60-
'M267 197.5L267 217.5L 267,240Q 267,245 272,245L 354,245Q 359,245 359,250L359 272.5L359 292.5',
60+
'M263 189.5L263 209.5L 263,236Q 263,241 268,241L 358,241Q 363,241 363,246L363 272.5L363 292.5',
6161
);
6262
});
6363
});

src/components/edge/self-referencing-edge.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('self-referencing-edge', () => {
5353
renderComponent();
5454
const path = screen.getByTestId('self-referencing-edge-employees-to-employees');
5555
expect(path).toHaveAttribute('id', 'employees-to-employees');
56-
expect(path).toHaveAttribute('d', 'M422,292.5L422,262.5L584,262.5L584,355.5L551.5,355.5');
56+
expect(path).toHaveAttribute('d', 'M422,292.5L422,262.5L584,262.5L584,351.5L551.5,351.5');
5757
});
5858
});
5959

src/utilities/apply-layout.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ describe('apply-layout', () => {
6464
...nodes[1],
6565
position: {
6666
x: 12,
67-
y: 86, // 12 + 44 (0 fields height) + 2*10 (padding) + 10 (extra padding)
67+
y: 78, // 12 + 44 (0 fields height) + 2*10 (padding) + 2 (extra padding)
6868
},
6969
}),
7070
expect.objectContaining({
7171
...nodes[2],
7272
position: {
7373
x: 12,
74-
y: 160, // 86 + 44 (0 fields height) + 2*10 (padding) + 10 (extra padding)
74+
y: 144, // 86 + 44 (0 fields height) + 2*10 (padding) + 2 (extra padding)
7575
},
7676
}),
7777
]);
@@ -94,14 +94,14 @@ describe('apply-layout', () => {
9494
...nodesWithOneField[1],
9595
position: {
9696
x: 12,
97-
y: 104, // 12 + 62 (1 field height) + 2*10 (padding) + 10 (extra padding)
97+
y: 96, // 12 + 62 (1 field height) + 2*10 (padding) + 2 (extra padding)
9898
},
9999
}),
100100
expect.objectContaining({
101101
...nodesWithOneField[2],
102102
position: {
103103
x: 12,
104-
y: 196, // 104 + 62 (1 field height) + 2*10 (padding) + 10 (extra padding)
104+
y: 180, // 96 + 62 (1 field height) + 2*10 (padding) + 2 (extra padding)
105105
},
106106
}),
107107
]);
@@ -124,14 +124,14 @@ describe('apply-layout', () => {
124124
...baseNodes[1],
125125
position: {
126126
x: 12,
127-
y: 104, // 12 + 62 (default height) + 2*10 (padding) + 10 (extra padding)
127+
y: 96, // 12 + 62 (default height) + 2*10 (padding) + 2 (extra padding)
128128
},
129129
}),
130130
expect.objectContaining({
131131
...baseNodes[2],
132132
position: {
133133
x: 12,
134-
y: 196, // 104 + 62 (default height) + 2*10 (padding) + 10 (extra padding)
134+
y: 180, // 96 + 62 (default height) + 2*10 (padding) + 2 (extra padding)
135135
},
136136
}),
137137
]);
@@ -188,7 +188,7 @@ describe('apply-layout', () => {
188188
id: '1',
189189
position: {
190190
x: 12,
191-
y: 86,
191+
y: 78,
192192
},
193193
}),
194194
expect.objectContaining({
@@ -208,7 +208,7 @@ describe('apply-layout', () => {
208208
id: '3',
209209
position: {
210210
x: 12,
211-
y: 240,
211+
y: 224,
212212
},
213213
}),
214214
]);

src/utilities/get-edge-params.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ describe('get-edge-params', () => {
1111
);
1212
expect(result).toEqual({
1313
sourcePos: 'bottom',
14-
sx: 267,
15-
sy: 197.5,
14+
sx: 263,
15+
sy: 189.5,
1616
targetPos: 'top',
17-
tx: 359,
17+
tx: 363,
1818
ty: 292.5,
1919
});
2020
});

src/utilities/node-dimensions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const getNodeHeight = <N extends BaseNode | NodeProps | InternalNode>(nod
2323
}
2424
}
2525
const calculatedHeight =
26-
DEFAULT_NODE_HEADER_HEIGHT + DEFAULT_FIELD_PADDING * 2 + fieldCount * DEFAULT_FIELD_HEIGHT + 10;
26+
DEFAULT_NODE_HEADER_HEIGHT + DEFAULT_FIELD_PADDING * 2 + fieldCount * DEFAULT_FIELD_HEIGHT + 2;
2727
return calculatedHeight;
2828
};
2929

0 commit comments

Comments
 (0)