diff --git a/packages/ibm-products/src/global/js/hooks/__tests__/useWindowResize.test.js b/packages/ibm-products/src/global/js/hooks/__tests__/useWindowResize.test.js new file mode 100644 index 0000000000..64c9713d17 --- /dev/null +++ b/packages/ibm-products/src/global/js/hooks/__tests__/useWindowResize.test.js @@ -0,0 +1,42 @@ +/* eslint-disable react/prop-types */ +/** + * Copyright IBM Corp. 2024 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ +import React, { useState } from 'react'; +import { useWindowResize } from '../useWindowResize'; +import { render, screen, fireEvent } from '@testing-library/react'; + +const TestComponent = (props) => { + const { throttleInterval } = props; + const [height, setHeight] = useState(false); + useWindowResize( + ({ current }) => { + const { innerHeight } = current; + setHeight(innerHeight); + }, + [], + throttleInterval + ); + return