Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "rc-util in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'rc-util' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

it('filterOption is false', () => {
    const wrapper = mount<select>(
      </select>
        <option value="1">1</option>
        <option value="2">2</option>
      ,
    );
    // @HACK
    const input = wrapper.find('input') as any;
    input.instance().focus = jest.fn();
    input
      .simulate('change', { target: { value: 'a' } })
      .simulate('keyDown', { keyCode: KeyCode.ENTER });

    expect(wrapper.state().value).toEqual(['a']);
    expect(wrapper.find('.rc-select-selection__choice__content').text()).toBe('a');
  });
// 09-30 page up 08-30
    keySimulateCheck(keyCode.PAGE_UP, 'Aug', 30);

    // 08-30 page down 09-30
    keySimulateCheck(keyCode.PAGE_DOWN, 'Sep', 30);

    keyDown(keyCode.BACKSLASH);
    expect(keyDownEvent).toEqual(1);

    keyDown(keyCode.ENTER);

    expect(onChange.mock.calls[0][0][0].format(format)).toEqual('2000-09-30');

    // 2000-09-30 ctrl+right 2001-09-30
    keySimulateCheck(keyCode.RIGHT, 'Sep', 30, {
      ctrlKey: true,
    });
    expect(wrapper.find('.rc-calendar-range-right .rc-calendar-year-select').text()).toEqual(
      '2001',
    );

    // 2001-09-30 ctrl+right 2000-09-30
    keySimulateCheck(keyCode.LEFT, 'Sep', 30, {
      ctrlKey: true,
    });

    keyDown(keyCode.ENTER);
    expect(onChange.mock.calls[1][0][0].format(format)).toEqual('2000-09-30');
    expect(onChange.mock.calls[1][0][1].format(format)).toEqual('2000-09-30');

    expect(onSelect.mock.calls[0][0][0].format(format)).toEqual('2000-09-30');
};

    // 09-03 down 09-10
    keySimulateCheck(keyCode.DOWN, 'Sep', 10);

    // 09-03 left 09-09
    keySimulateCheck(keyCode.LEFT, 'Sep', 9);

    // 09-09 right 09-10
    keySimulateCheck(keyCode.RIGHT, 'Sep', 10);

    // 09-10 right 09-03
    keySimulateCheck(keyCode.UP, 'Sep', 3);

    // 09-10 home 09-01
    keySimulateCheck(keyCode.HOME, 'Sep', 1);

    // 09-10 end 09-30
    keySimulateCheck(keyCode.END, 'Sep', 30);

    // 09-30 page up 08-30
    keySimulateCheck(keyCode.PAGE_UP, 'Aug', 30);

    // 08-30 page down 09-30
    keySimulateCheck(keyCode.PAGE_DOWN, 'Sep', 30);

    keyDown(keyCode.BACKSLASH);
    expect(keyDownEvent).toEqual(1);

    keyDown(keyCode.ENTER);

    expect(onChange.mock.calls[0][0][0].format(format)).toEqual('2000-09-30');
keySimulateCheck(keyCode.RIGHT, 'Sep', 10);

    // 09-10 right 09-03
    keySimulateCheck(keyCode.UP, 'Sep', 3);

    // 09-10 home 09-01
    keySimulateCheck(keyCode.HOME, 'Sep', 1);

    // 09-10 end 09-30
    keySimulateCheck(keyCode.END, 'Sep', 30);

    // 09-30 page up 08-30
    keySimulateCheck(keyCode.PAGE_UP, 'Aug', 30);

    // 08-30 page down 09-30
    keySimulateCheck(keyCode.PAGE_DOWN, 'Sep', 30);

    keyDown(keyCode.BACKSLASH);
    expect(keyDownEvent).toEqual(1);

    keyDown(keyCode.ENTER);

    expect(onChange.mock.calls[0][0][0].format(format)).toEqual('2000-09-30');

    // 2000-09-30 ctrl+right 2001-09-30
    keySimulateCheck(keyCode.RIGHT, 'Sep', 30, {
      ctrlKey: true,
    });
    expect(wrapper.find('.rc-calendar-range-right .rc-calendar-year-select').text()).toEqual(
      '2001',
    );
keySimulateCheck(keyCode.LEFT, 'Sep', 9);

    // 09-09 right 09-10
    keySimulateCheck(keyCode.RIGHT, 'Sep', 10);

    // 09-10 right 09-03
    keySimulateCheck(keyCode.UP, 'Sep', 3);

    // 09-10 home 09-01
    keySimulateCheck(keyCode.HOME, 'Sep', 1);

    // 09-10 end 09-30
    keySimulateCheck(keyCode.END, 'Sep', 30);

    // 09-30 page up 08-30
    keySimulateCheck(keyCode.PAGE_UP, 'Aug', 30);

    // 08-30 page down 09-30
    keySimulateCheck(keyCode.PAGE_DOWN, 'Sep', 30);

    keyDown(keyCode.BACKSLASH);
    expect(keyDownEvent).toEqual(1);

    keyDown(keyCode.ENTER);

    expect(onChange.mock.calls[0][0][0].format(format)).toEqual('2000-09-30');

    // 2000-09-30 ctrl+right 2001-09-30
    keySimulateCheck(keyCode.RIGHT, 'Sep', 30, {
      ctrlKey: true,
    });
    expect(wrapper.find('.rc-calendar-range-right .rc-calendar-year-select').text()).toEqual(
/* eslint-disable react/no-multi-comp */
const keyCode = require('rc-util').KeyCode;
const expect = require('expect.js');
const InputNum = require('../index');
const React = require('react');
const TestUtils = require('react-addons-test-utils');
const ReactDOM = require('react-dom');
const Simulate = TestUtils.Simulate;
require('../assets/index.less');

const defaultValue = 98;

describe('inputNumber', () => {
  const container = document.createElement('div');
  document.body.appendChild(container);

  const Component = React.createClass({
    getInitialState() {
keySimulateCheck(keyCode.DOWN, 'Sep', 10);

    // 09-03 left 09-09
    keySimulateCheck(keyCode.LEFT, 'Sep', 9);

    // 09-09 right 09-10
    keySimulateCheck(keyCode.RIGHT, 'Sep', 10);

    // 09-10 right 09-03
    keySimulateCheck(keyCode.UP, 'Sep', 3);

    // 09-10 home 09-01
    keySimulateCheck(keyCode.HOME, 'Sep', 1);

    // 09-10 end 09-30
    keySimulateCheck(keyCode.END, 'Sep', 30);

    // 09-30 page up 08-30
    keySimulateCheck(keyCode.PAGE_UP, 'Aug', 30);

    // 08-30 page down 09-30
    keySimulateCheck(keyCode.PAGE_DOWN, 'Sep', 30);

    keyDown(keyCode.BACKSLASH);
    expect(keyDownEvent).toEqual(1);

    keyDown(keyCode.ENTER);

    expect(onChange.mock.calls[0][0][0].format(format)).toEqual('2000-09-30');

    // 2000-09-30 ctrl+right 2001-09-30
    keySimulateCheck(keyCode.RIGHT, 'Sep', 30, {
addDocumentTouchEvents() {
      // just work for Chrome iOS Safari and Android Browser
      this.onTouchMoveListener = addEventListener(this.document, 'touchmove', this.onTouchMove);
      this.onTouchUpListener = addEventListener(this.document, 'touchend', this.onEnd);
    }
componentDidUpdate() {
      const { props } = this;
      const { state } = this;

      // We must listen to `mousedown` or `touchstart`, edge case:
      // https://github.com/ant-design/ant-design/issues/5804
      // https://github.com/react-component/calendar/issues/250
      // https://github.com/react-component/trigger/issues/50
      if (state.popupVisible) {
        let currentDocument;
        if (!this.clickOutsideHandler && (this.isClickToHide() || this.isContextMenuToShow())) {
          currentDocument = props.getDocument();
          this.clickOutsideHandler = addEventListener(
            currentDocument,
            'mousedown',
            this.onDocumentClick,
          );
        }
        // always hide on mobile
        if (!this.touchOutsideHandler) {
          currentDocument = currentDocument || props.getDocument();
          this.touchOutsideHandler = addEventListener(
            currentDocument,
            'touchstart',
            this.onDocumentClick,
          );
        }
        // close popup when trigger type contains 'onContextMenu' and document is scrolling.
        if (!this.contextMenuOutsideHandler1 && this.isContextMenuToShow()) {
onBoardMouseDown = e => {
    const buttons = e.buttons;

    // only work on left click
    // @see https://developer.mozilla.org/en-US/docs/Web/Events/mousedown
    if (buttons !== 1) return;

    const x = e.clientX;
    const y = e.clientY;
    this.pointMoveTo({
      x,
      y,
    });
    this.removeListeners();
    this.dragListener = addEventListener(window, 'mousemove', this.onBoardDrag);
    this.dragUpListener = addEventListener(window, 'mouseup', this.onBoardDragEnd);
  };

Is your System Free of Underlying Vulnerabilities?
Find Out Now