How to use the react-addons-test-utils.isElement 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 rogeriochaves / react-decompiler / src / stringify-object.js View on Github external
return (function stringify(val, opts, pad) {
    opts = opts || {};
    opts.indent = opts.indent || '\t';
    pad = pad || '';

    /* monkey-patch do */
    if (isReact(val)) {
      return decompile(val);
    }
    /* end */

    if (val === null ||
      val === undefined ||
      typeof val === 'number' ||
      typeof val === 'boolean' ||
      typeof val === 'function' ||
      isRegexp(val)) {
      return String(val);
    }

    if (val instanceof Date) {
      return 'new Date(\'' + val.toISOString() + '\')';
    }
github NuCivic / react-dash / tests / dashboard_spec.js View on Github external
it('Component should render as React DOM node', () => {
    expect(TestUtils.isElement()).toBeTruthy();
  });
});
github mikaelbr / fp-react / lib / __tests__ / curryRight.js View on Github external
test('should be able to defined arity and initial props', function (t) {
  function MyComponent (props) {
    return <div>{props.foo}{props.bar}{props.baz}{props.a}</div>;
  }
  const Curried = curryRight(MyComponent, 2, { a: 1 });
  const Curried2 = Curried({ bar: 'bar' });
  const Curried3 = Curried2({ baz: 'baz' });

  const actual = React.createElement(Curried3, { foo: 'foo' });
  t.true(isElement(actual));

  const expected = React.createElement(MyComponent, {
    a: 1,
    foo: 'foo',
    bar: 'bar',
    baz: 'baz'
  });
  isEqual(t, actual, expected);
});
github madeinfree / react-facebook-login-hoc / test / react-facebook-login-hoc-spec.js View on Github external
it('is React Element', () =&gt; {
      expect(TestUtils.isElement()).toEqual(true)
    })
github gpbl / react-day-picker / test / DayPicker.js View on Github external
it('should render a custom weekday element', () =&gt; {
      const CustomWeekday = ({ className, weekday }) =&gt;
        <div>{weekday}</div>;
      CustomWeekday.propTypes = { className: PropTypes.string, weekday: PropTypes.number };
      const weekday = ;
      const dayPicker = ;
      const wrapper = mount(dayPicker);

      expect(isElement(dayPicker.props.weekdayElement)).to.be.true;
      expect(wrapper.containsMatchingElement(weekday)).to.be.true;
      expect(wrapper.find('.DayPicker-Weekday')).to.have.length(7);
      const weekdayDoms = wrapper.find('.DayPicker-Weekday');
      weekdayDoms.forEach((_, i) =&gt; {
        expect(weekdayDoms.at(i)).to.have.text(i);
      });
    });
    it('should not render the outside days', () =&gt; {
github mikaelbr / fp-react / lib / __tests__ / curry.js View on Github external
bar: React.PropTypes.string.isRequired,
      baz: React.PropTypes.string
    },
    render () {
      const props = this.props;
      return <div>{props.foo}{props.bar}{props.baz}</div>;
    }
  });

  const Curried = curry(MyComponent);
  const Partial1 = Curried({ foo: 'foo' });
  const Partial2 = Partial1({ baz: 'baz' });
  const Partial3 = Partial2({ bar: 'bar' });

  const actual = React.createElement(Partial3, { foo: 'override' });
  t.true(isElement(actual));

  const expected = React.createElement(MyComponent, {
    foo: 'override',
    bar: 'bar',
    baz: 'baz'
  });
  isEqual(t, actual, expected);
});
github scup / atellier / spec / FieldType.spec.jsx View on Github external
xit('should render array input', () => {

    let FieldType = renderFieldType({
      name: 'array',
      type: 'array'
    });

    let div = TestUtils.findRenderedDOMComponentWithClass(
      FieldType, 'properties-field'
    );

    expect(TestUtils.isElement(FieldType)).toBeFalsy();
  });
github rogeriochaves / jasmine-react-diff / src / jasmine_react_diff.js View on Github external
const formatReactComponents = (defaultFormatter, jumpingLine, seen, deepness) => (value) => {
  if (seen.indexOf(value) > -1) {
    return '[Circular]';
  }

  if (Array.isArray(value) && value.some(isReact)) {
    return formatReactArray(defaultFormatter, seen.concat([value]), deepness)(value);
  }

  if (typeof value === 'object' && !Array.isArray(value) && value !== null && hasAnyReactValues(value)) {
    return formatReactObject(defaultFormatter, seen.concat([value]), deepness)(value);
  }

  if (isReact(value)) {
    return formatReactValue(value, jumpingLine);
  }

  return defaultFormatter(value);
}
github rogeriochaves / jasmine-react-diff / src / jasmine_react_diff.js View on Github external
const hasAnyReactValues = (object) => {
  for (let key in object) {
    if (isReact(object[key])) return true;
  }
  return false;
}