From 872590331c410e1a74be09f95ae4da2d0f5b3c6d Mon Sep 17 00:00:00 2001 From: Joachim Desroches <129734564+jedesroches@users.noreply.github.com> Date: Thu, 28 Nov 2024 01:16:10 +0100 Subject: [PATCH] [DataGrid] Change test dom check from /jsdom/ to /jsdom|HappyDOM/. (#15634) Co-authored-by: Joachim Desroches --- .../src/hooks/features/dimensions/useGridDimensions.ts | 2 +- .../hooks/features/virtualization/useGridVirtualScroller.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/x-data-grid/src/hooks/features/dimensions/useGridDimensions.ts b/packages/x-data-grid/src/hooks/features/dimensions/useGridDimensions.ts index dae588d1d1bdb..c29918e30bbf7 100644 --- a/packages/x-data-grid/src/hooks/features/dimensions/useGridDimensions.ts +++ b/packages/x-data-grid/src/hooks/features/dimensions/useGridDimensions.ts @@ -329,7 +329,7 @@ export function useGridDimensions( rootDimensionsRef.current = size; // jsdom has no layout capabilities - const isJSDOM = /jsdom/.test(window.navigator.userAgent); + const isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent); if (size.height === 0 && !errorShown.current && !props.autoHeight && !isJSDOM) { logger.error( diff --git a/packages/x-data-grid/src/hooks/features/virtualization/useGridVirtualScroller.tsx b/packages/x-data-grid/src/hooks/features/virtualization/useGridVirtualScroller.tsx index 679b05f8bbbbb..499c21a66c40b 100644 --- a/packages/x-data-grid/src/hooks/features/virtualization/useGridVirtualScroller.tsx +++ b/packages/x-data-grid/src/hooks/features/virtualization/useGridVirtualScroller.tsx @@ -92,7 +92,7 @@ type ScrollCache = ReturnType; let isJSDOM = false; try { if (typeof window !== 'undefined') { - isJSDOM = /jsdom/.test(window.navigator.userAgent); + isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent); } } catch (_) { /* ignore */