Rerender with a wrapper
Los mantenedores suelen responder en 4 días
@eps1lon ya está trabajando en esto.
Desde el 8/10/2022.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
@testing-library/reactversion: 13.4.0- Testing Framework and version: jest @ 29.0.3
- DOM Environment: jsdom @ 20.0.0
Relevant code or config:
// in test utils
const customRender = (
ui: ReactElement,
apolloMocks?: ApolloMocks,
options?: Omit<RenderOptions, 'wrapper'>
) =>
render(ui, {
wrapper: () => ui, // this would include our providers wrapped around ui but this demonstrates the issue in a cleaner way
...options,
});
// in test file
const Comp = ({ number }: { number: number }) => <p>{number}</p>;
it('check render', () => {
const { rerender } = customRender(<Comp number={1} />);
rerender(<Comp number={2} />);
expect(screen.getByText('2')).toBeInTheDocument();
});
What you did:
Rerendering a component that was originally rendered out with the wrapper option, combining two different guides in the docs.
What happened:
No props are updated. The component does rerender, however it does so with the "old" props. (So in the example above, the test fails because 1 is present instead of 2.)
Reproduction:
Happy to add this if necessary.
Problem description:
We can't actually re-render stuff :) The workaround we're using is to put the wrapper directly into the test but that sort of defeats having any wrapper to begin with.
Suggested solution:
Not sure how the internals work and why the wrapper would interfere with the props. I imagine we'd need to see why the props aren't being passed correctly and fix it on that level.
- Lenguaje dominante
- JavaScript
- Estrellas
- 479
- Forks
- 738
- Merge medio
- 5 d 1 h
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de testing-library/testing-library-docs
-
Broken Chrome Extension Link in Queries DocsPosiblemente ocupada @rajanpanth la tomó hace 62 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
testing-library/testing-library-docs#1499 ·
Los mantenedores suelen responder en 4 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
testing-library/testing-library-docs#1528 ·
Los mantenedores suelen responder en 4 días
-
Framework wrappers and DOM testing libraryPosiblemente ocupada @jacklaurencegaray la tomó hace 424 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 38/100
testing-library/testing-library-docs#1493 · 3 comentarios ·
Los mantenedores suelen responder en 4 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 55/100
testing-library/testing-library-docs#1486 · 1 reacción ·
Los mantenedores suelen responder en 4 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 48/100
testing-library/testing-library-docs#1485 · 1 comentario ·
Los mantenedores suelen responder en 4 días
Todos los issues de testing-library/testing-library-docs
Issues similares
-
bug/1-unconfirmed kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
521xueweihan/HelloGitHub#4010 · 2 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
BUG
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
[BUG]: filesystem-edit-file converts a CRLF file's line endings to LF on every editPosiblemente ocupada @MohammadHijjawi97 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Mintplex-Labs/anything-llm#6755 ·
Los mantenedores suelen responder en 1 día