How to use the react-addons-test-utils.findRenderedComponentWithType 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 hoppula / refire / test / components / connect.spec.js View on Github external
storeGetter: { storeKey: 'foo' }
        }

        render() {
          return 
        }
      }

      const tree = TestUtils.renderIntoDocument(
        
          
        
      )

      const target = TestUtils.findRenderedComponentWithType(tree, Passthrough)
      const wrapper = TestUtils.findRenderedComponentWithType(tree, StatefulWrapper)

      expect(mapStateSpy.calls.length).toBe(2)
      expect(mapDispatchSpy.calls.length).toBe(2)
      expect(target.props.statefulValue).toEqual('foo')

      // Impure update
      const storeGetter = wrapper.state.storeGetter
      storeGetter.storeKey = 'bar'
      wrapper.setState({ storeGetter })

      expect(mapStateSpy.calls.length).toBe(3)
      expect(mapDispatchSpy.calls.length).toBe(3)
      expect(target.props.statefulValue).toEqual('bar')
    })
github adazzle / react-data-grid / packages / react-data-grid-addons / src / __tests__ / RowsContainerWithAddons.spec.js View on Github external
it('should render the context menu', () => {
      let contextMenu = ReactTestUtils.findRenderedComponentWithType(componentWithContextMenu, ContextMenu);
      expect(contextMenu).toBeDefined();
    });
github boxart / boxart / tests / linear-css-stage.js View on Github external
it('renders first child passed', function() {
    const scene = renderIntoDocument(
      
    );
    const child = findRenderedComponentWithType(scene, Child);
    expect(child).to.be.ok;
  });
github mattzeunert / javascript-breakpoint-collection / tests / app-spec.js View on Github external
it("Shows a list of predefined breakpoints", function(){
        var availableBreakpointsListComponent =  TestUtils.findRenderedComponentWithType(
            component,
            AvailableBreakpointsList
        );
        var listNode = ReactDOM.findDOMNode(availableBreakpointsListComponent);
        expect(listNode.children.length).toBe(predefinedBreakpoints.length)
    })
github subschema / subschema / test / support / index.js View on Github external
function byType(node, type) {
    return TestUtils.findRenderedComponentWithType(node, type);
}
function click(node) {
github hoppula / refire / test / components / connect.spec.js View on Github external
constructor(props) {
          super(props)
          this.state = { pass: '' }
        }

        render() {
          return (
            
              
            
          )
        }
      }

      const tree = TestUtils.renderIntoDocument()
      const stub = TestUtils.findRenderedComponentWithType(tree, Passthrough)
      expect(spy.calls.length).toBe(1)
      expect(stub.props.string).toBe('')
      expect(stub.props.pass).toBe('')

      store.dispatch({ type: 'APPEND', body: 'a' })
      expect(spy.calls.length).toBe(2)
      expect(stub.props.string).toBe('a')
      expect(stub.props.pass).toBe('')

      tree.setState({ pass: '' })
      expect(spy.calls.length).toBe(2)
      expect(stub.props.string).toBe('a')
      expect(stub.props.pass).toBe('')

      tree.setState({ pass: 'through' })
      expect(spy.calls.length).toBe(3)
github nsmith7989 / redux-filter / test / Filter.spec.js View on Github external
const makeChild = () => {
        const tree = TestUtils.renderIntoDocument(
          
        );
        return TestUtils.findRenderedComponentWithType(tree, Child);
    };
github react-melon / melon / test / components / Calendar.spec.js View on Github external
beforeEach(() => {

            component = TestUtils.renderIntoDocument(
                
            );

            calendar = TestUtils.findRenderedComponentWithType(component, Calendar);

        });
github danielfarrell / redux-channels / test / components / connect.spec.js View on Github external
mapStateToProps: state => state,
        mapDispatchToProps: dispatch => ({ dispatch })
      })(Container);

      const container = TestUtils.renderIntoDocument(
        
          
        
      );
      const stub = TestUtils.findRenderedComponentWithType(container, Passthrough);
      expect(stub.props.dispatch).toEqual(store.dispatch);
      expect(stub.props.foo).toEqual('bar');
      expect(() =>
        TestUtils.findRenderedComponentWithType(container, Container)
      ).toNotThrow();
      const decorated = TestUtils.findRenderedComponentWithType(container, Container);
      expect(decorated.isSubscribed()).toBe(true);
    });
github galkinrost / react-ingrid / test / Display.spec.js View on Github external
return (
                        
                    )
                }
            }

            const restoreDisplay = setDisplayClientBoundingRect({
                width: 400,
                height: 400
            })

            const tree = TestUtils.renderIntoDocument(
                
            )

            const display = TestUtils.findRenderedComponentWithType(tree, Display)

            const expectedHeight = 400

            expect(display.state.height)
                .toEqual(expectedHeight)

            restoreDisplay()
        })