Home / File/ testHelpers.js — react Source File

testHelpers.js — react Source File

Architecture documentation for testHelpers.js, a javascript file in the react codebase. 3 imports, 1 dependents.

File javascript BabelCompiler Entrypoint 3 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  e8ddf5ea_829d_30ec_14cf_70bc1d21a7a6["testHelpers.js"]
  c03693b0_2482_9a7d_a058_7ba891e5839d["domEnvironment.js"]
  e8ddf5ea_829d_30ec_14cf_70bc1d21a7a6 --> c03693b0_2482_9a7d_a058_7ba891e5839d
  010da236_784b_cbe9_c79d_2a93e35a2880["hasPointerEvent"]
  e8ddf5ea_829d_30ec_14cf_70bc1d21a7a6 --> 010da236_784b_cbe9_c79d_2a93e35a2880
  fc292dc3_3a11_3f76_520e_fd7050406acc["setPointerEvent"]
  e8ddf5ea_829d_30ec_14cf_70bc1d21a7a6 --> fc292dc3_3a11_3f76_520e_fd7050406acc
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071["index.js"]
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071 --> e8ddf5ea_829d_30ec_14cf_70bc1d21a7a6
  style e8ddf5ea_829d_30ec_14cf_70bc1d21a7a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @emails react-core
 */

'use strict';

import {hasPointerEvent, setPointerEvent} from './domEnvironment';

export function describeWithPointerEvent(message, describeFn) {
  const pointerEvent = 'PointerEvent';
  const fallback = 'MouseEvent/TouchEvent';
  describe.each`
    value    | name
    ${true}  | ${pointerEvent}
    ${false} | ${fallback}
  `(`${message}: $name`, entry => {
    const hasPointerEvents = entry.value;
    setPointerEvent(hasPointerEvents);
    describeFn(hasPointerEvents);
  });
}

export function testWithPointerType(message, testFn) {
  const table = hasPointerEvent()
    ? ['mouse', 'touch', 'pen']
    : ['mouse', 'touch'];
  test.each(table)(`${message}: %s`, pointerType => {
    testFn(pointerType);
  });
}

Domain

Subdomains

Frequently Asked Questions

What does testHelpers.js do?
testHelpers.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in testHelpers.js?
testHelpers.js defines 2 function(s): describeWithPointerEvent, testWithPointerType.
What does testHelpers.js depend on?
testHelpers.js imports 3 module(s): domEnvironment.js, hasPointerEvent, setPointerEvent.
What files import testHelpers.js?
testHelpers.js is imported by 1 file(s): index.js.
Where is testHelpers.js in the architecture?
testHelpers.js is located at packages/dom-event-testing-library/testHelpers.js (domain: BabelCompiler, subdomain: Entrypoint, directory: packages/dom-event-testing-library).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free