Improve code coverage

This commit is contained in:
David Lechner
2022-02-22 12:32:20 -06:00
parent b3ed75f02b
commit a0da9f7111
6 changed files with 153 additions and 1 deletions
+11
View File
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 The Pybricks Authors
import { render } from '@testing-library/react';
import React from 'react';
import ViewHeightSensor from './ViewHeightSensor';
it('should set the --pb-vh variable on resize', () => {
render(<ViewHeightSensor />);
// REVISIT: it is not easy to test the resize event since jest-dom doesn't do layout
});
+2
View File
@@ -26,6 +26,7 @@ export function useTooltip2MonkeyPatch<T>(): React.RefObject<Tooltip2<T>> {
const tooltipRef = useRef<Tooltip2<T>>(null);
useEffect(() => {
// istanbul ignore if: should not happen ever
if (!tooltipRef.current) {
return;
}
@@ -55,6 +56,7 @@ export function useTooltip2MonkeyPatch<T>(): React.RefObject<Tooltip2<T>> {
* @param tooltipRef The reference returned from useTooltip2MonkeyPatch()
*/
export function closeTooltip2<T>(tooltipRef: React.RefObject<Tooltip2<T>>): void {
// istanbul ignore if: should not happen ever
if (!tooltipRef.current) {
return;
}