Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update package.json to allow newer versions deps #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tapetersen
Copy link
Contributor

Update to allow newer version of react-redux and react-form since from what I can see it's compatible (have run the test suite) and keeping the versions low creates problems, in particular where react-redux < 6 can't really coexist with versions > 6.

Tobias Alex-Petersen added 2 commits June 5, 2019 14:10
@tapetersen
Copy link
Contributor Author

Ok the test fails and updating the jest environment fixes most of them but the last context based one I can't really get rid of. For what it's worth liform-react is compatible enough for our projects needs but I can understand you don't want to merge it completely without getting those tests to pass as well.

FAIL  src/__tests__/createLiformSpec.spec.js
  createLiform
    ✓ should render a form (49ms)
    ✕ can pass a context (11ms)
  ● createLiform › can pass a context
    TypeError: Cannot read property 'fun' of undefined
      
      at CustomString (src/__tests__/createLiformSpec.spec.js:46:27)
      at processChild (node_modules/react-dom/cjs/react-dom-server.node.development.js:2888:14)
      at resolve (node_modules/react-dom/cjs/react-dom-server.node.development.js:2812:5)
      at ReactDOMServerRenderer.render (node_modules/react-dom/cjs/react-dom-server.node.development.js:3202:22)
      at ReactDOMServerRenderer.read (node_modules/react-dom/cjs/react-dom-server.node.development.js:3161:29)
      at Object.renderToStaticMarkup (node_modules/react-dom/cjs/react-dom-server.node.development.js:3661:27)
      at Object.render (node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:902:42)
      at render (node_modules/enzyme/build/render.js:41:23)
      at Object.<anonymous> (src/__tests__/createLiformSpec.spec.js:68:38)

Having tried debugging it a bit it looks like props are completetly undefined for both the intial Liform Component in the test below and for CustomString in turn. I'm not sure if this is because of discrepancies with enzyme vs a real browser or a real incompatibility with newer react versions.

  it("can pass a context", () => {
    const CustomString = field => {
      const { fun } = field.context;
      fun();
      return <input {...field.input} className="form-control" type="email" />;
    };
    const CustomWidget = props => {
      return (
        <Field
          component={CustomString}
          name={props.fieldName}
          context={props.context}
        />
      );
    };
    const myTheme = { ...DefaultTheme, string: CustomWidget };

    const fun = jest.fn();

    const Component = (
      <FormFrame>
        <Liform schema={schema} context={{ fun }} theme={myTheme} />
      </FormFrame>
    );
    const wrapper = render(Component);
    expect(fun).toHaveBeenCalled();
    expect(wrapper.find("input").length).toEqual(1);
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant