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

Fix componentWillReceiveProps warning on tests #91

Closed
wants to merge 3 commits into from

Conversation

Gu7z
Copy link

@Gu7z Gu7z commented Feb 14, 2022

What this PR does?

Use @korbav/react-motion instead of react-motion

Why?

The react-motion library seems to not have support anymore, this causes a warning described in this issue #79

This warning shows when you use the React.StrictMode
In order to test if the warning was solved, I created a test with testing library using the AutoPlay component
The code is in the end of this PR

How?

Following this issue chenglou/react-motion#604, @serprex cited how to fix the warning with a react-17 compatible version of the motion library created by @korbav

This PR replace the react-motion with the fix that korbav made!

How I tested if the warning was gone

  1. Using strict mode in src/ItemsCarousel/ItemsCarouselBase.js line 187
  2. Configuring babel with this presset
    babel.config.js
module.exports = {
  presets: ["@babel/preset-env", "@babel/preset-react"],
  plugins: ["@babel/plugin-proposal-class-properties"]
};
  1. Using this test
import React from "react";
import { render } from "@testing-library/react";
import AutoPlayCarousel from "./gh/components/AutoPlayCarousel";

describe("testing Header component", () => {
  test("should snapshot works with english language", () => {
    const { container } = render(<AutoPlayCarousel />, {
      initialState: null
    });

    expect(container).toMatchSnapshot();
  });
});

@stale
Copy link

stale bot commented Apr 25, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 25, 2022
@Gu7z
Copy link
Author

Gu7z commented Apr 25, 2022

@kareemaly 🆙

@stale stale bot removed the wontfix label Apr 25, 2022
@kareemaly
Copy link
Owner

Hi @Gu7z , thanks for opening a PR on this repo

I don't think it's a good idea to use a forked version of react-motion even if the project is not active. if you still need this, please consider forking this repo and add your changes there. Thank you!

@kareemaly kareemaly closed this Apr 26, 2022
Copy link

@Supsource Supsource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/

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.

None yet

3 participants