1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @emails react-core
    
  8.  */
    
  9. 
    
  10. 'use strict';
    
  11. 
    
  12. import {hasPointerEvent, setPointerEvent} from './domEnvironment';
    
  13. 
    
  14. export function describeWithPointerEvent(message, describeFn) {
    
  15.   const pointerEvent = 'PointerEvent';
    
  16.   const fallback = 'MouseEvent/TouchEvent';
    
  17.   describe.each`
    
  18.     value    | name
    
  19.     ${true}  | ${pointerEvent}
    
  20.     ${false} | ${fallback}
    
  21.   `(`${message}: $name`, entry => {
    
  22.     const hasPointerEvents = entry.value;
    
  23.     setPointerEvent(hasPointerEvents);
    
  24.     describeFn(hasPointerEvents);
    
  25.   });
    
  26. }
    
  27. 
    
  28. export function testWithPointerType(message, testFn) {
    
  29.   const table = hasPointerEvent()
    
  30.     ? ['mouse', 'touch', 'pen']
    
  31.     : ['mouse', 'touch'];
    
  32.   test.each(table)(`${message}: %s`, pointerType => {
    
  33.     testFn(pointerType);
    
  34.   });
    
  35. }