How to use the react-addons-test-utils.scryRenderedComponentsWithType 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 mlaursen / react-md / src / js / NavigationDrawers / __tests__ / Drawer.js View on Github external
expect(headers.length).toBe(1);
    expect(headers[0].props.title).toBe(props.title);
    expect(headers[0].props.closeDrawer).toBe(props.closeDrawer);
    expect(headers[0].props.closeIconChildren).toBe(props.closeIconChildren);
    expect(headers[0].props.closeIconClassName).toBe(props.closeIconClassName);
    expect(headers[0].props.persistent).toBe(props.persistent);
    expect(headers[0].props.children).toBe(props.children);

    // Closed mini drawer
    props = Object.assign({}, props, {
      drawerType: 'mini',
      mini: true,
      isOpen: false,
    });
    drawer = renderIntoDocument();
    headers = scryRenderedComponentsWithType(drawer, DrawerHeader);
    expect(headers.length).toBe(0);

    // Opened mini drawer
    props = Object.assign({}, props, {
      isOpen: true,
    });
    drawer = renderIntoDocument();
    headers = scryRenderedComponentsWithType(drawer, DrawerHeader);
    expect(headers.length).toBe(1);
  });
github keen / explorer / test / unit / components / explorer / index_spec.js View on Github external
it('has the right number of Modal child components', () => {
          expect(TestUtils.scryRenderedComponentsWithType(component, Modal)).toHaveLength(2);
        });
github keen / explorer / test / unit / components / explorer / index_spec.js View on Github external
it('properly tabs from the query builder to browsing favorites', () => {
        const props = _.assign({}, component.props, { persistence: {} });
        component = TestHelpers.renderComponent(Explorer, props);

        TestUtils.Simulate.click(component.refs['query-pane-tabs'].refs['browse-tab']);

        expect(TestUtils.scryRenderedComponentsWithType(component, BrowseQueries)).toHaveLength(1);
        expect(TestUtils.scryRenderedComponentsWithType(component, QueryBuilder)).toHaveLength(0);
      });
github cyverse / troposphere / test / components / modals / project / ProjectInstanceLaunchModal.spec.js View on Github external
it("should navigate back to the image launch view", function(){
              var searchButton = TestUtils.findRenderedDOMComponentWithClass(modalElement, "configure-button");
              TestUtils.Simulate.click(searchButton.getDOMNode());
              var results = TestUtils.scryRenderedComponentsWithType(modalElement, ImageLaunchView);
              expect(results.length).toBe(1);
            })
          })
github systemaccounting / mxfactorial / test / app / components / Transaction / TransactionSection.spec.js View on Github external
it('should render correct with no item', () => {
    instance = renderIntoDocument();
    scryRenderedComponentsWithType(instance, TransactionItem).length.should.equal(0);
    scryRenderedComponentsWithType(instance, TransactionDirection).length.should.equal(1);
    scryRenderedComponentsWithType(instance, AddTransactionBtn).length.should.equal(1);
    scryRenderedComponentsWithType(instance, TransactBtn).length.should.equal(1);
    scryRenderedComponentsWithType(instance, TransactionPopup).length.should.equal(0);
    findRenderedComponentWithType(instance, TransactionDetail).should.be.ok();

    let addTransactionBtn = findRenderedComponentWithType(instance, AddTransactionBtn);
    addTransactionBtn = findRenderedDOMComponentWithClass(addTransactionBtn, 'indicator');
    Simulate.click(addTransactionBtn);
    props.addTransaction.should.be.calledOnce();
  });
github keen / explorer / test / unit / components / explorer / query_builder / funnels / funnel_builder_spec.js View on Github external
it('should render as many FunnelStep child components as there are steps', function () {
    this.component = TestHelpers.renderComponent(FunnelBuilder, getProps({
      steps: [
        TestHelpers.createStep(),
        TestHelpers.createStep(),
        TestHelpers.createStep()
      ]
    }));
    assert.lengthOf(TestUtils.scryRenderedComponentsWithType(this.component, FunnelStep), 3);
  });
github keen / explorer / test / unit / components / common / filter_value_fields_spec.js View on Github external
it('has a Geo component', function(){
        assert.lengthOf(TestUtils.scryRenderedComponentsWithType(this.component, Geo), 1);
      });
github jxnblk / rgx / test / Grid.spec.js View on Github external
window.setTimeout(() => {
          const cells = TestUtils.scryRenderedComponentsWithType(grid, Cell)
          c1 = cells[0]
          c2 = cells[1]
          done()
        }, 100, this)
      })
github nylas-mail-lives / nylas-mail / spec / n1-spec-runner / react-test-utils-extensions.es6 View on Github external
export function scryRenderedComponentsWithTypeAndProps(root, type, props) {
  if (!root) { throw new Error("Must supply a root to scryRenderedComponentsWithTypeAndProps"); }
  return _.compact(_.map(ReactTestUtils.scryRenderedComponentsWithType(root, type), (el) => {
    if (_.isEqual(_.pick(el.props, Object.keys(props)), props)) {
      return el;
    }
    return false;
  }));
}