How to use the @leafygreen-ui/lib.typeIs.button function in @leafygreen-ui/lib

To help you get started, we’ve selected a few @leafygreen-ui/lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mongodb / leafygreen-ui / packages / button / src / Button.spec.tsx View on Github external
test(`renders a button with the given type when one is set`, () => {
    const submitButton = render(<button type="submit">My submit button</button>)
      .container.firstChild;

    if (!typeIs.button(submitButton)) {
      throw new Error('Rendered element is not a button');
    }

    expect(submitButton.type).toBe('submit');
  });
github mongodb / leafygreen-ui / packages / button / src / Button.spec.tsx View on Github external
test(`renders the disabled and aria-disabled attributes when disabled is set`, () =&gt; {
    renderedComponent.rerender(
      <button disabled="{true}" title="{title}">
        {child}
      </button>,
    );

    if (!typeIs.button(renderedButton)) {
      throw new Error('Rendered element is not a button');
    }

    expect(renderedButton.disabled).toBe(true);
    expect(renderedButton.getAttribute('aria-disabled')).toBe('true');
  });