Skip to content

Commit

Permalink
fix(tests): unit and snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
jor-row committed Sep 30, 2024
1 parent 19bbbb3 commit 16be115
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/components/Menu/Menu.unit.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3161,6 +3161,7 @@ exports[`<Menu /> snapshot should match snapshot with seperator between items 1`
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -3443,6 +3444,7 @@ exports[`<Menu /> snapshot should match snapshot with seperator between items 1`
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -4461,6 +4463,7 @@ exports[`<Menu /> snapshot should match snapshot with seperator within section 1
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -5001,6 +5004,7 @@ exports[`<Menu /> snapshot should match snapshot with seperator within section 1
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -6009,6 +6013,7 @@ exports[`<Menu /> snapshot should match snapshot with seperator within section 1
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -6549,6 +6554,7 @@ exports[`<Menu /> snapshot should match snapshot with seperator within section 1
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -7682,6 +7688,7 @@ exports[`<Menu /> snapshot should match snapshot with seperator within selection
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -8272,6 +8279,7 @@ exports[`<Menu /> snapshot should match snapshot with seperator within selection
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -9392,6 +9400,7 @@ exports[`<Menu /> snapshot should match snapshot with seperator within selection
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -9982,6 +9991,7 @@ exports[`<Menu /> snapshot should match snapshot with seperator within selection
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -10244,6 +10254,7 @@ exports[`<Menu /> snapshot should match snapshot with style 1`] = `
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -10474,6 +10485,7 @@ exports[`<Menu /> snapshot should match snapshot with style 1`] = `
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -10725,6 +10737,7 @@ exports[`<Menu /> snapshot should match snapshot with tickPosition 1`] = `
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -10966,6 +10979,7 @@ exports[`<Menu /> snapshot should match snapshot with tickPosition 1`] = `
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down
2 changes: 2 additions & 0 deletions src/components/MenuSection/MenuSection.unit.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,7 @@ exports[`<MenuSection /> snapshot should match snapshot with seperator 1`] = `
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -1650,6 +1651,7 @@ exports[`<MenuSection /> snapshot should match snapshot with seperator 1`] = `
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ exports[`<MenuSelectionGroup /> snapshot should match snapshot 1`] = `
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -877,6 +878,7 @@ exports[`<MenuSelectionGroup /> snapshot should match snapshot 1`] = `
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -1562,6 +1564,7 @@ exports[`<MenuSelectionGroup /> snapshot should match snapshot with seperator wi
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down Expand Up @@ -1927,6 +1930,7 @@ exports[`<MenuSelectionGroup /> snapshot should match snapshot with seperator wi
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onPointerDown={[Function]}
onTouchCancel={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
Expand Down
5 changes: 3 additions & 2 deletions src/components/TreeNodeBase/TreeNodeBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const TreeNodeBase = (props: Props, providedRef: TreeNodeBaseRefOrCallbackRef):
const internalRef = useRef<HTMLDivElement>();
const ref = providedRef && typeof providedRef !== 'function' ? providedRef : internalRef;
const isHidden = !nodeDetails || nodeDetails.isHidden;
const isLeaf = nodeDetails?.isLeaf;

// When used in a popover, the ref will be a callback.
// We need to update this callback ref, so the popover
Expand Down Expand Up @@ -115,14 +116,14 @@ const TreeNodeBase = (props: Props, providedRef: TreeNodeBaseRefOrCallbackRef):
if (
treeContext &&
treeContext.itemSelection.selectionMode !== 'none' &&
(treeContext.selectableNodes === 'any' || nodeDetails?.isLeaf)
(treeContext.selectableNodes === 'any' || isLeaf)
) {
treeContext.itemSelection.toggle(nodeId);
}

onPress?.(event);
},
[treeContext, nodeDetails.isLeaf, onPress, ref, nodeId]
[treeContext, isLeaf, onPress, ref, nodeId]
);

const { pressProps, isPressed } = usePress({
Expand Down

0 comments on commit 16be115

Please sign in to comment.