How to use the react-dom/test-utils.renderIntoDocument 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 mlaursen / react-md / src / js / TextFields / __tests__ / Message.js View on Github external
it('sets the aria-hidden prop based on the active prop', () => {
    const props = { active: false, children: 'woop' };
    let message = renderIntoDocument();
    let messageNode = findDOMNode(message);
    expect(messageNode.getAttribute('aria-hidden')).toBe('true');

    props.active = true;
    message = renderIntoDocument();
    messageNode = findDOMNode(message);
    expect(messageNode.getAttribute('aria-hidden')).toBe('false');
  });
github department-of-veterans-affairs / vets-website / test / edu-benefits / pages / contactInformation.unit.spec.jsx View on Github external
it('should render validation errors for required fields', () => {
    const form = ReactTestUtils.renderIntoDocument(
      
    );

    const formDOM = findDOMNode(form);
    submitForm(form);

    expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(6);
  });
  it('should conditionally require phone number', () => {
github PaulLeCam / react-leaflet / __tests__ / Map.js View on Github external
it('sets center and zoom props', () => {
    const center = [1.2, 3.4]
    const zoom = 10

    const map = renderIntoDocument(<map>)
    const mapLeaflet = map.leafletElement

    expect(mapLeaflet.getCenter().lat).toBe(center[0])
    expect(mapLeaflet.getCenter().lng).toBe(center[1])
    expect(mapLeaflet.getZoom()).toBe(zoom)
  })
</map>
github rsuite / rsuite / test / UploadFileItemSpec.js View on Github external
it('Should call onPreview callback', done =&gt; {
    const doneOp = () =&gt; {
      done();
    };
    const instance = ReactTestUtils.renderIntoDocument(
      
    );
    ReactTestUtils.Simulate.click(
      findDOMNode(instance).querySelector('.rs-uploader-file-item-title')
    );
  });
github ziad-saab / react-checkbox-group / test / react-checkbox-group_spec.js View on Github external
it('Renders correctly when `Checkbox` is not a direct child of `CheckboxGroup` and `checkboxDepth` is passed', function() {
    const component = renderIntoDocument(
      
        <label> Kiwi</label>
        <label> Watermelon</label>
      
    );

    expect(component).to.be.ok;
  });
github rsuite / rsuite / test / MultiCascader / DropdownSpec.js View on Github external
it('Should be active by value', () =&gt; {
    const value = ['abcd'];
    const instance = ReactTestUtils.renderIntoDocument(
      
    );
    const instanceDom = findDOMNode(instance.menuContainer);
    assert.equal(instanceDom.querySelector(activeClassName).innerText, value);
  });
github Fauntleroy / GIFit / test / components / gifit-button.jsx View on Github external
test( 'GifitButton emits "toggle" event when clicked', function( t ){
	t.plan(1);
	var gifit_button = TestUtils.renderIntoDocument(  );
	var gifit_button_div_element = TestUtils.findRenderedDOMComponentWithClass( gifit_button, 'gifit-button' );
	gifit_events.once( 'toggle', function(){
		t.pass('emits "toggle" event');
	});
	TestUtils.Simulate.click( gifit_button_div_element );
});
github jedireza / aqua / test / client / pages / admin / components / note-form.js View on Github external
lab.test('it renders showing save success alert', (done) => {

        const props = Object.assign({}, defaultProps, {
            showSaveSuccess: true
        });
        const FormEl = React.createElement(Form, props);
        const form = ReactTestUtils.renderIntoDocument(FormEl);
        const alerts = ReactTestUtils.scryRenderedDOMComponentsWithClass(form, 'alert-success');

        Code.expect(alerts).to.have.length(1);

        done();
    });
github youzan / zent / packages / zent / __tests__ / switch.js View on Github external
function mount(Component) {
    testSwitch = TestUtils.renderIntoDocument(Component);
    switchNode = ReactDOM.findDOMNode(testSwitch);
  }
github mzabriskie / react-draggable / specs / draggable.spec.jsx View on Github external
function renderToNode(component) {
  return ReactDOM.findDOMNode(TestUtils.renderIntoDocument(component));
}