import { renderHook } from '@testing-library/react';
import { useNonNativeButtonAttrs } from './use-non-native-button-attrs';
describe('useNonNativeButtonAttrs hook', function () {
  const defaults = {
    isDisabled: false,
    onClick: jest.fn(),
    onKeyDown: jest.fn(),
    tabIndex: 0
  };
  it('should return correct attributes if element is enabled', function () {
    const {
      result
    } = renderHook(() => useNonNativeButtonAttrs(defaults));
    expect(result.current).toEqual({
      tabIndex: 0,
      'aria-disabled': false,
      role: 'button',
      onClick: expect.any(Function),
      onKeyDown: expect.any(Function)
    });
  });
  it('should return correct attributes if element is disabled', function () {
    const {
      result
    } = renderHook(() => useNonNativeButtonAttrs({
      ...defaults,
      isDisabled: true
    }));
    expect(result.current).toEqual({
      tabIndex: -1,
      'aria-disabled': true,
      role: 'button',
      onClick: expect.any(Function),
      onKeyDown: expect.any(Function)
    });
  });
});