How to use the react-addons-test-utils.findRenderedDOMComponentWithClass function in react-addons-test-utils

To help you get started, we’ve selected a few react-addons-test-utils 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 t7 / react-generated-style-guide / __tests__ / test_form_button_link.js View on Github external
const target = '_blank'
  const text = 'GO'
  const title = 'Example Title'

  // Insert the component into DOM.
  const el = T.renderIntoDocument(
    <button title="{title}" href="{href}">
  )

  // Get button.
  const button = T.findRenderedDOMComponentWithClass(el, 't7-form__button')

  // ===================
  // Test for existence.
  // ===================

  it('exists in the page', function () {
    expect(T.isCompositeComponent(el)).toBe(true)
  })

  // =============
  // Test for tag.
  // =============

  it('is a link tag', function () {
    const x = button.tagName.toLowerCase()
</button>
github t7 / react-generated-style-guide / __tests__ / test_data_table.js View on Github external
describe('DataTable', function () {
  // Insert the component into DOM.
  const el = T.renderIntoDocument(
    
  )

  // Get parent element.
  const parent = T.findRenderedDOMComponentWithClass(el, 't7-data-table__wrapper')

  // Get column headers.
  const thead = parent.querySelector('thead')
  const th = thead.querySelectorAll('th')

  // Get the rows.
  const tbody = parent.querySelector('tbody')

  // Get pagination.
  const pagination = parent.querySelectorAll('.t7-data-table__pagination')

  // ========================
  // Pagination: top, bottom.
  // ========================

  const paginationTop = pagination[0]
github negomi / react-tic-tac-toe / test / specs / TicTacToe.spec.js View on Github external
it('should contain a grid', () => {
      const grid = TestUtils.findRenderedDOMComponentWithClass(component, 'grid');
      assert.ok(grid);
    });
github SEL-Columbia / dokomoforms / dokomoforms / static / src / survey / js / components / baseComponents / __tests__ / FacilityRadios-tests.js View on Github external
it('renders no facilities message if no facilities passed', () =&gt; {
        var FacilityRadiosInstance = TestUtils.renderIntoDocument(
            
        );

        var message = TestUtils.findRenderedDOMComponentWithClass(FacilityRadiosInstance, 'content-padded');

        expect(message.textContent).toEqual('No nearby facilities located.');
    });
github saschwarz / react-svgpathplayer / tests / test_controls.js View on Github external
it('clicking pause button fires pause callback', function() {
            expect(this.output.props.pause).to.not.have.been.called();
            let button = TestUtils.findRenderedDOMComponentWithClass(this.output, 'pause');
            TestUtils.Simulate.click(button);
            expect(this.output.props.pause).to.have.been.called();
        });
    });
github gpbl / react-day-picker / test / DayPicker.js View on Github external
it("adds a `today` modifier to today date", () =&gt; {
    const dayPickerEl = TestUtils.renderIntoDocument(
      
    );
    const today = new Date();
    const todayEl = TestUtils.findRenderedDOMComponentWithClass(dayPickerEl,
      "DayPicker-Day--today");
    expect(ReactDOM.findDOMNode(todayEl).innerHTML).to.equal(`${today.getDate()}`);
  });
github mlaursen / react-md / src / js / Transitions / __tests__ / Overlay.js View on Github external
const overlayClassName = 'what-what';
    const overlay = renderIntoDocument(
      
    );

    const overlayContainerNode = findDOMNode(overlay);
    expect(overlayContainerNode.style.display).toBe(style.display);
    expect(overlayContainerNode.classList.contains(className)).toBe(true);

    const overlayNode = findRenderedDOMComponentWithClass(overlay, 'md-overlay');
    expect(overlayNode.style.background).toBe(overlayStyle.background);
    expect(overlayNode.classList.contains(overlayClassName)).toBe(true);
  });
github nylas-mail-lives / nylas-mail / spec / components / editable-list-spec.jsx View on Github external
it('calls onItemCreated', () => {
      const onItemCreated = jasmine.createSpy('onItemCreated');
      const list = makeList(['1', '2'], {initialState: {creatingItem: true}, onItemCreated});
      const createItem = findRenderedDOMComponentWithClass(list, 'create-item-input');
      const input = createItem.querySelector('input');
      findDOMNode(input).value = 'New Item';

      Simulate.keyDown(input, {key: 'Enter'});

      expect(onItemCreated).toHaveBeenCalledWith('New Item');
    });
github carlsverre / react-outlet / spec / basic.js View on Github external
expect(function() {
                TestUtils.findRenderedDOMComponentWithClass(tree, "outlet-content");
            }).toThrow();