mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
chore: add new debug parameters on testing library react (#38872)
This commit is contained in:
parent
9ddcefd7ec
commit
cf165bfcf1
3
types/testing-library__react/index.d.ts
vendored
3
types/testing-library__react/index.d.ts
vendored
@ -5,6 +5,7 @@
|
||||
// Sebastian Silbermann <https://github.com/eps1lon>
|
||||
// Weyert de Boer <https://github.com/weyert>
|
||||
// Ifiok Jr. <https://github.com/ifiokjr>
|
||||
// Daniel Afonso <https://github.com/danieljcafonso>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
@ -16,7 +17,7 @@ export * from '@testing-library/dom';
|
||||
export type RenderResult<Q extends Queries = typeof queries> = {
|
||||
container: HTMLElement;
|
||||
baseElement: HTMLElement;
|
||||
debug: (baseElement?: HTMLElement | DocumentFragment) => void;
|
||||
debug: (baseElement?: HTMLElement | DocumentFragment | Array<HTMLElement | DocumentFragment>) => void;
|
||||
rerender: (ui: React.ReactElement) => void;
|
||||
unmount: () => boolean;
|
||||
asFragment: () => DocumentFragment;
|
||||
|
||||
@ -46,3 +46,13 @@ async function testFireEvent() {
|
||||
const { container } = render(<button />);
|
||||
fireEvent.click(container);
|
||||
}
|
||||
|
||||
async function testDebug() {
|
||||
const { debug, getAllByTestId } = render(
|
||||
<>
|
||||
<h2 data-testid="testid">Hello World</h2>
|
||||
<h2 data-testid="testid">Hello World</h2>
|
||||
</>,
|
||||
);
|
||||
debug(getAllByTestId('testid'));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user