// @flow
import React from 'react';
import {
  mountWrappedComponent,
  renderSnapshot,
} from '../../../../../utils/tests';
import type { TriggerButtonProps } from '../context-menu.proptypes';
import { EllipsisButton } from './index';

const DEFAULT_PROPS: TriggerButtonProps = {
  onClick: () => {},
};

describe('EllipsisButton', () => {
  describe('snapshot', () => {
    it('matches the previous snapshot', () => {
      const button = renderSnapshot(<EllipsisButton {...DEFAULT_PROPS} />);
      expect(button).toMatchSnapshot();
    });
  });

  it('passes valid props to a child button', () => {
    const button = mountWrappedComponent(<EllipsisButton {...DEFAULT_PROPS} />);
    const child = button.children();
    expect(child.props()).toEqual({
      children: expect.anything(),
      onClick: DEFAULT_PROPS.onClick,
      insetFocus: true,
      'aria-haspopup': true,
    });
  });
});
