fix failing layout test (#2999)

This commit is contained in:
Mike Sawka 2026-03-06 16:07:11 -08:00 committed by GitHub
parent c6f61247ce
commit 76f78f0f97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 16 deletions

View file

@ -74,10 +74,6 @@ export function setTransform(
top: 0,
left: 0,
transform: translate,
WebkitTransform: translate,
MozTransform: translate,
msTransform: translate,
OTransform: translate,
width: setSize ? `${widthRounded}px` : undefined,
height: setSize ? `${heightRounded}px` : undefined,
position: "absolute",

View file

@ -13,9 +13,11 @@ import {
import { newLayoutTreeState } from "./model";
test("layoutTreeStateReducer - compute move", () => {
let treeState = newLayoutTreeState(newLayoutNode(undefined, undefined, undefined, { blockId: "root" }));
assert(treeState.rootNode.data!.blockId === "root", "root should have no children and should have data");
let node1 = newLayoutNode(undefined, undefined, undefined, { blockId: "node1" });
const nodeA = newLayoutNode(undefined, undefined, undefined, { blockId: "nodeA" });
const node1 = newLayoutNode(undefined, undefined, undefined, { blockId: "node1" });
const node2 = newLayoutNode(undefined, undefined, undefined, { blockId: "node2" });
const treeState = newLayoutTreeState(newLayoutNode(undefined, undefined, [nodeA, node1, node2]));
assert(treeState.rootNode.children!.length === 3, "root should have three children");
let pendingAction = computeMoveNode(treeState, {
type: LayoutTreeActionType.ComputeMove,
nodeId: treeState.rootNode.id,
@ -29,12 +31,11 @@ test("layoutTreeStateReducer - compute move", () => {
assert(insertOperation.insertAtRoot, "insert operation insertAtRoot should be true");
moveNode(treeState, insertOperation);
assert(
treeState.rootNode.data === undefined && treeState.rootNode.children!.length === 2,
"root node should now have no data and should have two children"
treeState.rootNode.data === undefined && treeState.rootNode.children!.length === 3,
"root node should still have three children"
);
assert(treeState.rootNode.children![1].data!.blockId === "node1", "root's second child should be node1");
let node2 = newLayoutNode(undefined, undefined, undefined, { blockId: "node2" });
pendingAction = computeMoveNode(treeState, {
type: LayoutTreeActionType.ComputeMove,
nodeId: node1.id,
@ -48,15 +49,15 @@ test("layoutTreeStateReducer - compute move", () => {
assert(!insertOperation2.insertAtRoot, "insert operation insertAtRoot should be false");
moveNode(treeState, insertOperation2);
assert(
treeState.rootNode.data === undefined && treeState.rootNode.children!.length === 2,
"root node should still have three children"
treeState.rootNode.data === undefined && (treeState.rootNode.children!.length as number) === 2,
"root node should now have two children after node2 moved into node1"
);
assert(treeState.rootNode.children![1].children!.length === 2, "root's second child should now have two children");
});
test("computeMove - noop action", () => {
let nodeToMove = newLayoutNode(undefined, undefined, undefined, { blockId: "nodeToMove" });
let treeState = newLayoutTreeState(
const nodeToMove = newLayoutNode(undefined, undefined, undefined, { blockId: "nodeToMove" });
const treeState = newLayoutTreeState(
newLayoutNode(undefined, undefined, [
nodeToMove,
newLayoutNode(undefined, undefined, undefined, { blockId: "otherNode" }),

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "waveterm",
"version": "0.14.1",
"version": "0.14.2-beta.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "waveterm",
"version": "0.14.1",
"version": "0.14.2-beta.0",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [