<commit_before>import React, {findDOMNode} from 'react';
import {renderIntoDocument, Simulate} from 'react/lib/ReactTestUtils';

import Btn from '../Btn/Btn.js';
import classNames from '../Btn/Btn.css';

describe('Btn', () => {
  it('Should render a button', () => {
    const node = findDOMNode(renderIntoDocument(<Btn>btn</Btn>));
    assert.equal(node.nodeName, 'BUTTON');
  });

  it('Should output an anchor when passed an href', () => {
    const node = findDOMNode(renderIntoDocument(
      <Btn href="#">A link, really. Not a button at all.</Btn>
    ));
    assert.equal(node.nodeName, 'A');
  });

  it('Passes through the className to the actual DOM element', () => {
    const node = findDOMNode(renderIntoDocument(
      <Btn className="TESTMCTESTERSON"/>
    ));
    assert.ok(node.className.match(/\bTESTMCTESTERSON\b/));
  });

  it(`Doesn't pass through all props it's given`, () => {
    const node = findDOMNode(renderIntoDocument(
      <Btn data-someRandoAttribute="derp"/>
    ));
    assert.equal(node.getAttribute('data-someRandoAttribute'), null);
  });

  it('Correctly applies the className for the type', () => {
    ['primary', 'secondary', 'danger', 'white'].forEach(type => {
      const node = findDOMNode(renderIntoDocument(
        <Btn type={type}/>
      ));
      assert.ok(node.className.match(new RegExp(classNames[type])));
    });
  });

  it('Correctly applies the className for the variant', () => {
    ['cta', 'hollow', 'clean'].forEach(variant => {
      const node = findDOMNode(renderIntoDocument(<commit_msg>Btn test now reflects the CTA change<commit_after>import React, {findDOMNode} from 'react';
import {renderIntoDocument, Simulate} from 'react/lib/ReactTestUtils';

import Btn from '../Btn/Btn.js';
import classNames from '../Btn/Btn.css';

describe('Btn', () => {
  it('Should render a button', () => {
    const node = findDOMNode(renderIntoDocument(<Btn>btn</Btn>));
    assert.equal(node.nodeName, 'BUTTON');
  });

  it('Should output an anchor when passed an href', () => {
    const node = findDOMNode(renderIntoDocument(
      <Btn href="#">A link, really. Not a button at all.</Btn>
    ));
    assert.equal(node.nodeName, 'A');
  });

  it('Passes through the className to the actual DOM element', () => {
    const node = findDOMNode(renderIntoDocument(
      <Btn className="TESTMCTESTERSON"/>
    ));
    assert.ok(node.className.match(/\bTESTMCTESTERSON\b/));
  });

  it(`Doesn't pass through all props it's given`, () => {
    const node = findDOMNode(renderIntoDocument(
      <Btn data-someRandoAttribute="derp"/>
    ));
    assert.equal(node.getAttribute('data-someRandoAttribute'), null);
  });

  it('Correctly applies the className for the type', () => {
    ['primary', 'secondary', 'danger', 'white'].forEach(type => {
      const node = findDOMNode(renderIntoDocument(
        <Btn type={type}/>
      ));
      assert.ok(node.className.match(new RegExp(classNames[type])));
    });
  });

  it('Correctly applies the className for the variant', () => {
    ['hollow', 'clean'].forEach(variant => {
      const node = findDOMNode(renderIntoDocument(
{'fraction_non_alphanumeric': 0.17092651757188498, 'fraction_numerical': 0.0, 'mean_word_length': 3.787461773700306, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5654724', 'n_tokens_mistral': 970, 'n_tokens_neox': 944, 'n_words': 224}