mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-13 18:14:09 +00:00
Improve code coverage
This commit is contained in:
@@ -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
|
||||
});
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user