Home / File/ SyntheticWheelEvent-test.js — react Source File

SyntheticWheelEvent-test.js — react Source File

Architecture documentation for SyntheticWheelEvent-test.js, a javascript file in the react codebase.

Entity Profile

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';

let React;
let ReactDOMClient;
let act;

describe('SyntheticWheelEvent', () => {
  let container;
  let root;

  beforeEach(() => {
    React = require('react');
    ReactDOMClient = require('react-dom/client');
    act = require('internal-test-utils').act;

    // The container has to be attached for events to fire.
    container = document.createElement('div');
    document.body.appendChild(container);
    root = ReactDOMClient.createRoot(container);
  });

  afterEach(() => {
    document.body.removeChild(container);
    container = null;
  });

  it('should normalize properties from the MouseEvent interface', async () => {
    const events = [];
    const onWheel = event => {
      event.persist();
      events.push(event);
    };
    await act(async () => {
      root.render(<div onWheel={onWheel} />);
    });

    container.firstChild.dispatchEvent(
      new MouseEvent('wheel', {
        bubbles: true,
        button: 1,
      }),
    );

    expect(events.length).toBe(1);
    expect(events[0].button).toBe(1);
  });

  it('should normalize properties from the WheelEvent interface', async () => {
    const events = [];
    const onWheel = event => {
      event.persist();
// ... (65 more lines)

Frequently Asked Questions

What does SyntheticWheelEvent-test.js do?
SyntheticWheelEvent-test.js is a source file in the react codebase, written in javascript.
Where is SyntheticWheelEvent-test.js in the architecture?
SyntheticWheelEvent-test.js is located at packages/react-dom/src/events/__tests__/SyntheticWheelEvent-test.js (directory: packages/react-dom/src/events/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free