How to use the react-component-tree.loadChild function in react-component-tree

To help you get started, we’ve selected a few react-component-tree 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 skidding / react-component-playground / tests / components / component-playground / events.js View on Github external
beforeEach(function() {
    sinon.stub(console, 'error');

    // Don't render any children
    sinon.stub(ComponentTree.loadChild, 'loadChild');

    params = {
      components: {},
      router: {
        routeLink: sinon.spy()
      }
    };
  });
github skidding / react-component-playground / tests / components / component-playground / children.js View on Github external
beforeEach(function() {
    // Don't render any children
    sinon.stub(ComponentTree.loadChild, 'loadChild');

    params = {
      components: {
        FirstComponent: {
          class: 'FirstComponent',
          fixtures: {
            'default state': {}
          }
        }
      },
      router: {
        routeLink: sinon.spy()
      }
    };
  });
github skidding / react-component-playground / tests / components / component-playground / render.js View on Github external
beforeEach(function() {
    // Don't render any children
    sinon.stub(ComponentTree.loadChild, 'loadChild');

    params = {
      components: {
        FirstComponent: {
          fixtures: {
            'blank state': {},
            'error state': {},
            'simple state': {}
          }
        },
        SecondComponent: {
          fixtures: {
            'simple state': {}
          }
        }
      },
github skidding / react-component-playground / tests / components / component-playground / default / render / children.js View on Github external
describe(`ComponentPlayground (${FIXTURE}) Render Children`, function() {
  var loadChild = require('react-component-tree').loadChild,
      render = require('tests/lib/render-component.js'),
      spyLoadChild = require('tests/setup/spy-load-child.js'),
      fixture = require(`fixtures/component-playground/${FIXTURE}.js`);

  var component,
      $component,
      container,
      fixture;

  spyLoadChild();

  beforeEach(function() {
    ({container, component, $component} = render(fixture));
  });

  it('should not load preview component', function() {
github skidding / react-component-playground / tests / components / component-playground / children.js View on Github external
it('should render child with selected fixture', function() {
      render({
        component: 'FirstComponent',
        fixture: 'default state'
      });

      expect(ComponentTree.loadChild.loadChild).to.have.been.called;
    });
github skidding / react-component-playground / tests / components / component-playground / events.js View on Github external
afterEach(function() {
    console.error.restore();

    ComponentTree.loadChild.loadChild.restore();
  })
github skidding / react-component-playground / tests / setup / spy-load-child.js View on Github external
afterEach(function() {
    ComponentTree.loadChild.loadChild.restore();
  });
};
github skidding / react-component-playground / tests / components / component-playground / selected-fixture / render / children.js View on Github external
describe(`ComponentPlayground (${FIXTURE}) Render Children`, function() {
  var loadChild = require('react-component-tree').loadChild,
      render = require('tests/lib/render-component.js'),
      spyLoadChild = require('tests/setup/spy-load-child.js'),
      fixture = require(`fixtures/component-playground/${FIXTURE}.js`);

  var component,
      $component,
      container,
      fixture,
      childParams;

  spyLoadChild();

  beforeEach(function() {
    ({container, component, $component} = render(fixture));

    childParams = component.children.preview.call(component);
github skidding / react-component-playground / tests / setup / spy-load-child.js View on Github external
beforeEach(function() {
    sinon.spy(ComponentTree.loadChild, 'loadChild');
  });

react-component-tree

Serialize and reproduce the state of an entire tree of React components

MIT
Latest version published 7 years ago

Package Health Score

70 / 100
Full package analysis

Similar packages