How to use the react-dom/test-utils.scryRenderedDOMComponentsWithTag function in react-dom

To help you get started, we’ve selected a few react-dom 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 yang-wei / rd3 / tests / legendchart-tests.js View on Github external
var legend = TestUtils.renderIntoDocument(
       
    );

    var legendWithTitle = TestUtils.renderIntoDocument(
       
    );

    // Verify there is no heading element
    var noTitleHeadings = TestUtils.scryRenderedDOMComponentsWithTag(
      legend, 'h4');
    expect(noTitleHeadings).to.have.length(0);

    // Verify there is a heading element
    var titleHeadings = TestUtils.scryRenderedDOMComponentsWithTag(
      legendWithTitle, 'h4');
    expect(titleHeadings).to.have.length(1);
  });
});
github react-component / tween-one / tests / tweenOneGroup.spec.jsx View on Github external
it('should render children', () => {
    instance = createTweenGroupInstance();
    children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'p');
    expect(children.length).to.be(1);
  });
github artsy / reaction / src / Apps / Loyalty / Containers / Inquiries / __tests__ / index.tsx View on Github external
it("renders the artist information", () => {
    const inquiries = TestUtils.renderIntoDocument() as Inquiries
    const aTags = TestUtils.scryRenderedDOMComponentsWithTag(inquiries, "a") as HTMLAnchorElement[]
    const artistLink = aTags.find(tag => tag.href === "/percy-z" && tag.textContent === "Percy Z")
    expect(artistLink).toBeTruthy()
    const noConvoLink = aTags.find(tag => tag.href === "/percy-z-without-conversation")
    expect(noConvoLink).toBeUndefined()
  })
github react-component / scroll-anim / tests / parallax.spec.js View on Github external
ticker.timeout(() => {
        let child = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'i');
        console.log('child opacity:', getFloat(child[0].style.opacity));
        expect(getFloat(child[0].style.opacity)).to.above(0.99);
        cDom.scrollTop = 0;
        console.log('scrollTop:', cDom.scrollTop);
        ticker.timeout(() => {
          child = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'i');
          console.log('always = false, child opacity:', child[0].style.opacity);
          expect(getFloat(child[0].style.opacity)).to.be(1);
          done();
        }, 350);
      }, 350);
    }, 35);
github mikechabot / react-boilerplate / test / unit / component / common / test-error.js View on Github external
it('should display the message prop', () => {
      const props = {message: 'Test Message', id: 'foo-id'};
      const component = renderStatelessComponent(Error, props);
      const spans = TestUtils.scryRenderedDOMComponentsWithTag(component, 'span');
      const element = findElementById(spans, props.id);

      expect(element.id).to.equal(props.id);
      expect(element.textContent).to.equal(props.message);
    });
    it('should display a generic message if none is passed', () => {
github jedireza / aqua / test / client / pages / admin / admins / search / index.js View on Github external
defaultProps.ref.impl = function (page) {

            defaultProps.ref.impl = undefined;

            const selects = ReactTestUtils.scryRenderedDOMComponentsWithTag(page.els.filters, 'select');
            const limitField = selects.filter((select) => {

                return select.name === 'limit';
            })[0];

            ReactTestUtils.Simulate.change(limitField, {
                target: {
                    name: 'limit',
                    value: '10'
                }
            });
        };
github olahol / react-tagsinput / test / index.js View on Github external
function allTag(comp, tagName) {
  return TestUtils.scryRenderedDOMComponentsWithTag(comp, tagName);
}
github Sage / carbon / src / __deprecated__ / components / decimal / __spec__.js View on Github external
it('renders a visible field', () => {
        let input = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'input')[0];
        expect(input.type).toEqual('text');
      });
github Sage / carbon / src / components / radio-button / __spec__.js View on Github external
it('renders a parent div with a pod CSS class', () => {
      let radioButtonNode = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div')[0];
      expect(radioButtonNode.classList[0]).toEqual('carbon-radio-button');
    });
github Sage / carbon / src / components / table / __spec__.js View on Github external
it('returns the the correct markup', () => {
        let header = (
          
            
              foo
            
          
        );
        instance = TestUtils.renderIntoDocument(
          <table path="/test">
          </table>
        );
        let parent = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'thead')[0];
        expect(parent).toBeDefined();
        expect(instance.thead).toEqual(
          
            {header}
          
        )
      });
    });