How to use the react-dom/test-utils.findRenderedDOMComponentWithTag 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 jedireza / aqua / test / client / pages / admin / admins / search / create-new-form.js View on Github external
lab.test('it handles a submit event', (done) => {

        stub.Actions.createNew = function () {

            done();
        };

        const FormEl = React.createElement(Form, defaultProps);
        const form = ReactTestUtils.renderIntoDocument(FormEl);
        const formTag = ReactTestUtils.findRenderedDOMComponentWithTag(form, 'form');

        ReactTestUtils.Simulate.submit(formTag);
    });
github georgeOsdDev / react-draggable-tab / test / components / CloseIcon_spec.js View on Github external
it('should update style and className on mouseLeave', function () {
      const span = ReactTestUtils.findRenderedDOMComponentWithTag(component, 'span');
      ReactTestUtils.Simulate.mouseLeave(span);
      expect(ReactDom.findDOMNode(span).classList.contains('hover')).to.be.equal(false);
      expect(ReactDom.findDOMNode(span).style.color).to.be.equal('red');
    });
  });
github react-bootstrap / react-bootstrap / test / MediaListItemSpec.js View on Github external
it('should render children', () => {
    const instance = ReactTestUtils.renderIntoDocument(
      
        <strong>Content</strong>
      
    );
    assert.ok(
      ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'strong')
    );
  });
});
github jedireza / aqua / test / client / pages / main / contact / form.js View on Github external
lab.test('it renders with loading state', (done) => {

        const FormEl = React.createElement(Form, {});
        const form = ReactTestUtils.renderIntoDocument(FormEl);

        Store.dispatch({
            type: Constants.SEND_MESSAGE
        });

        const button = ReactTestUtils.findRenderedDOMComponentWithTag(form, 'button');

        Code.expect(button.disabled).to.be.true();

        done();
    });
github davidkpiano / react-redux-form / test / model-resolving-spec.js View on Github external
[Form, Fieldset].forEach((Container) =&gt; {
        const TestControl = Control[controlType];

        const app = testRender(
          
            
          , store);

        const input = TestUtils.findRenderedDOMComponentWithTag(app,
          controlType === 'textarea' ? 'textarea' : 'input');

        it(`(${controlType}) should resolve a partial model ${label}`, () =&gt; {
          assert.equal(input.value, expected);
        });
      });
    });
github react-bootstrap / react-bootstrap / test / DropdownButtonSpec.js View on Github external
it('renders dropdown toggle button', () => {
    const instance = ReactTestUtils.renderIntoDocument(simpleDropdown);

    const buttonNode = ReactTestUtils.findRenderedDOMComponentWithTag(
      instance,
      'BUTTON'
    );

    buttonNode.tagName.should.equal('BUTTON');
    buttonNode.className.should.match(/\bbtn[ $]/);
    buttonNode.className.should.match(/\bbtn-default\b/);
    buttonNode.className.should.match(/\bdropdown-toggle\b/);
    buttonNode.getAttribute('type').should.equal('button');
    buttonNode.getAttribute('aria-expanded').should.equal('false');
    buttonNode.getAttribute('id').should.be.ok;
  });
github jedireza / aqua / test / client / pages / admin / components / note-form.js View on Github external
lab.test('it handles a submit event', (done) => {

        const props = Object.assign({}, defaultProps, {
            saveAction: function () {

                done();
            }
        });
        const FormEl = React.createElement(Form, props);
        const form = ReactTestUtils.renderIntoDocument(FormEl);
        const formTag = ReactTestUtils.findRenderedDOMComponentWithTag(form, 'form');

        ReactTestUtils.Simulate.submit(formTag);
    });
github davidkpiano / react-redux-form / test / errors-component-spec.js View on Github external
it('should support a boolean and show if truthy', () => {
        const form = renderErrorsWithShow(true);
        const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input');

        assert.lengthOf(TestUtils.scryRenderedDOMComponentsWithTag(form, 'span'), 1);
      });
github openfresh / super-image / test / index.js View on Github external
it('should have an empty `aria-label` when the `alt` attribute does not exist', () =&gt; {
    const superImage = TestUtils.renderIntoDocument();
    const node = TestUtils.findRenderedDOMComponentWithTag(superImage, 'div');

    assert(node.hasAttribute('aria-label'));
  });
github davidkpiano / react-redux-form / test / control-component-spec.js View on Github external
test: modelReducer('test', initialState),
        });

        const field = TestUtils.renderIntoDocument(
          
             val.length &gt; 8 &amp;&amp; 'too long',
                valid: (val) =&gt; val !== 'valid' &amp;&amp; 'not valid',
              }}
            /&gt;
          
        );

        const control = TestUtils.findRenderedDOMComponentWithTag(field, 'input');

        control.value = 'valid';

        TestUtils.Simulate.change(control);

        assert.deepEqual(
          store.getState().testForm.foo.errors,
          {
            length: false,
            valid: false,
          });

        control.value = 'invalid string';

        TestUtils.Simulate.change(control);