How to use the react-addons-test-utils.findRenderedDOMComponentWithTag 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_textarea.js View on Github external
const el = T.renderIntoDocument(
    <textarea required="{required}" placeholder="{placeholder}" name="{name}" id="{id}" disabled="{disabled}">  )

  // Get the `&lt;textarea&gt;`.
  const textarea = T.findRenderedDOMComponentWithTag(el, 'textarea')

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

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

  // ==================
  // Test for textarea.
  // ==================

  it('is disabled', function () {
    expect(textarea.disabled).toBe(true)
  })</textarea>
github vesparny / react-kickstart / test / components / Counter.spec.js View on Github external
test('is properly shaped and handles events', (t) =&gt; {
  const tree = TestUtils.renderIntoDocument()
  let counter = TestUtils.findRenderedComponentWithType(tree, Counter)
  TestUtils.Simulate.click(TestUtils.findRenderedDOMComponentWithTag(counter, 'button'))
  t.is(counter.props.count, 1, 'should receive and increment counter')
  t.is(TestUtils.findRenderedDOMComponentWithTag(counter, 'h1').textContent, 'Count: 1', 'DOM populated accordingly')

  const spy = sinon.spy()
  counter = TestUtils.renderIntoDocument()
  const button = TestUtils.findRenderedDOMComponentWithTag(counter, 'button')
  TestUtils.Simulate.click(button)
  t.truthy(spy.calledOnce, 'onIncrement should get called when a click on button happens')
})
github KleeGroup / focus-components / src / components / dropdown / __tests__ / index.js View on Github external
it('icon is rendered', () => {
                const buttonCpt = TestUtils.findRenderedDOMComponentWithTag(renderedTest, 'button');
                const icon = buttonCpt.getElementsByTagName('i')[0];
                expect(icon.textContent).toBe('apps');
            })
github localnerve / flux-react-example / tests / unit / components / Html.js View on Github external
it('should render a title', function () {
    var component = testUtils.findRenderedDOMComponentWithTag(htmlComponent, 'title');
    expect(component.textContent).to.be.empty;
  });
github yangshun / commitbait / tests / views / HomeView.spec.js View on Github external
it('Should render with an <h2> that includes Sample Counter text.', function () {
    const h2 = TestUtils.findRenderedDOMComponentWithTag(_rendered, 'h2');

    expect(h2).to.exist;
    expect(h2.textContent).to.match(/Sample Counter/);
  });
</h2>
github juliocesar / neob / test / components / counter.spec.js View on Github external
it('should get called when a click on button happens', () =&gt; {
        const spy = sinon.spy()
        const counter = TestUtils.renderIntoDocument(
          
        )
        const button = TestUtils.findRenderedDOMComponentWithTag(
          counter, 'button'
        )
        TestUtils.Simulate.click(button)
        expect(spy).to.have.been.calledOnce
      })
    })
github KleeGroup / focus-components / src / components / dropdown / __tests__ / index.js View on Github external
it('shape is rendered', () => {
                const buttonCpt = TestUtils.findRenderedDOMComponentWithTag(renderedTest, 'button');
                expect(buttonCpt.getAttribute('class').indexOf('mdl-button--raised')).not.toBe(-1);
            });
            it('icon is rendered', () => {
github threepointone / routah / tests / index.js View on Github external
it('prop: onClick className style', done =&gt; {
    let h = createMemoryHistory()
    let tree = render(
       (e.preventDefault(), done())}&gt;go where?
    , node)
    let a = findRenderedDOMComponentWithTag(tree, 'a')
    expect(a.pathname).toEqual('/x')
    expect([ ...a.classList ]).toEqual([ 'some', 'thing', 'here' ])
    Simulate.click(a)

  })
github Mittal-Analytics / Screener.in / app / __tests__ / watchlist-tests.js View on Github external
return watchlist._req.then(() => {
      expect(watchlist.state.screen).toEqual(SCREEN);
      var table = TestUtils.findRenderedDOMComponentWithTag(
        watchlist, 'table');
      expect(table).toBeDefined();
    });
  });
github scup / atellier / spec / Workspace.spec.jsx View on Github external
it('should render workspace', () => {

    let workspace = renderWorkspace({
      component: {
        component: TestComponent,
        componentName: 'Test Component'
      }
    });

    let textarea = TestUtils.findRenderedDOMComponentWithTag(
      workspace, 'textarea'
    );

    TestUtils.Simulate.change(textarea);
  });