import React from 'react';
import { mount } from 'enzyme';

import ShowMore from '.';

describe('ShowMore', () => {
  const node = mount(<ShowMore>Hello, world.</ShowMore>);
  const classes = node.getDOMNode().classList;

  it('to display a .ShowMore element.', () => {
    expect(classes.contains('ShowMore')).toBe(true);
  });

  it('to toggle the open state.', () => {
    const openState = {
      was: node.state().open,
    };

    node.find('.ShowMore-toggle').simulate('click');
    openState.is = node.state().open;

    expect(openState.is).toBe(!openState.was);
  });
});
