How to use the react-addons-test-utils.scryRenderedDOMComponentsWithClass 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 isnifer / react-calendar / test / datepicker.js View on Github external
)

  let currentDay = TestUtils.scryRenderedDOMComponentsWithClass(c, 'calendar__day_current')[0]
  // TEMP HACK
  currentDay = currentDay[Object.keys(currentDay)[0]]._currentElement

  const prevMonthButtonInstance = TestUtils.scryRenderedDOMComponentsWithClass(
    c,
    'calendar__arrow_left'
  )[0]
  // TEMP HACK
  const prevMonthButton =
    prevMonthButtonInstance[Object.keys(prevMonthButtonInstance)[0]]._currentElement

  const nextMonthButtonInstance = TestUtils.scryRenderedDOMComponentsWithClass(
    c,
    'calendar__arrow_right'
  )[0]
  // TEMP HACK
  const nextMonthButton =
    nextMonthButtonInstance[Object.keys(nextMonthButtonInstance)[0]]._currentElement

  assert.equal(currentDay.props.children, 1, 'Should be first of september')
  assert.equal(prevMonthButton.props.children, '←', 'Should be left change month button')
  assert.equal(nextMonthButton.props.children, '→', 'Should be right change month button')

  assert.equal(c.state.month, currentMonth, 'Should be September')

  TestUtils.Simulate.click(prevMonthButtonInstance)
  assert.equal(c.state.month, currentMonth - 1, 'Should be August')
github cyverse / troposphere / test / components / images / list / imageListView.spec.js View on Github external
it("should have a button to change the view type", function(){
            var elements = TestUtils.scryRenderedDOMComponentsWithClass(imageViewElement, "btn-group");
            expect(elements.length).toBe(1);
          });
github jfcaiceo / react-lightbox-component / test / lightboxSpec.js View on Github external
it("renders and shows image thumbnails", function() {
    var images = TestUtils.scryRenderedDOMComponentsWithClass(lightbox, 'lightbox-img-thumbnail');
    expect(images.length).toEqual(imagesData.length);
    expect(TestUtils.isDOMComponent(images[0]));
  });
github jfcaiceo / react-lightbox-component / test / containerSpec.js View on Github external
it("close container on close button click", function() {
    var imagesData = Utils.generateImageArray();
    var lightbox = TestUtils.renderIntoDocument(
      
    );

    var image = TestUtils.scryRenderedDOMComponentsWithClass(lightbox, 'lightbox-img-thumbnail')[0];
    TestUtils.Simulate.click(image)
    
    var closeButtonContainer = TestUtils.findRenderedDOMComponentWithClass(lightbox, 'lightbox-btn-close');
    var closeButton = closeButtonContainer.children[0];
    TestUtils.Simulate.click(closeButton);

    var container = TestUtils.scryRenderedDOMComponentsWithClass(lightbox, 'lightbox-backdrop')
    expect(container.length).toEqual(0);
  });
});
github erizocosmico / react-categorized-tag-input / test / Panel_spec.js View on Github external
it('should select the corresponding item', () => {
    let p = panel(props());
    let selected = TestUtils.scryRenderedDOMComponentsWithClass(p, 'cti-selected');
    expect(selected.length).toBe(1);
    expect(selected[0].textContent).toBe('Create new reversed thing "ra"');
  });
});
github moroshko / react-autosuggest / test / Autosuggest.js View on Github external
it('should use the specified suggestionRenderer function', () => {
        suggestions = TestUtils.scryRenderedDOMComponentsWithClass(autosuggest, 'react-autosuggest__suggestion');
        expect(stripReactAttributes(suggestions[0].innerHTML)).to.equal('<span><strong>M</strong><span>ill Park</span></span>');
      });
    });
github erfangc / GigaGrid / test / components / FrozenTableBody.spec.tsx View on Github external
it('consists of many rows', ()=&gt; {
        const data = TestUtils.newPeopleTestData();
        let component;
        ReactTestUtils.renderIntoDocument(
            <div>
                component=c} dispatcher={null}
                                     rows={data.detailRows()}
                                     columns={data.columns()}
                                     gridProps={data.gridProps()}/&gt;
            </div>);
        const trs = ReactTestUtils.scryRenderedDOMComponentsWithClass(component, 'row');
        expect(trs.length).toBe(10);
    });
github erizocosmico / react-categorized-tag-input / test / Input_spec.js View on Github external
function findTags(i) {
  return TestUtils.scryRenderedDOMComponentsWithClass(i, 'cti__tag');
}
github department-of-veterans-affairs / vets-website / test / hca / components / Nav.unit.spec.jsx View on Github external
const expectActiveSectionForNavAndSubNav = (component, path) => {
      history.replace(path);
      const activeSubSection = ReactTestUtils.scryRenderedDOMComponentsWithClass(component, 'sub-section-current');
      expect(activeSubSection).to.have.lengthOf(1);
    };
github nylas-mail-lives / nylas-mail / spec / components / editable-list-spec.jsx View on Github external
it('enters editing mode when edit icon clicked', () => {
      const list = makeList(['1', '2']);
      spyOn(list, 'setState');
      const editIcon = scryRenderedDOMComponentsWithClass(list, 'edit-icon')[0];

      Simulate.click(editIcon);

      expect(list.setState).toHaveBeenCalledWith({editingIndex: 0});
    });
  });