import React from 'react';
import { render } from '@testing-library/react';
import Wheel from '../index'; // function fakeTimers() {
//   performance.timing = {};
//   performance.timing.navigationStart = 0;
// }
// fakeTimers();

describe('Wheel', function () {
  it('Wheel render visible', function () {
    var _render = render( /*#__PURE__*/React.createElement(Wheel, {
      dataSource: [{
        value: '1',
        label: '选项一'
      }, {
        value: '2',
        label: '选项二'
      }]
    })),
        container = _render.container;

    expect(container).toMatchSnapshot();
  });
  it('Wheel set props value', function () {
    var _render2 = render( /*#__PURE__*/React.createElement(Wheel, {
      dataSource: [{
        value: '1',
        label: '选项一'
      }, {
        value: '2',
        label: '选项二'
      }],
      defaultValue: "1",
      value: "1"
    })),
        container = _render2.container;

    expect(container).toMatchSnapshot();
  });
  it('Wheel set fieldNames', function () {
    var _render3 = render( /*#__PURE__*/React.createElement(Wheel, {
      dataSource: [{
        value: '1',
        label: '选项一'
      }, {
        value: '2',
        label: '选项二'
      }],
      fieldNames: {
        value: 'value'
      }
    })),
        container = _render3.container;

    expect(container).toMatchSnapshot();
  });
  it('Wheel render defaultValue', function () {
    var _render4 = render( /*#__PURE__*/React.createElement(Wheel, {
      dataSource: [{
        value: '1',
        label: '选项一'
      }, {
        value: '2',
        label: '选项二'
      }],
      defaultValue: "1"
    })),
        container = _render4.container;

    expect(container).toMatchSnapshot();
  });
  it('Wheel disabled', function () {
    var _render5 = render( /*#__PURE__*/React.createElement(Wheel, {
      dataSource: [{
        value: '1',
        label: '选项一'
      }, {
        value: '2',
        label: '选项二'
      }],
      disabled: true
    })),
        container = _render5.container;

    expect(container).toMatchSnapshot();
  });
  it('Wheel set props disabled', function () {
    var _render6 = render( /*#__PURE__*/React.createElement(Wheel, {
      dataSource: [{
        value: '1',
        label: '选项一'
      }, {
        value: '2',
        label: '选项二'
      }],
      defaultValue: "1",
      value: "1",
      disabled: true
    })),
        container = _render6.container;

    var disabled = container.querySelectorAll('.za-wheel__item--disabled');
    expect(disabled === null || disabled === void 0 ? void 0 : disabled.length).toBeGreaterThan(0);
  }); // it('Wheel touch move', () => {
  //   // jest.useFakeTimers();
  //   const { container } = render(
  //     <Wheel
  //       dataSource={[
  //         { value: '1', label: '选项一' },
  //         { value: '2', label: '选项二' },
  //       ]}
  //       defaultValue="1"
  //       value="1"
  //     />
  //   );
  //   // scroll = new BScroll(wrapper.ref('secondRef'), scrollOptions);
  //   // wrapper = scroll.wrapper;
  //   const wheel = container.querySelector('.za-wheel');
  //   fireEvent.touchStart(wheel!, { pointerId: 12, clientY: 0, buttons: 1 });
  //   fireEvent.touchMove(wheel!, { pointerId: 12, clientY: -100, buttons: 1 });
  //   fireEvent.touchMove(wheel!, { pointerId: 12, clientY: -200, buttons: 1 });
  //   fireEvent.touchEnd(wheel!, { pointerId: 12 });
  // });
});