Skip to content

Commit 76f78f0

Browse files
authored
fix failing layout test (#2999)
1 parent c6f6124 commit 76f78f0

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

frontend/layout/lib/utils.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ export function setTransform(
7474
top: 0,
7575
left: 0,
7676
transform: translate,
77-
WebkitTransform: translate,
78-
MozTransform: translate,
79-
msTransform: translate,
80-
OTransform: translate,
8177
width: setSize ? `${widthRounded}px` : undefined,
8278
height: setSize ? `${heightRounded}px` : undefined,
8379
position: "absolute",

frontend/layout/tests/layoutTree.test.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ import {
1313
import { newLayoutTreeState } from "./model";
1414

1515
test("layoutTreeStateReducer - compute move", () => {
16-
let treeState = newLayoutTreeState(newLayoutNode(undefined, undefined, undefined, { blockId: "root" }));
17-
assert(treeState.rootNode.data!.blockId === "root", "root should have no children and should have data");
18-
let node1 = newLayoutNode(undefined, undefined, undefined, { blockId: "node1" });
16+
const nodeA = newLayoutNode(undefined, undefined, undefined, { blockId: "nodeA" });
17+
const node1 = newLayoutNode(undefined, undefined, undefined, { blockId: "node1" });
18+
const node2 = newLayoutNode(undefined, undefined, undefined, { blockId: "node2" });
19+
const treeState = newLayoutTreeState(newLayoutNode(undefined, undefined, [nodeA, node1, node2]));
20+
assert(treeState.rootNode.children!.length === 3, "root should have three children");
1921
let pendingAction = computeMoveNode(treeState, {
2022
type: LayoutTreeActionType.ComputeMove,
2123
nodeId: treeState.rootNode.id,
@@ -29,12 +31,11 @@ test("layoutTreeStateReducer - compute move", () => {
2931
assert(insertOperation.insertAtRoot, "insert operation insertAtRoot should be true");
3032
moveNode(treeState, insertOperation);
3133
assert(
32-
treeState.rootNode.data === undefined && treeState.rootNode.children!.length === 2,
33-
"root node should now have no data and should have two children"
34+
treeState.rootNode.data === undefined && treeState.rootNode.children!.length === 3,
35+
"root node should still have three children"
3436
);
3537
assert(treeState.rootNode.children![1].data!.blockId === "node1", "root's second child should be node1");
3638

37-
let node2 = newLayoutNode(undefined, undefined, undefined, { blockId: "node2" });
3839
pendingAction = computeMoveNode(treeState, {
3940
type: LayoutTreeActionType.ComputeMove,
4041
nodeId: node1.id,
@@ -48,15 +49,15 @@ test("layoutTreeStateReducer - compute move", () => {
4849
assert(!insertOperation2.insertAtRoot, "insert operation insertAtRoot should be false");
4950
moveNode(treeState, insertOperation2);
5051
assert(
51-
treeState.rootNode.data === undefined && treeState.rootNode.children!.length === 2,
52-
"root node should still have three children"
52+
treeState.rootNode.data === undefined && (treeState.rootNode.children!.length as number) === 2,
53+
"root node should now have two children after node2 moved into node1"
5354
);
5455
assert(treeState.rootNode.children![1].children!.length === 2, "root's second child should now have two children");
5556
});
5657

5758
test("computeMove - noop action", () => {
58-
let nodeToMove = newLayoutNode(undefined, undefined, undefined, { blockId: "nodeToMove" });
59-
let treeState = newLayoutTreeState(
59+
const nodeToMove = newLayoutNode(undefined, undefined, undefined, { blockId: "nodeToMove" });
60+
const treeState = newLayoutTreeState(
6061
newLayoutNode(undefined, undefined, [
6162
nodeToMove,
6263
newLayoutNode(undefined, undefined, undefined, { blockId: "otherNode" }),

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)