How to use the react-addons-test-utils.scryRenderedDOMComponentsWithTag 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 georgeOsdDev / react-fileupload-progress / test / components / FileUploadProgress_spec.js View on Github external
/* Default rendered from*/

        // <div>
        //   <form method="post">
        //     <div>
        //       <input name="file" type="file">
        //     </div>
        //     <input type="submit">
        //   </form>
        // </div>

        let form = TestUtils.findRenderedDOMComponentWithTag(component, 'form');
        expect(ReactDom.findDOMNode(form).method).to.be.eql('post');

        let inputContent = TestUtils.scryRenderedDOMComponentsWithTag(component, 'input');
        expect(inputContent.length).to.be.eql(2);
        expect(ReactDom.findDOMNode(inputContent[0]).type).to.be.eql('file');
        expect(ReactDom.findDOMNode(inputContent[1]).type).to.be.eql('submit');
    });
github fireflylearning / pattern-library / tests / ff_container-item-repeater.js View on Github external
it('should generate correct class for modifier \'' + modifier + '\'', function() {
            var element = React.createElement(ItemRepeater, { modifier: modifier }, data.map(function(datum) {
                return React.createElement('p', { key: datum.key, style: { margin: 0 } }, datum.text);
            }));
            var component = TestUtils.renderIntoDocument(element);
            var items = TestUtils.scryRenderedDOMComponentsWithTag(component, 'li');
            var allMatch = _.every(items, function(item) {
                return item.className === expectedClasses[i];
            });
            expect(allMatch).to.be.true;
        })
    });
github Mittal-Analytics / Screener.in / app / components / __tests__ / modal-tests.js View on Github external
it('should trigger close', function() {
    var button = TestUtils.findRenderedDOMComponentWithTag(
      modal, 'button'
    );
    TestUtils.Simulate.click(button);
    var heading = TestUtils.findRenderedDOMComponentWithTag(
      modal, 'h1'
    );
    expect(heading).toBeDefined();
    var close = TestUtils.scryRenderedDOMComponentsWithTag(
      modal, 'button'
    )[1];
    expect(onClose).not.toBeCalled();
    TestUtils.Simulate.click(close);
    expect(onClose).toBeCalled();
  });
});
github cyverse / troposphere / test / components / images / list / imageListCard.spec.js View on Github external
it("should navigate to image details page when user clicks on the image", function(){
        var image = TestUtils.scryRenderedDOMComponentsWithTag(imageCardElement, "img");
        TestUtils.Simulate.click(image[0]);
        expect(navigator.navigateTo.calledOnce).toBe(true);
      });
github teropa / redux-voting-client / test / components / Voting_spec.jsx View on Github external
it('invokes callback when a button is clicked', () =&gt; {
    let votedWith;
    function vote(entry) {&nbsp;votedWith = entry; }

    const component = renderIntoDocument(
      
    );
    const buttons = scryRenderedDOMComponentsWithTag(component, 'button');
    Simulate.click(buttons[0]);

    expect(votedWith).to.equal('Trainspotting');
  });
github quii / mockingjay-server / ui / __tests__ / client / app / form-controllers / methodSwitcher.spec.js View on Github external
it('highlights selected method and sends correct data on clicks', () =&gt; {
    const initiallySelectedMethod = 'POST';
    const onChange = jest.fn();
    const component = TestUtils.renderIntoDocument(
      
    );
    const buttons = TestUtils.scryRenderedDOMComponentsWithTag(component, 'button');
    const buttonNames = buttons.map(b =&gt; b.textContent);

    expect(buttonNames).toEqual(MethodSwitcher.methods);
    expect(getSelectedMethod(component)).toEqual(initiallySelectedMethod);

    const putButton = findButtonWithMethod(buttons, 'PUT');
    TestUtils.Simulate.click(putButton);

    expect(onChange).toBeCalledWith(
      {
        target: {
          name: 'method',
          value: 'PUT',
        },
      });
  });
github py-in-the-sky / gae-flask-redux-react-starter-kit / browser_client / __test__ / utils.js View on Github external
export const createFinder = reactTree => query => {
    if (typeof query !== 'string')
        return scryRenderedComponentsWithType(reactTree, query)
    else if (query.startsWith('.'))
        return scryRenderedDOMComponentsWithClass(reactTree, query.substring(1))
    else
        return scryRenderedDOMComponentsWithTag(reactTree, query)
}
github teropa / redux-voting-client / test / components / Voting_spec.jsx View on Github external
const pair = ['Trainspotting', '28 Days Later'];
    const container = document.createElement('div');
    let component = ReactDOM.render(
      ,
      container
    );

    let firstButton = scryRenderedDOMComponentsWithTag(component, 'button')[0];
    expect(firstButton.textContent).to.equal('Trainspotting');

    pair[0] = 'Sunshine';
    component = ReactDOM.render(
      ,
      container
    );
    firstButton = scryRenderedDOMComponentsWithTag(component, 'button')[0];
    expect(firstButton.textContent).to.equal('Trainspotting');
  });
github Mittal-Analytics / Screener.in / app / talks / __tests__ / talks-tests.js View on Github external
return talks._req.then(() => {
      expect(talks.state.talks.results).toEqual(results);
      var latest = TestUtils.scryRenderedDOMComponentsWithTag(talks, 'a')[0];
      expect(latest.textContent).toEqual('Goto Latest Links');
    })
  });
github Code4HR / okcandidate-v1 / test / frontend / components / organisms / CandidateMatchCandidateSpec.js View on Github external
beforeEach(() => {
        flexbox = TestUtils.scryRenderedDOMComponentsWithTag(card, 'div')[0]
      })