Renamed nullable utils into isDefined and isUndefinedOrNull (#4402)
* Renamed nullable utils into isDefined and isUndefinedOrNull
This commit is contained in:
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import { fireEvent, render, renderHook } from '@testing-library/react';
|
||||
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import {
|
||||
ClickOutsideMode,
|
||||
@ -48,7 +48,7 @@ describe('useListenClickOutside', () => {
|
||||
);
|
||||
|
||||
act(() => {
|
||||
if (isNonNullable(containerRef.current)) {
|
||||
if (isDefined(containerRef.current)) {
|
||||
fireEvent.mouseDown(containerRef.current);
|
||||
fireEvent.click(containerRef.current);
|
||||
}
|
||||
@ -97,7 +97,7 @@ describe('useListenClickOutsideByClassName', () => {
|
||||
|
||||
act(() => {
|
||||
const notClickableElement = container.querySelector('.will-trigger');
|
||||
if (isNonNullable(notClickableElement)) {
|
||||
if (isDefined(notClickableElement)) {
|
||||
fireEvent.mouseDown(notClickableElement);
|
||||
fireEvent.click(notClickableElement);
|
||||
}
|
||||
@ -124,7 +124,7 @@ describe('useListenClickOutsideByClassName', () => {
|
||||
|
||||
act(() => {
|
||||
const notClickableElement = container.querySelector('.wont-trigger');
|
||||
if (isNonNullable(notClickableElement)) {
|
||||
if (isDefined(notClickableElement)) {
|
||||
fireEvent.mouseDown(notClickableElement);
|
||||
fireEvent.click(notClickableElement);
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
ClickOutsideMode,
|
||||
useListenClickOutsideV2,
|
||||
} from '@/ui/utilities/pointer-event/hooks/useListenClickOutsideV2';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
const containerRef = React.createRef<HTMLDivElement>();
|
||||
const nullRef = React.createRef<HTMLDivElement>();
|
||||
@ -77,7 +77,7 @@ describe('useListenClickOutsideV2', () => {
|
||||
);
|
||||
|
||||
act(() => {
|
||||
if (isNonNullable(containerRef.current)) {
|
||||
if (isDefined(containerRef.current)) {
|
||||
fireEvent.mouseDown(containerRef.current);
|
||||
fireEvent.click(containerRef.current);
|
||||
}
|
||||
@ -101,7 +101,7 @@ describe('useListenClickOutsideV2', () => {
|
||||
);
|
||||
|
||||
act(() => {
|
||||
if (isNonNullable(containerRef.current)) {
|
||||
if (isDefined(containerRef.current)) {
|
||||
fireEvent.mouseDown(containerRef.current);
|
||||
fireEvent.click(containerRef.current);
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import {
|
||||
} from '@/ui/utilities/pointer-event/hooks/useListenClickOutsideV2';
|
||||
import { ClickOutsideListenerCallback } from '@/ui/utilities/pointer-event/types/ClickOutsideListenerCallback';
|
||||
import { getScopeIdFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdFromComponentId';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
export const useClickOutsideListener = (componentId: string) => {
|
||||
// TODO: improve typing
|
||||
@ -67,7 +67,7 @@ export const useClickOutsideListener = (componentId: string) => {
|
||||
(callback) => callback.callbackId === callbackId,
|
||||
);
|
||||
|
||||
if (!isNonNullable(existingCallbackWithSameId)) {
|
||||
if (!isDefined(existingCallbackWithSameId)) {
|
||||
const existingCallbacksWithNewCallback = existingCallbacks.concat({
|
||||
callbackId,
|
||||
callbackFunction,
|
||||
|
||||
Reference in New Issue
Block a user