Rerender with a wrapper
I maintainer di solito rispondono entro 4 giorni
@eps1lon ci sta già lavorando.
Dal 8/10/2022.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
@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.
- Lingua principale
- JavaScript
- Stelle
- 479
- Fork
- 738
- Merge medio
- 5g 1h
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di testing-library/testing-library-docs
-
Broken Chrome Extension Link in Queries DocsForse già presa @rajanpanth l’ha presa 63 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
testing-library/testing-library-docs#1499 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
testing-library/testing-library-docs#1528 ·
I maintainer di solito rispondono entro 4 giorni
-
Framework wrappers and DOM testing libraryForse già presa @jacklaurencegaray l’ha presa 425 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 38/100
testing-library/testing-library-docs#1493 · 3 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
testing-library/testing-library-docs#1486 · 1 reazione ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
testing-library/testing-library-docs#1485 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di testing-library/testing-library-docs
Issue simili
-
documentation v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelcontextprotocol/servers#5170 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SwiftKickMobile/skai#84 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Billionmail/BillionMail#389 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
Uniswap/tokenlists-org#3331 ·
-
beginner-friendly category:finding-titles community enhancement first-timers-only good first issue hacktoberfest help wanted low hanging fruit micro-contribution type: task up-for-grabs
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
Berserk-hub150/skillhawk#227 · 1 commento ·
I maintainer di solito rispondono entro 8 giorni