New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dom-testing-library

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-testing-library - npm Package Compare versions

Comparing version 3.18.1 to 3.18.2

106

dist/__tests__/element-queries.js

@@ -38,11 +38,65 @@ "use strict";

} = (0, _testUtils.render)('<div />');
expect(() => getByLabelText('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getBySelectText('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByPlaceholderText('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByText('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByTestId('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByAltText('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByTitle('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByValue('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByRole('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByLabelText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find a label with the text of: LucyRicardo
<div>
<div />
</div>"
`);
expect(() => getBySelectText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find a <select> element with the selected option's text: LucyRicardo
<div>
<div />
</div>"
`);
expect(() => getByPlaceholderText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the placeholder text of: LucyRicardo
<div>
<div />
</div>"
`);
expect(() => getByText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the text: LucyRicardo. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
<div>
<div />
</div>"
`);
expect(() => getByTestId('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element by: [data-testid=\\"LucyRicardo\\"]
<div>
<div />
</div>"
`);
expect(() => getByAltText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the alt text: LucyRicardo
<div>
<div />
</div>"
`);
expect(() => getByTitle('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the title: LucyRicardo.
<div>
<div />
</div>"
`);
expect(() => getByValue('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the value: LucyRicardo.
<div>
<div />
</div>"
`);
expect(() => getByRole('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element by role=LucyRicardo
<div>
<div />
</div>"
`);
});

@@ -168,3 +222,11 @@ test('can get elements by matching their text content', () => {

expect(queryByLabelText(/alone/)).toBeNull();
expect(() => getByLabelText(/alone/)).toThrowErrorMatchingSnapshot();
expect(() => getByLabelText(/alone/)).toThrowErrorMatchingInlineSnapshot(`
"Found a label with the text of: /alone/, however no form control was found associated to that label. Make sure you're using the \\"for\\" attribute or \\"aria-labelledby\\" attribute correctly.
<div>
<label>
All alone
</label>
</div>"
`);
});

@@ -177,3 +239,9 @@ test('totally empty label', () => {

expect(queryByLabelText('')).toBeNull();
expect(() => getByLabelText('')).toThrowErrorMatchingSnapshot();
expect(() => getByLabelText('')).toThrowErrorMatchingInlineSnapshot(`
"Found a label with the text of: , however no form control was found associated to that label. Make sure you're using the \\"for\\" attribute or \\"aria-labelledby\\" attribute correctly.
<div>
<label />
</div>"
`);
});

@@ -562,10 +630,10 @@ test('getByLabelText with aria-label', () => {

} = (0, _testUtils.render)('<div />');
expect(() => getByLabelText('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getBySelectText('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByPlaceholderText('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByText('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByTestId('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByAltText('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByTitle('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByValue('LucyRicardo')).toThrowErrorMatchingSnapshot();
expect(() => getByLabelText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`"Unable to find a label with the text of: LucyRicardo"`);
expect(() => getBySelectText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`"Unable to find a <select> element with the selected option's text: LucyRicardo"`);
expect(() => getByPlaceholderText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`"Unable to find an element with the placeholder text of: LucyRicardo"`);
expect(() => getByText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`"Unable to find an element with the text: LucyRicardo. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible."`);
expect(() => getByTestId('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`"Unable to find an element by: [data-testid=\\"LucyRicardo\\"]"`);
expect(() => getByAltText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`"Unable to find an element with the alt text: LucyRicardo"`);
expect(() => getByTitle('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`"Unable to find an element with the title: LucyRicardo."`);
expect(() => getByValue('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`"Unable to find an element with the value: LucyRicardo."`);
});

@@ -572,0 +640,0 @@ test('getByText ignores script tags by default', () => {

@@ -38,4 +38,10 @@ "use strict";

const input = (0, _.getByLabelText)(container, 'Username');
input.value = famousWomanInHistory; // Get elements by their text, just like a real user does.
_.fireEvent.change(input, {
target: {
value: famousWomanInHistory
}
}); // Get elements by their text, just like a real user does.
(0, _.getByText)(container, 'Print Username').click();

@@ -46,3 +52,36 @@ await (0, _.wait)(() => expect((0, _.queryByTestId)(container, 'printed-username')).toBeTruthy()); // getByTestId and queryByTestId are an escape hatch to get elements

expect((0, _.getByTestId)(container, 'printed-username')).toHaveTextContent(famousWomanInHistory);
expect(container).toMatchSnapshot();
expect(container).toMatchInlineSnapshot(`
<div>
<label
for="username"
>
Username
</label>
<input
id="username"
/>
<button>
Print Username
</button>
<div>
<div
data-testid="printed-username"
>
Ada Lovelace
</div>
</div>
</div>
`);
});

13

dist/__tests__/helpers/test-utils.js

@@ -10,2 +10,3 @@ "use strict";

exports.renderIntoDocument = renderIntoDocument;
exports.cleanup = cleanup;

@@ -32,7 +33,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

function renderIntoDocument(html) {
document.body.innerHTML = html;
const containerQueries = (0, _getQueriesForElement.getQueriesForElement)(document);
return (0, _extends2.default)({
container: document
}, containerQueries);
return render(html, {
container: document.body
});
}
function cleanup() {
document.body.innerHTML = '';
}

@@ -11,3 +11,9 @@ "use strict";

} = (0, _testUtils.render)('<div>Hello World!</div>');
expect((0, _prettyDom.prettyDOM)(container)).toMatchSnapshot();
expect((0, _prettyDom.prettyDOM)(container)).toMatchInlineSnapshot(`
"<div>
<div>
Hello World!
</div>
</div>"
`);
});

@@ -21,3 +27,8 @@ test('it supports truncating the output length', () => {

test('it supports receiving the document element', () => {
expect((0, _prettyDom.prettyDOM)(document)).toMatchSnapshot();
expect((0, _prettyDom.prettyDOM)(document)).toMatchInlineSnapshot(`
"<html>
<head />
<body />
</html>"
`);
});
"use strict";
var _ = require("../");
var _waitForDomChange = require("../wait-for-dom-change");
var _testUtils = require("./helpers/test-utils");
const skipSomeTime = delayMs => new Promise(resolve => setTimeout(resolve, delayMs)); // Using `setTimeout` >30ms instead of `wait` here
// because `mutationobserver-shim` uses `setTimeout` ~30ms.
const skipSomeTimeForMutationObserver = (delayMs = 50) => skipSomeTime(delayMs, 50);
test('it waits for the next DOM mutation', async () => {
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
(0, _.waitForDomChange)().then(successHandler, errorHandler); // Promise callbacks are always asynchronous.
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
await skipSomeTimeForMutationObserver(); // No more expected calls without DOM mutations.
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
document.body.appendChild(document.createElement('div'));
await skipSomeTimeForMutationObserver();
expect(successHandler).toHaveBeenCalledTimes(1);
expect(successHandler.mock.calls[0]).toMatchSnapshot();
expect(errorHandler).toHaveBeenCalledTimes(0);
});
test('it waits characterData mutation', async () => {
afterEach(_testUtils.cleanup);
test('waits for the dom to change in the document', async () => {
const {
container
} = (0, _testUtils.render)(`<div>initial text</div>`);
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
(0, _.waitForDomChange)({
container
}).then(successHandler, errorHandler);
await skipSomeTimeForMutationObserver();
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
container.querySelector('div').innerHTML = 'new text';
await skipSomeTimeForMutationObserver();
expect(successHandler).toHaveBeenCalledTimes(1);
expect(errorHandler).toHaveBeenCalledTimes(0);
} = (0, _testUtils.renderIntoDocument)('<div />');
const promise = (0, _waitForDomChange.waitForDomChange)();
setTimeout(() => container.firstChild.setAttribute('id', 'foo'));
const mutationResult = await promise;
expect(mutationResult).toMatchInlineSnapshot(`
Array [
Object {
"addedNodes": Array [],
"attributeName": "id",
"attributeNamespace": null,
"nextSibling": null,
"oldValue": null,
"previousSibling": null,
"removedNodes": Array [],
"target": <div
id="foo"
/>,
"type": "attributes",
},
]
`);
});
test('it waits for the attributes mutation', async () => {
test('waits for the dom to change in a specified container', async () => {
const {
container
} = (0, _testUtils.render)(``);
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
(0, _.waitForDomChange)({
} = (0, _testUtils.renderIntoDocument)('<div />');
const promise = (0, _waitForDomChange.waitForDomChange)({
container
}).then(successHandler, errorHandler);
await skipSomeTimeForMutationObserver();
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
container.setAttribute('data-test-attribute', 'PASSED');
await skipSomeTimeForMutationObserver();
expect(successHandler).toHaveBeenCalledTimes(1);
expect(successHandler.mock.calls[0]).toMatchSnapshot();
});
test('it throws if timeout is exceeded', async () => {
(0, _testUtils.render)('');
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
(0, _.waitForDomChange)({
timeout: 70
}).then(successHandler, errorHandler);
await skipSomeTimeForMutationObserver(100);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(1);
expect(errorHandler.mock.calls[0]).toMatchInlineSnapshot(`
});
setTimeout(() => container.firstChild.setAttribute('id', 'foo'));
const mutationResult = await promise;
expect(mutationResult).toMatchInlineSnapshot(`
Array [
[Error: Timed out in waitForDomChange.],
Object {
"addedNodes": Array [],
"attributeName": "id",
"attributeNamespace": null,
"nextSibling": null,
"oldValue": null,
"previousSibling": null,
"removedNodes": Array [],
"target": <div
id="foo"
/>,
"type": "attributes",
},
]
`);
});
test('does not get into infinite setTimeout loop after MutationObserver notification', async () => {
const {
container
} = (0, _testUtils.render)(`<div data-testid="initial-element"></div>`);
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
test('can time out', async () => {
jest.useFakeTimers();
const promise = (0, _.waitForDomChange)({
container,
timeout: 70,
mutationObserverOptions: {
attributes: true
}
}).then(successHandler, errorHandler); // Expect 2 timeouts to be scheduled:
// - waitForDomChange timeout
// - MutationObserver timeout
const promise = (0, _waitForDomChange.waitForDomChange)();
jest.advanceTimersByTime(4600);
await expect(promise).rejects.toThrow(/timed out/i);
jest.useRealTimers();
});
test('can specify our own timeout time', async () => {
jest.useFakeTimers();
const promise = (0, _waitForDomChange.waitForDomChange)({
timeout: 4700
});
const handler = jest.fn();
promise.then(handler, handler); // advance beyond the default
expect(setTimeout).toHaveBeenCalledTimes(2);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0); // Make a mutation
jest.advanceTimersByTime(4600); // promise was neither rejected nor resolved
container.setAttribute('data-test-attribute', 'something changed'); // Advance timer to expire MutationObserver timeout
expect(handler).toHaveBeenCalledTimes(0); // advance beyond our specified timeout
jest.advanceTimersByTime(50);
jest.runAllImmediates();
await promise;
expect(setTimeout).toHaveBeenCalledTimes(3); // Expect successHandler to be called
jest.advanceTimersByTime(150); // timed out
expect(successHandler).toHaveBeenCalledTimes(1);
expect(errorHandler).toHaveBeenCalledTimes(0); // Expect no more setTimeout calls
jest.advanceTimersByTime(100);
expect(setTimeout).toHaveBeenCalledTimes(3);
await expect(promise).rejects.toThrow(/timed out/i);
jest.useRealTimers();
});
"use strict";
var _ = require("../");
var _waitForElement = require("../wait-for-element");
var _testUtils = require("./helpers/test-utils");
const skipSomeTime = delayMs => new Promise(resolve => setTimeout(resolve, delayMs)); // Using `setTimeout` >30ms instead of `wait` here because `mutationobserver-shim` uses `setTimeout` ~30ms.
const skipSomeTimeForMutationObserver = (delayMs = 50) => skipSomeTime(delayMs, 50);
test('it waits for the callback to return a value and only reacts to DOM mutations', async () => {
afterEach(_testUtils.cleanup);
test('waits for element to appear in the document', async () => {
const {
rerender,
getByTestId
} = (0, _testUtils.renderIntoDocument)('<div />');
const promise = (0, _waitForElement.waitForElement)(() => getByTestId('div'));
setTimeout(() => rerender('<div data-testid="div" />'));
const element = await promise;
expect(element).toBeInTheDocument();
});
test('waits for element to appear in a specified container', async () => {
const {
rerender,
container,
getByTestId
} = (0, _testUtils.render)(`<div data-testid="initial-element"></div>`);
let nextElIndex = 0;
const makeMutationFn = () => () => {
container.appendChild((0, _testUtils.render)(`<div data-testid="another-element-that-causes-mutation-${++nextElIndex}"></div>`).container.firstChild);
};
const testEl = (0, _testUtils.render)(`<div data-testid="the-element-we-are-looking-for"></div>`).container.firstChild;
testEl.parentNode.removeChild(testEl);
const mutationsAndCallbacks = [[makeMutationFn(), () => {
throw new Error('First exception.');
}], [makeMutationFn(), () => {
throw new Error('Second exception.');
}], [makeMutationFn(), () => null], [makeMutationFn(), () => undefined], [makeMutationFn(), () => getByTestId('the-element-we-are-looking-for')], [() => container.appendChild(testEl), () => getByTestId('the-element-we-are-looking-for')]];
const callback = jest.fn(() => {
throw new Error('No more calls are expected.');
}).mockName('callback').mockImplementation(() => {
throw new Error('First callback call is synchronous, not returning any elements.');
} = (0, _testUtils.render)('<div />');
const promise = (0, _waitForElement.waitForElement)(() => getByTestId('div'), {
container
});
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
(0, _.waitForElement)(callback, {
container
}).then(successHandler, errorHandler); // One synchronous `callback` call is expected.
setTimeout(() => rerender('<div data-testid="div" />'));
const element = await promise;
expect(element).toBeTruthy();
});
test('can time out', async () => {
jest.useFakeTimers();
const promise = (0, _waitForElement.waitForElement)(() => {});
jest.advanceTimersByTime(4600);
await expect(promise).rejects.toThrow(/timed out/i);
jest.useRealTimers();
});
test('can specify our own timeout time', async () => {
jest.useFakeTimers();
const promise = (0, _waitForElement.waitForElement)(() => {}, {
timeout: 4700
});
const handler = jest.fn();
promise.then(handler, handler); // advance beyond the default
expect(callback).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
await skipSomeTimeForMutationObserver(); // No more expected calls without DOM mutations.
jest.advanceTimersByTime(4600); // promise was neither rejected nor resolved
expect(callback).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0); // Perform mutations one by one, waiting for each to trigger `MutationObserver`.
expect(handler).toHaveBeenCalledTimes(0); // advance beyond our specified timeout
for (const [mutationImpl, callbackImpl] of mutationsAndCallbacks) {
callback.mockImplementation(callbackImpl);
mutationImpl();
await skipSomeTimeForMutationObserver(); // eslint-disable-line no-await-in-loop
}
jest.advanceTimersByTime(150); // timed out
expect(callback).toHaveBeenCalledTimes(1 + mutationsAndCallbacks.length);
expect(successHandler).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledWith(testEl);
expect(errorHandler).toHaveBeenCalledTimes(0);
expect(container).toMatchSnapshot();
expect(testEl.parentNode).toBe(container);
await expect(promise).rejects.toThrow(/timed out/i);
jest.useRealTimers();
});
test('it waits characterData mutation', async () => {
test('throws last thrown error', async () => {
const {
rerender,
container
} = (0, _testUtils.render)(`<div>initial text</div>`);
const callback = jest.fn(() => container.textContent === 'new text').mockName('callback');
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
(0, _.waitForElement)(callback, {
container
}).then(successHandler, errorHandler); // Promise callbacks are always asynchronous.
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
expect(callback).toHaveBeenCalledTimes(1);
expect(container).toMatchSnapshot();
await skipSomeTimeForMutationObserver();
expect(callback).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
container.querySelector('div').innerHTML = 'new text';
await skipSomeTimeForMutationObserver();
expect(successHandler).toHaveBeenCalledTimes(1);
expect(errorHandler).toHaveBeenCalledTimes(0);
expect(callback).toHaveBeenCalledTimes(2);
expect(container).toMatchSnapshot();
});
test('it waits for the attributes mutation', async () => {
const {
container
} = (0, _testUtils.render)(``);
const callback = jest.fn(() => container.getAttribute('data-test-attribute')).mockName('callback');
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
(0, _.waitForElement)(callback, {
container
}).then(successHandler, errorHandler);
expect(callback).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
await skipSomeTimeForMutationObserver();
expect(callback).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
container.setAttribute('data-test-attribute', 'PASSED');
await skipSomeTimeForMutationObserver();
expect(callback).toHaveBeenCalledTimes(2);
expect(successHandler).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledWith('PASSED');
expect(errorHandler).toHaveBeenCalledTimes(0);
});
test('it throws if timeout is exceeded', async () => {
const {
container
} = (0, _testUtils.render)(``);
const callback = jest.fn(() => null).mockName('callback');
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
(0, _.waitForElement)(callback, {
} = (0, _testUtils.render)('<div />');
let error;
setTimeout(() => {
error = new Error('first error');
rerender('<div>first</div>');
}, 10);
setTimeout(() => {
error = new Error('second error');
rerender('<div>second</div>');
}, 20);
const promise = (0, _waitForElement.waitForElement)(() => {
throw error;
}, {
container,
timeout: 70,
mutationObserverOptions: {
attributes: true
}
}).then(successHandler, errorHandler);
expect(callback).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
container.setAttribute('data-test-attribute', 'something changed once');
await skipSomeTimeForMutationObserver(50);
expect(callback).toHaveBeenCalledTimes(2);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
container.setAttribute('data-test-attribute', 'something changed twice');
await skipSomeTimeForMutationObserver(50);
expect(callback).toHaveBeenCalledTimes(3);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(1);
expect(errorHandler.mock.calls[0]).toMatchSnapshot();
expect(container).toMatchSnapshot();
timeout: 50
});
await expect(promise).rejects.toThrow(error);
});
test('it throws the same error that the callback has thrown if timeout is exceeded', async () => {
test('waits until callback does not return null', async () => {
const {
rerender,
container,
getByTestId
} = (0, _testUtils.render)(``);
const callback = jest.fn(() => getByTestId('test')).mockName('callback');
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
(0, _.waitForElement)(callback, {
container,
timeout: 70,
mutationObserverOptions: {
attributes: true
}
}).then(successHandler, errorHandler);
expect(callback).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
container.setAttribute('data-test-attribute', 'something changed once');
await skipSomeTimeForMutationObserver(50);
expect(callback).toHaveBeenCalledTimes(2);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
container.setAttribute('data-test-attribute', 'something changed twice');
await skipSomeTimeForMutationObserver(50);
expect(callback).toHaveBeenCalledTimes(3);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(1);
expect(errorHandler.mock.calls[0]).toMatchSnapshot();
expect(container).toMatchSnapshot();
});
test('it returns immediately if the callback returns the value before any mutations', async () => {
const {
container,
getByTestId
} = (0, _testUtils.render)(`<div data-testid="initial-element"></div>`);
const callback = jest.fn(() => getByTestId('initial-element')).mockName('callback');
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
(0, _.waitForElement)(callback, {
container,
timeout: 70,
mutationObserverOptions: {
attributes: true
}
}).then(successHandler, errorHandler); // One synchronous `callback` call is expected.
expect(callback).toHaveBeenCalledTimes(1); // The promise callbacks are expected to be called asyncronously.
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
await (0, _.wait)();
expect(successHandler).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledWith(container.firstChild);
expect(errorHandler).toHaveBeenCalledTimes(0);
container.setAttribute('data-test-attribute', 'something changed once');
await skipSomeTimeForMutationObserver(50); // No more calls are expected.
expect(callback).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledTimes(1);
expect(errorHandler).toHaveBeenCalledTimes(0);
expect(container).toMatchSnapshot();
});
test('does not get into infinite setTimeout loop after MutationObserver notification', async () => {
const {
queryByTestId
} = (0, _testUtils.render)('<div />');
const promise = (0, _waitForElement.waitForElement)(() => queryByTestId('div'), {
container
} = (0, _testUtils.render)(`<div data-testid="initial-element"></div>`);
let didMakeMutation = false;
const callback = jest.fn(() => didMakeMutation).mockName('callback');
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
jest.useFakeTimers();
const promise = (0, _.waitForElement)(callback, {
container,
timeout: 70,
mutationObserverOptions: {
attributes: true
}
}).then(successHandler, errorHandler); // Expect 2 timeouts to be scheduled:
// - waitForElement timeout
// - MutationObserver timeout
expect(setTimeout).toHaveBeenCalledTimes(2); // One synchronous `callback` call is expected.
expect(callback).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0); // Make a mutation so MutationObserver calls out callback
container.setAttribute('data-test-attribute', 'something changed');
didMakeMutation = true; // Advance timer to expire MutationObserver timeout
jest.advanceTimersByTime(50);
jest.runAllImmediates();
await promise;
expect(setTimeout).toHaveBeenCalledTimes(3); // Expect callback and successHandler to be called
expect(callback).toHaveBeenCalledTimes(2);
expect(successHandler).toHaveBeenCalledTimes(1);
expect(errorHandler).toHaveBeenCalledTimes(0); // Expect no more setTimeout calls
jest.advanceTimersByTime(100);
expect(setTimeout).toHaveBeenCalledTimes(3);
jest.useRealTimers();
});
setTimeout(() => rerender('<div data-testid="div" />'));
const element = await promise;
expect(element).toBeTruthy();
});
test('works if a container is not defined', async () => {
(0, _testUtils.render)(``);
const el = document.createElement('p');
document.body.appendChild(el);
const callback = jest.fn(() => el.textContent === 'I changed!').mockName('callback');
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
if (typeof window === 'undefined') {
(0, _.waitForElement)(callback, {
container: document
}).then(successHandler, errorHandler);
} else {
(0, _.waitForElement)(callback).then(successHandler, errorHandler);
}
await skipSomeTimeForMutationObserver();
expect(callback).toHaveBeenCalledTimes(1);
expect(successHandler).toHaveBeenCalledTimes(0);
expect(errorHandler).toHaveBeenCalledTimes(0);
el.innerHTML = 'I changed!';
await skipSomeTimeForMutationObserver();
expect(callback).toHaveBeenCalledTimes(2);
expect(successHandler).toHaveBeenCalledTimes(1);
expect(errorHandler).toHaveBeenCalledTimes(0);
document.getElementsByTagName('html')[0].innerHTML = ''; // cleans the document
});
test('throws an error if callback is not a function', async () => {
const successHandler = jest.fn().mockName('successHandler');
const errorHandler = jest.fn().mockName('errorHandler');
if (typeof window === 'undefined') {
(0, _.waitForElement)(undefined, {
container: document
}).then(successHandler, errorHandler);
} else {
(0, _.waitForElement)().then(successHandler, errorHandler);
}
await skipSomeTimeForMutationObserver();
expect(errorHandler).toHaveBeenLastCalledWith('waitForElement requires a callback as the first parameter');
expect(successHandler).toHaveBeenCalledTimes(0);
test('throws error if no callback is provided', async () => {
await expect((0, _waitForElement.waitForElement)()).rejects.toThrow(/callback/i);
});

@@ -13,2 +13,8 @@ "use strict";

expect(spy).toHaveBeenCalledWith();
});
test('wait defaults to a noop callback', async () => {
const handler = jest.fn();
Promise.resolve().then(handler);
await (0, _.wait)();
expect(handler).toHaveBeenCalledTimes(1);
});

@@ -128,2 +128,4 @@ 'use strict';

var inNode = typeof process !== 'undefined' && process.versions !== undefined && process.versions.node !== undefined;
/* istanbul ignore next */
var window = htmlElement.ownerDocument && htmlElement.ownerDocument.defaultView || undefined;

@@ -242,3 +244,4 @@ var inCypress = typeof global !== 'undefined' && global.Cypress || typeof window !== 'undefined' && window.Cypress;

if (typeof callback !== 'function') {
reject('waitForElement requires a callback as the first parameter');
reject(new Error('waitForElement requires a callback as the first parameter'));
return;
}

@@ -325,3 +328,3 @@

return Array.from(container.querySelectorAll('label')).filter(function (label) {
return matcher(getNodeText(label), label, text, matchNormalizer);
return matcher(label.textContent, label, text, matchNormalizer);
});

@@ -1644,75 +1647,75 @@ }

exports.bindElementToQueries = getQueriesForElement;
exports.within = getQueriesForElement;
exports.getQueriesForElement = getQueriesForElement;
exports.queries = defaultQueries;
exports.queryHelpers = queryHelpers;
exports.getDefaultNormalizer = getDefaultNormalizer;
exports.configure = configure;
exports.findByLabelText = findByLabelText;
exports.debugDOM = debugDOM;
exports.findAllByAltText = findAllByAltText;
exports.findAllByDisplayValue = findAllByDisplayValue;
exports.findAllByLabelText = findAllByLabelText;
exports.findByPlaceholderText = findByPlaceholderText;
exports.findAllByPlaceholderText = findAllByPlaceholderText;
exports.findByText = findByText;
exports.findAllByRole = findAllByRole;
exports.findAllByTestId = findAllByTestId;
exports.findAllByText = findAllByText;
exports.findAllByTitle = findAllByTitle;
exports.findByAltText = findByAltText;
exports.findAllByAltText = findAllByAltText;
exports.findByTitle = findByTitle;
exports.findAllByTitle = findAllByTitle;
exports.findByDisplayValue = findByDisplayValue;
exports.findAllByDisplayValue = findAllByDisplayValue;
exports.findByLabelText = findByLabelText;
exports.findByPlaceholderText = findByPlaceholderText;
exports.findByRole = findByRole;
exports.findAllByRole = findAllByRole;
exports.findByTestId = findByTestId;
exports.findAllByTestId = findAllByTestId;
exports.queryByPlaceholderText = queryByPlaceholderText;
exports.queryAllByPlaceholderText = queryAllByPlaceholderText;
exports.getByPlaceholderText = getByPlaceholderText;
exports.findByText = findByText;
exports.findByTitle = findByTitle;
exports.fireEvent = fireEvent;
exports.firstResultOrNull = firstResultOrNull;
exports.getAllByAltText = getAllByAltText;
exports.getAllByDisplayValue = getAllByDisplayValue;
exports.getAllByLabelText = getAllByLabelText;
exports.getAllByPlaceholderText = getAllByPlaceholderText;
exports.queryByText = queryByText;
exports.queryAllByText = queryAllByText;
exports.getByText = getByText;
exports.getAllByRole = getAllByRole;
exports.getAllBySelectText = getAllBySelectText;
exports.getAllByTestId = getAllByTestId;
exports.getAllByText = getAllByText;
exports.queryByLabelText = queryByLabelText;
exports.queryAllByLabelText = queryAllByLabelText;
exports.getAllByTitle = getAllByTitle;
exports.getAllByValue = getAllByValue;
exports.getByAltText = getByAltText;
exports.getByDisplayValue = getByDisplayValue;
exports.getByLabelText = getByLabelText;
exports.getAllByLabelText = getAllByLabelText;
exports.queryByAltText = queryByAltText;
exports.getByPlaceholderText = getByPlaceholderText;
exports.getByRole = getByRole;
exports.getBySelectText = getBySelectText;
exports.getByTestId = getByTestId;
exports.getByText = getByText;
exports.getByTitle = getByTitle;
exports.getByValue = getByValue;
exports.getDefaultNormalizer = getDefaultNormalizer;
exports.getElementError = getElementError;
exports.getNodeText = getNodeText;
exports.getQueriesForElement = getQueriesForElement;
exports.prettyDOM = prettyDOM;
exports.queries = defaultQueries;
exports.queryAllByAltText = queryAllByAltText;
exports.getByAltText = getByAltText;
exports.getAllByAltText = getAllByAltText;
exports.queryBySelectText = queryBySelectText;
exports.queryAllByAttribute = queryAllByAttribute;
exports.queryAllByDisplayValue = queryAllByDisplayValue;
exports.queryAllByLabelText = queryAllByLabelText;
exports.queryAllByPlaceholderText = queryAllByPlaceholderText;
exports.queryAllByRole = queryAllByRole;
exports.queryAllBySelectText = queryAllBySelectText;
exports.getBySelectText = getBySelectText;
exports.getAllBySelectText = getAllBySelectText;
exports.queryByTestId = queryByTestId;
exports.queryAllByTestId = queryAllByTestId;
exports.getByTestId = getByTestId;
exports.getAllByTestId = getAllByTestId;
exports.queryByTitle = queryByTitle;
exports.queryAllByText = queryAllByText;
exports.queryAllByTitle = queryAllByTitle;
exports.getByTitle = getByTitle;
exports.getAllByTitle = getAllByTitle;
exports.queryByValue = queryByValue;
exports.queryAllByValue = queryAllByValue;
exports.getByValue = getByValue;
exports.getAllByValue = getAllByValue;
exports.queryByAltText = queryByAltText;
exports.queryByAttribute = queryByAttribute;
exports.queryByDisplayValue = queryByDisplayValue;
exports.queryAllByDisplayValue = queryAllByDisplayValue;
exports.getByDisplayValue = getByDisplayValue;
exports.getAllByDisplayValue = getAllByDisplayValue;
exports.queryByLabelText = queryByLabelText;
exports.queryByPlaceholderText = queryByPlaceholderText;
exports.queryByRole = queryByRole;
exports.queryAllByRole = queryAllByRole;
exports.getAllByRole = getAllByRole;
exports.getByRole = getByRole;
exports.queryBySelectText = queryBySelectText;
exports.queryByTestId = queryByTestId;
exports.queryByText = queryByText;
exports.queryByTitle = queryByTitle;
exports.queryByValue = queryByValue;
exports.queryHelpers = queryHelpers;
exports.wait = wait;
exports.waitForDomChange = waitForDomChange;
exports.waitForElement = waitForElement;
exports.waitForElementToBeRemoved = waitForElementToBeRemoved;
exports.waitForDomChange = waitForDomChange;
exports.getNodeText = getNodeText;
exports.fireEvent = fireEvent;
exports.debugDOM = debugDOM;
exports.getElementError = getElementError;
exports.firstResultOrNull = firstResultOrNull;
exports.queryAllByAttribute = queryAllByAttribute;
exports.queryByAttribute = queryByAttribute;
exports.prettyDOM = prettyDOM;
exports.within = getQueriesForElement;

@@ -122,2 +122,4 @@ import _extends from '@babel/runtime/helpers/esm/extends';

var inNode = typeof process !== 'undefined' && process.versions !== undefined && process.versions.node !== undefined;
/* istanbul ignore next */
var window = htmlElement.ownerDocument && htmlElement.ownerDocument.defaultView || undefined;

@@ -236,3 +238,4 @@ var inCypress = typeof global !== 'undefined' && global.Cypress || typeof window !== 'undefined' && window.Cypress;

if (typeof callback !== 'function') {
reject('waitForElement requires a callback as the first parameter');
reject(new Error('waitForElement requires a callback as the first parameter'));
return;
}

@@ -319,3 +322,3 @@

return Array.from(container.querySelectorAll('label')).filter(function (label) {
return matcher(getNodeText(label), label, text, matchNormalizer);
return matcher(label.textContent, label, text, matchNormalizer);
});

@@ -1637,2 +1640,2 @@ }

export { getQueriesForElement as bindElementToQueries, getQueriesForElement as within, getQueriesForElement, defaultQueries as queries, queryHelpers, getDefaultNormalizer, configure, findByLabelText, findAllByLabelText, findByPlaceholderText, findAllByPlaceholderText, findByText, findAllByText, findByAltText, findAllByAltText, findByTitle, findAllByTitle, findByDisplayValue, findAllByDisplayValue, findByRole, findAllByRole, findByTestId, findAllByTestId, queryByPlaceholderText, queryAllByPlaceholderText, getByPlaceholderText, getAllByPlaceholderText, queryByText, queryAllByText, getByText, getAllByText, queryByLabelText, queryAllByLabelText, getByLabelText, getAllByLabelText, queryByAltText, queryAllByAltText, getByAltText, getAllByAltText, queryBySelectText, queryAllBySelectText, getBySelectText, getAllBySelectText, queryByTestId, queryAllByTestId, getByTestId, getAllByTestId, queryByTitle, queryAllByTitle, getByTitle, getAllByTitle, queryByValue, queryAllByValue, getByValue, getAllByValue, queryByDisplayValue, queryAllByDisplayValue, getByDisplayValue, getAllByDisplayValue, queryByRole, queryAllByRole, getAllByRole, getByRole, wait, waitForElement, waitForElementToBeRemoved, waitForDomChange, getNodeText, fireEvent, debugDOM, getElementError, firstResultOrNull, queryAllByAttribute, queryByAttribute, prettyDOM };
export { getQueriesForElement as bindElementToQueries, configure, debugDOM, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, firstResultOrNull, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllBySelectText, getAllByTestId, getAllByText, getAllByTitle, getAllByValue, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getBySelectText, getByTestId, getByText, getByTitle, getByValue, getDefaultNormalizer, getElementError, getNodeText, getQueriesForElement, prettyDOM, defaultQueries as queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllBySelectText, queryAllByTestId, queryAllByText, queryAllByTitle, queryAllByValue, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryBySelectText, queryByTestId, queryByText, queryByTitle, queryByValue, queryHelpers, wait, waitForDomChange, waitForElement, waitForElementToBeRemoved, getQueriesForElement as within };

@@ -65,3 +65,3 @@ "use strict";

});
return Array.from(container.querySelectorAll('label')).filter(label => matcher((0, _getNodeText.getNodeText)(label), label, text, matchNormalizer));
return Array.from(container.querySelectorAll('label')).filter(label => matcher(label.textContent, label, text, matchNormalizer));
}

@@ -68,0 +68,0 @@

@@ -20,2 +20,4 @@ "use strict";

const inNode = typeof process !== 'undefined' && process.versions !== undefined && process.versions.node !== undefined;
/* istanbul ignore next */
const window = htmlElement.ownerDocument && htmlElement.ownerDocument.defaultView || undefined;

@@ -22,0 +24,0 @@ const inCypress = typeof global !== 'undefined' && global.Cypress || typeof window !== 'undefined' && window.Cypress;

@@ -22,3 +22,4 @@ "use strict";

if (typeof callback !== 'function') {
reject('waitForElement requires a callback as the first parameter');
reject(new Error('waitForElement requires a callback as the first parameter'));
return;
}

@@ -25,0 +26,0 @@

{
"name": "dom-testing-library",
"version": "3.18.1",
"version": "3.18.2",
"description": "Simple and complete DOM testing utilities that encourage good testing practices.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -23,3 +23,3 @@ <div align="center">

[![All Contributors](https://img.shields.io/badge/all_contributors-52-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-53-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome][prs-badge]][prs]

@@ -134,3 +134,3 @@ [![Code of Conduct][coc-badge]][coc]

<!-- prettier-ignore -->
<table><tr><td align="center"><a href="https://kentcdodds.com"><img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=kentcdodds" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=kentcdodds" title="Documentation">📖</a> <a href="#infra-kentcdodds" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=kentcdodds" title="Tests">⚠️</a></td><td align="center"><a href="http://audiolion.github.io"><img src="https://avatars1.githubusercontent.com/u/2430381?v=4" width="100px;" alt="Ryan Castner"/><br /><sub><b>Ryan Castner</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=audiolion" title="Documentation">📖</a></td><td align="center"><a href="https://www.dnlsandiego.com"><img src="https://avatars0.githubusercontent.com/u/8008023?v=4" width="100px;" alt="Daniel Sandiego"/><br /><sub><b>Daniel Sandiego</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=dnlsandiego" title="Code">💻</a></td><td align="center"><a href="https://github.com/Miklet"><img src="https://avatars2.githubusercontent.com/u/12592677?v=4" width="100px;" alt="Paweł Mikołajczyk"/><br /><sub><b>Paweł Mikołajczyk</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=Miklet" title="Code">💻</a></td><td align="center"><a href="http://co.linkedin.com/in/alejandronanez/"><img src="https://avatars3.githubusercontent.com/u/464978?v=4" width="100px;" alt="Alejandro Ñáñez Ortiz"/><br /><sub><b>Alejandro Ñáñez Ortiz</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=alejandronanez" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/pbomb"><img src="https://avatars0.githubusercontent.com/u/1402095?v=4" width="100px;" alt="Matt Parrish"/><br /><sub><b>Matt Parrish</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3Apbomb" title="Bug reports">🐛</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=pbomb" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=pbomb" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=pbomb" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/wKovacs64"><img src="https://avatars1.githubusercontent.com/u/1288694?v=4" width="100px;" alt="Justin Hall"/><br /><sub><b>Justin Hall</b></sub></a><br /><a href="#platform-wKovacs64" title="Packaging/porting to new platform">📦</a></td></tr><tr><td align="center"><a href="https://github.com/antoaravinth"><img src="https://avatars1.githubusercontent.com/u/1241511?s=460&v=4" width="100px;" alt="Anto Aravinth"/><br /><sub><b>Anto Aravinth</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=antoaravinth" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=antoaravinth" title="Tests">⚠️</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=antoaravinth" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/JonahMoses"><img src="https://avatars2.githubusercontent.com/u/3462296?v=4" width="100px;" alt="Jonah Moses"/><br /><sub><b>Jonah Moses</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=JonahMoses" title="Documentation">📖</a></td><td align="center"><a href="http://team.thebrain.pro"><img src="https://avatars1.githubusercontent.com/u/4002543?v=4" width="100px;" alt="Łukasz Gandecki"/><br /><sub><b>Łukasz Gandecki</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=lgandecki" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=lgandecki" title="Tests">⚠️</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=lgandecki" title="Documentation">📖</a></td><td align="center"><a href="https://sompylasar.github.io"><img src="https://avatars2.githubusercontent.com/u/498274?v=4" width="100px;" alt="Ivan Babak"/><br /><sub><b>Ivan Babak</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3Asompylasar" title="Bug reports">🐛</a> <a href="#ideas-sompylasar" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=sompylasar" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=sompylasar" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/jday3"><img src="https://avatars3.githubusercontent.com/u/4439618?v=4" width="100px;" alt="Jesse Day"/><br /><sub><b>Jesse Day</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=jday3" title="Code">💻</a></td><td align="center"><a href="http://gnapse.github.io"><img src="https://avatars0.githubusercontent.com/u/15199?v=4" width="100px;" alt="Ernesto García"/><br /><sub><b>Ernesto García</b></sub></a><br /><a href="#question-gnapse" title="Answering Questions">💬</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=gnapse" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=gnapse" title="Documentation">📖</a></td><td align="center"><a href="http://jomaxx.com"><img src="https://avatars2.githubusercontent.com/u/2747424?v=4" width="100px;" alt="Josef Maxx Blake"/><br /><sub><b>Josef Maxx Blake</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=jomaxx" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=jomaxx" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=jomaxx" title="Tests">⚠️</a></td></tr><tr><td align="center"><a href="https://github.com/alecook"><img src="https://avatars3.githubusercontent.com/u/725236?v=4" width="100px;" alt="Alex Cook"/><br /><sub><b>Alex Cook</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=alecook" title="Documentation">📖</a> <a href="#example-alecook" title="Examples">💡</a> <a href="#review-alecook" title="Reviewed Pull Requests">👀</a></td><td align="center"><a href="https://github.com/dfcook"><img src="https://avatars3.githubusercontent.com/u/10348212?v=4" width="100px;" alt="Daniel Cook"/><br /><sub><b>Daniel Cook</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=dfcook" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=dfcook" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=dfcook" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/thchia"><img src="https://avatars2.githubusercontent.com/u/21194045?s=400&v=4" width="100px;" alt="Thomas Chia"/><br /><sub><b>Thomas Chia</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3Athchia" title="Bug reports">🐛</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=thchia" title="Code">💻</a></td><td align="center"><a href="https://github.com/tdeschryver"><img src="https://avatars1.githubusercontent.com/u/28659384?v=4" width="100px;" alt="Tim Deschryver"/><br /><sub><b>Tim Deschryver</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tdeschryver" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tdeschryver" title="Tests">⚠️</a></td><td align="center"><a href="https://alexkrolick.com"><img src="https://avatars3.githubusercontent.com/u/1571667?v=4" width="100px;" alt="Alex Krolick"/><br /><sub><b>Alex Krolick</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=alexkrolick" title="Code">💻</a></td><td align="center"><a href="http://www.maddijoyce.com"><img src="https://avatars2.githubusercontent.com/u/2224291?v=4" width="100px;" alt="Maddi Joyce"/><br /><sub><b>Maddi Joyce</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=maddijoyce" title="Code">💻</a></td><td align="center"><a href="https://github.com/npeterkamps"><img src="https://avatars1.githubusercontent.com/u/25429764?v=4" width="100px;" alt="Peter Kamps"/><br /><sub><b>Peter Kamps</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3Anpeterkamps" title="Bug reports">🐛</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=npeterkamps" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=npeterkamps" title="Tests">⚠️</a></td></tr><tr><td align="center"><a href="http://jonathanstoye.de"><img src="https://avatars2.githubusercontent.com/u/21689428?v=4" width="100px;" alt="Jonathan Stoye"/><br /><sub><b>Jonathan Stoye</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=JonathanStoye" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/yongdamsh"><img src="https://avatars2.githubusercontent.com/u/4126644?v=4" width="100px;" alt="Sanghyeon Lee"/><br /><sub><b>Sanghyeon Lee</b></sub></a><br /><a href="#example-yongdamsh" title="Examples">💡</a></td><td align="center"><a href="https://github.com/Dajust"><img src="https://avatars3.githubusercontent.com/u/8015514?v=4" width="100px;" alt="Justice Mba "/><br /><sub><b>Justice Mba </b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=Dajust" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=Dajust" title="Documentation">📖</a> <a href="#ideas-Dajust" title="Ideas, Planning, & Feedback">🤔</a></td><td align="center"><a href="https://github.com/wgcrouch"><img src="https://avatars3.githubusercontent.com/u/340761?v=4" width="100px;" alt="Wayne Crouch"/><br /><sub><b>Wayne Crouch</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=wgcrouch" title="Code">💻</a></td><td align="center"><a href="http://benjaminelliott.co.uk"><img src="https://avatars1.githubusercontent.com/u/4996462?v=4" width="100px;" alt="Ben Elliott"/><br /><sub><b>Ben Elliott</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=benelliott" title="Code">💻</a></td><td align="center"><a href="http://nuances.co"><img src="https://avatars3.githubusercontent.com/u/577921?v=4" width="100px;" alt="Ruben Costa"/><br /><sub><b>Ruben Costa</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=rubencosta" title="Code">💻</a></td><td align="center"><a href="http://rbrtsmith.com/"><img src="https://avatars2.githubusercontent.com/u/4982001?v=4" width="100px;" alt="Robert Smith"/><br /><sub><b>Robert Smith</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3Arbrtsmith" title="Bug reports">🐛</a> <a href="#ideas-rbrtsmith" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=rbrtsmith" title="Documentation">📖</a></td></tr><tr><td align="center"><a href="https://github.com/dadamssg"><img src="https://avatars3.githubusercontent.com/u/881986?v=4" width="100px;" alt="dadamssg"/><br /><sub><b>dadamssg</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=dadamssg" title="Code">💻</a></td><td align="center"><a href="https://neilkistner.com/"><img src="https://avatars1.githubusercontent.com/u/186971?v=4" width="100px;" alt="Neil Kistner"/><br /><sub><b>Neil Kistner</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=wyze" title="Code">💻</a></td><td align="center"><a href="http://bdchauvette.net/"><img src="https://avatars3.githubusercontent.com/u/1448597?v=4" width="100px;" alt="Ben Chauvette"/><br /><sub><b>Ben Chauvette</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=bdchauvette" title="Code">💻</a></td><td align="center"><a href="https://github.com/JeffBaumgardt"><img src="https://avatars2.githubusercontent.com/u/777527?v=4" width="100px;" alt="Jeff Baumgardt"/><br /><sub><b>Jeff Baumgardt</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=JeffBaumgardt" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=JeffBaumgardt" title="Documentation">📖</a></td><td align="center"><a href="http://matchai.me"><img src="https://avatars0.githubusercontent.com/u/4658208?v=4" width="100px;" alt="Matan Kushner"/><br /><sub><b>Matan Kushner</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=matchai" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=matchai" title="Documentation">📖</a> <a href="#ideas-matchai" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=matchai" title="Tests">⚠️</a></td><td align="center"><a href="http://www.wendtedesigns.com/"><img src="https://avatars2.githubusercontent.com/u/5779538?v=4" width="100px;" alt="Alex Wendte"/><br /><sub><b>Alex Wendte</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/ruffle1986"><img src="https://avatars0.githubusercontent.com/u/2196208?v=4" width="100px;" alt="Tamas Fodor"/><br /><sub><b>Tamas Fodor</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=ruffle1986" title="Documentation">📖</a></td></tr><tr><td align="center"><a href="https://github.com/BenjaminEckardt"><img src="https://avatars3.githubusercontent.com/u/14793495?v=4" width="100px;" alt="Benjamin Eckardt"/><br /><sub><b>Benjamin Eckardt</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=BenjaminEckardt" title="Code">💻</a></td><td align="center"><a href="https://github.com/campbellr"><img src="https://avatars3.githubusercontent.com/u/205752?v=4" width="100px;" alt="Ryan Campbell"/><br /><sub><b>Ryan Campbell</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=campbellr" title="Documentation">📖</a></td><td align="center"><a href="https://taylor-briggs.com"><img src="https://avatars2.githubusercontent.com/u/1335519?v=4" width="100px;" alt="Taylor Briggs"/><br /><sub><b>Taylor Briggs</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=TaylorBriggs" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/jgoz"><img src="https://avatars2.githubusercontent.com/u/132233?v=4" width="100px;" alt="John Gozde"/><br /><sub><b>John Gozde</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=jgoz" title="Code">💻</a></td><td align="center"><a href="https://github.com/chentsulin"><img src="https://avatars2.githubusercontent.com/u/3382565?v=4" width="100px;" alt="C. T. Lin"/><br /><sub><b>C. T. Lin</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=chentsulin" title="Documentation">📖</a></td><td align="center"><a href="http://terrencewwong.com"><img src="https://avatars3.githubusercontent.com/u/5312329?v=4" width="100px;" alt="Terrence Wong"/><br /><sub><b>Terrence Wong</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=terrencewwong" title="Code">💻</a></td><td align="center"><a href="https://www.ossfinder.com"><img src="https://avatars0.githubusercontent.com/u/12230408?v=4" width="100px;" alt="Soo Jae Hwang"/><br /><sub><b>Soo Jae Hwang</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=misoguy" title="Code">💻</a></td></tr><tr><td align="center"><a href="https://github.com/RoystonS"><img src="https://avatars0.githubusercontent.com/u/19773?v=4" width="100px;" alt="Royston Shufflebotham"/><br /><sub><b>Royston Shufflebotham</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3ARoystonS" title="Bug reports">🐛</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=RoystonS" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=RoystonS" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=RoystonS" title="Tests">⚠️</a></td><td align="center"><a href="http://www.vadimbrodsky.com"><img src="https://avatars0.githubusercontent.com/u/591673?v=4" width="100px;" alt="Vadim Brodsky"/><br /><sub><b>Vadim Brodsky</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=VadimBrodsky" title="Code">💻</a></td><td align="center"><a href="https://twitter.com/eunjae_lee"><img src="https://avatars3.githubusercontent.com/u/499898?v=4" width="100px;" alt="Eunjae Lee"/><br /><sub><b>Eunjae Lee</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=eunjae-lee" title="Code">💻</a></td><td align="center"><a href="http://davidpeter.me"><img src="https://avatars2.githubusercontent.com/u/167743?v=4" width="100px;" alt="David Peter"/><br /><sub><b>David Peter</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=sarenji" title="Code">💻</a></td><td align="center"><a href="https://twitter.com/@puemos"><img src="https://avatars0.githubusercontent.com/u/13174025?v=4" width="100px;" alt="Shy Alter"/><br /><sub><b>Shy Alter</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=puemos" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=puemos" title="Documentation">📖</a></td><td align="center"><a href="https://lukaszmakuch.pl"><img src="https://avatars1.githubusercontent.com/u/11966621?v=4" width="100px;" alt="Łukasz Makuch"/><br /><sub><b>Łukasz Makuch</b></sub></a><br /><a href="#platform-lukaszmakuch" title="Packaging/porting to new platform">📦</a></td><td align="center"><a href="https://github.com/tylerthehaas"><img src="https://avatars1.githubusercontent.com/u/11150235?v=4" width="100px;" alt="Tyler Haas"/><br /><sub><b>Tyler Haas</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tylerthehaas" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tylerthehaas" title="Tests">⚠️</a></td></tr><tr><td align="center"><a href="http://vesalaakso.com"><img src="https://avatars2.githubusercontent.com/u/482561?v=4" width="100px;" alt="Vesa Laakso"/><br /><sub><b>Vesa Laakso</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=valscion" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=valscion" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/Tolsee"><img src="https://avatars0.githubusercontent.com/u/16590492?v=4" width="100px;" alt="Tulsi Sapkota"/><br /><sub><b>Tulsi Sapkota</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=Tolsee" title="Code">💻</a></td><td align="center"><a href="https://github.com/tnunes"><img src="https://avatars1.githubusercontent.com/u/163187?v=4" width="100px;" alt="Tiago Nunes"/><br /><sub><b>Tiago Nunes</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tnunes" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tnunes" title="Tests">⚠️</a></td></tr></table>
<table><tr><td align="center"><a href="https://kentcdodds.com"><img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=kentcdodds" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=kentcdodds" title="Documentation">📖</a> <a href="#infra-kentcdodds" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=kentcdodds" title="Tests">⚠️</a></td><td align="center"><a href="http://audiolion.github.io"><img src="https://avatars1.githubusercontent.com/u/2430381?v=4" width="100px;" alt="Ryan Castner"/><br /><sub><b>Ryan Castner</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=audiolion" title="Documentation">📖</a></td><td align="center"><a href="https://www.dnlsandiego.com"><img src="https://avatars0.githubusercontent.com/u/8008023?v=4" width="100px;" alt="Daniel Sandiego"/><br /><sub><b>Daniel Sandiego</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=dnlsandiego" title="Code">💻</a></td><td align="center"><a href="https://github.com/Miklet"><img src="https://avatars2.githubusercontent.com/u/12592677?v=4" width="100px;" alt="Paweł Mikołajczyk"/><br /><sub><b>Paweł Mikołajczyk</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=Miklet" title="Code">💻</a></td><td align="center"><a href="http://co.linkedin.com/in/alejandronanez/"><img src="https://avatars3.githubusercontent.com/u/464978?v=4" width="100px;" alt="Alejandro Ñáñez Ortiz"/><br /><sub><b>Alejandro Ñáñez Ortiz</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=alejandronanez" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/pbomb"><img src="https://avatars0.githubusercontent.com/u/1402095?v=4" width="100px;" alt="Matt Parrish"/><br /><sub><b>Matt Parrish</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3Apbomb" title="Bug reports">🐛</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=pbomb" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=pbomb" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=pbomb" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/wKovacs64"><img src="https://avatars1.githubusercontent.com/u/1288694?v=4" width="100px;" alt="Justin Hall"/><br /><sub><b>Justin Hall</b></sub></a><br /><a href="#platform-wKovacs64" title="Packaging/porting to new platform">📦</a></td></tr><tr><td align="center"><a href="https://github.com/antoaravinth"><img src="https://avatars1.githubusercontent.com/u/1241511?s=460&v=4" width="100px;" alt="Anto Aravinth"/><br /><sub><b>Anto Aravinth</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=antoaravinth" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=antoaravinth" title="Tests">⚠️</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=antoaravinth" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/JonahMoses"><img src="https://avatars2.githubusercontent.com/u/3462296?v=4" width="100px;" alt="Jonah Moses"/><br /><sub><b>Jonah Moses</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=JonahMoses" title="Documentation">📖</a></td><td align="center"><a href="http://team.thebrain.pro"><img src="https://avatars1.githubusercontent.com/u/4002543?v=4" width="100px;" alt="Łukasz Gandecki"/><br /><sub><b>Łukasz Gandecki</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=lgandecki" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=lgandecki" title="Tests">⚠️</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=lgandecki" title="Documentation">📖</a></td><td align="center"><a href="https://sompylasar.github.io"><img src="https://avatars2.githubusercontent.com/u/498274?v=4" width="100px;" alt="Ivan Babak"/><br /><sub><b>Ivan Babak</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3Asompylasar" title="Bug reports">🐛</a> <a href="#ideas-sompylasar" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=sompylasar" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=sompylasar" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/jday3"><img src="https://avatars3.githubusercontent.com/u/4439618?v=4" width="100px;" alt="Jesse Day"/><br /><sub><b>Jesse Day</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=jday3" title="Code">💻</a></td><td align="center"><a href="http://gnapse.github.io"><img src="https://avatars0.githubusercontent.com/u/15199?v=4" width="100px;" alt="Ernesto García"/><br /><sub><b>Ernesto García</b></sub></a><br /><a href="#question-gnapse" title="Answering Questions">💬</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=gnapse" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=gnapse" title="Documentation">📖</a></td><td align="center"><a href="http://jomaxx.com"><img src="https://avatars2.githubusercontent.com/u/2747424?v=4" width="100px;" alt="Josef Maxx Blake"/><br /><sub><b>Josef Maxx Blake</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=jomaxx" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=jomaxx" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=jomaxx" title="Tests">⚠️</a></td></tr><tr><td align="center"><a href="https://github.com/alecook"><img src="https://avatars3.githubusercontent.com/u/725236?v=4" width="100px;" alt="Alex Cook"/><br /><sub><b>Alex Cook</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=alecook" title="Documentation">📖</a> <a href="#example-alecook" title="Examples">💡</a> <a href="#review-alecook" title="Reviewed Pull Requests">👀</a></td><td align="center"><a href="https://github.com/dfcook"><img src="https://avatars3.githubusercontent.com/u/10348212?v=4" width="100px;" alt="Daniel Cook"/><br /><sub><b>Daniel Cook</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=dfcook" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=dfcook" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=dfcook" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/thchia"><img src="https://avatars2.githubusercontent.com/u/21194045?s=400&v=4" width="100px;" alt="Thomas Chia"/><br /><sub><b>Thomas Chia</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3Athchia" title="Bug reports">🐛</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=thchia" title="Code">💻</a></td><td align="center"><a href="https://github.com/tdeschryver"><img src="https://avatars1.githubusercontent.com/u/28659384?v=4" width="100px;" alt="Tim Deschryver"/><br /><sub><b>Tim Deschryver</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tdeschryver" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tdeschryver" title="Tests">⚠️</a></td><td align="center"><a href="https://alexkrolick.com"><img src="https://avatars3.githubusercontent.com/u/1571667?v=4" width="100px;" alt="Alex Krolick"/><br /><sub><b>Alex Krolick</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=alexkrolick" title="Code">💻</a></td><td align="center"><a href="http://www.maddijoyce.com"><img src="https://avatars2.githubusercontent.com/u/2224291?v=4" width="100px;" alt="Maddi Joyce"/><br /><sub><b>Maddi Joyce</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=maddijoyce" title="Code">💻</a></td><td align="center"><a href="https://github.com/npeterkamps"><img src="https://avatars1.githubusercontent.com/u/25429764?v=4" width="100px;" alt="Peter Kamps"/><br /><sub><b>Peter Kamps</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3Anpeterkamps" title="Bug reports">🐛</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=npeterkamps" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=npeterkamps" title="Tests">⚠️</a></td></tr><tr><td align="center"><a href="http://jonathanstoye.de"><img src="https://avatars2.githubusercontent.com/u/21689428?v=4" width="100px;" alt="Jonathan Stoye"/><br /><sub><b>Jonathan Stoye</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=JonathanStoye" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/yongdamsh"><img src="https://avatars2.githubusercontent.com/u/4126644?v=4" width="100px;" alt="Sanghyeon Lee"/><br /><sub><b>Sanghyeon Lee</b></sub></a><br /><a href="#example-yongdamsh" title="Examples">💡</a></td><td align="center"><a href="https://github.com/Dajust"><img src="https://avatars3.githubusercontent.com/u/8015514?v=4" width="100px;" alt="Justice Mba "/><br /><sub><b>Justice Mba </b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=Dajust" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=Dajust" title="Documentation">📖</a> <a href="#ideas-Dajust" title="Ideas, Planning, & Feedback">🤔</a></td><td align="center"><a href="https://github.com/wgcrouch"><img src="https://avatars3.githubusercontent.com/u/340761?v=4" width="100px;" alt="Wayne Crouch"/><br /><sub><b>Wayne Crouch</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=wgcrouch" title="Code">💻</a></td><td align="center"><a href="http://benjaminelliott.co.uk"><img src="https://avatars1.githubusercontent.com/u/4996462?v=4" width="100px;" alt="Ben Elliott"/><br /><sub><b>Ben Elliott</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=benelliott" title="Code">💻</a></td><td align="center"><a href="http://nuances.co"><img src="https://avatars3.githubusercontent.com/u/577921?v=4" width="100px;" alt="Ruben Costa"/><br /><sub><b>Ruben Costa</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=rubencosta" title="Code">💻</a></td><td align="center"><a href="http://rbrtsmith.com/"><img src="https://avatars2.githubusercontent.com/u/4982001?v=4" width="100px;" alt="Robert Smith"/><br /><sub><b>Robert Smith</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3Arbrtsmith" title="Bug reports">🐛</a> <a href="#ideas-rbrtsmith" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=rbrtsmith" title="Documentation">📖</a></td></tr><tr><td align="center"><a href="https://github.com/dadamssg"><img src="https://avatars3.githubusercontent.com/u/881986?v=4" width="100px;" alt="dadamssg"/><br /><sub><b>dadamssg</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=dadamssg" title="Code">💻</a></td><td align="center"><a href="https://neilkistner.com/"><img src="https://avatars1.githubusercontent.com/u/186971?v=4" width="100px;" alt="Neil Kistner"/><br /><sub><b>Neil Kistner</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=wyze" title="Code">💻</a></td><td align="center"><a href="http://bdchauvette.net/"><img src="https://avatars3.githubusercontent.com/u/1448597?v=4" width="100px;" alt="Ben Chauvette"/><br /><sub><b>Ben Chauvette</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=bdchauvette" title="Code">💻</a></td><td align="center"><a href="https://github.com/JeffBaumgardt"><img src="https://avatars2.githubusercontent.com/u/777527?v=4" width="100px;" alt="Jeff Baumgardt"/><br /><sub><b>Jeff Baumgardt</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=JeffBaumgardt" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=JeffBaumgardt" title="Documentation">📖</a></td><td align="center"><a href="http://matchai.me"><img src="https://avatars0.githubusercontent.com/u/4658208?v=4" width="100px;" alt="Matan Kushner"/><br /><sub><b>Matan Kushner</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=matchai" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=matchai" title="Documentation">📖</a> <a href="#ideas-matchai" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=matchai" title="Tests">⚠️</a></td><td align="center"><a href="http://www.wendtedesigns.com/"><img src="https://avatars2.githubusercontent.com/u/5779538?v=4" width="100px;" alt="Alex Wendte"/><br /><sub><b>Alex Wendte</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=themostcolm" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/ruffle1986"><img src="https://avatars0.githubusercontent.com/u/2196208?v=4" width="100px;" alt="Tamas Fodor"/><br /><sub><b>Tamas Fodor</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=ruffle1986" title="Documentation">📖</a></td></tr><tr><td align="center"><a href="https://github.com/BenjaminEckardt"><img src="https://avatars3.githubusercontent.com/u/14793495?v=4" width="100px;" alt="Benjamin Eckardt"/><br /><sub><b>Benjamin Eckardt</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=BenjaminEckardt" title="Code">💻</a></td><td align="center"><a href="https://github.com/campbellr"><img src="https://avatars3.githubusercontent.com/u/205752?v=4" width="100px;" alt="Ryan Campbell"/><br /><sub><b>Ryan Campbell</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=campbellr" title="Documentation">📖</a></td><td align="center"><a href="https://taylor-briggs.com"><img src="https://avatars2.githubusercontent.com/u/1335519?v=4" width="100px;" alt="Taylor Briggs"/><br /><sub><b>Taylor Briggs</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=TaylorBriggs" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/jgoz"><img src="https://avatars2.githubusercontent.com/u/132233?v=4" width="100px;" alt="John Gozde"/><br /><sub><b>John Gozde</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=jgoz" title="Code">💻</a></td><td align="center"><a href="https://github.com/chentsulin"><img src="https://avatars2.githubusercontent.com/u/3382565?v=4" width="100px;" alt="C. T. Lin"/><br /><sub><b>C. T. Lin</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=chentsulin" title="Documentation">📖</a></td><td align="center"><a href="http://terrencewwong.com"><img src="https://avatars3.githubusercontent.com/u/5312329?v=4" width="100px;" alt="Terrence Wong"/><br /><sub><b>Terrence Wong</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=terrencewwong" title="Code">💻</a></td><td align="center"><a href="https://www.ossfinder.com"><img src="https://avatars0.githubusercontent.com/u/12230408?v=4" width="100px;" alt="Soo Jae Hwang"/><br /><sub><b>Soo Jae Hwang</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=misoguy" title="Code">💻</a></td></tr><tr><td align="center"><a href="https://github.com/RoystonS"><img src="https://avatars0.githubusercontent.com/u/19773?v=4" width="100px;" alt="Royston Shufflebotham"/><br /><sub><b>Royston Shufflebotham</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/issues?q=author%3ARoystonS" title="Bug reports">🐛</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=RoystonS" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=RoystonS" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=RoystonS" title="Tests">⚠️</a></td><td align="center"><a href="http://www.vadimbrodsky.com"><img src="https://avatars0.githubusercontent.com/u/591673?v=4" width="100px;" alt="Vadim Brodsky"/><br /><sub><b>Vadim Brodsky</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=VadimBrodsky" title="Code">💻</a></td><td align="center"><a href="https://twitter.com/eunjae_lee"><img src="https://avatars3.githubusercontent.com/u/499898?v=4" width="100px;" alt="Eunjae Lee"/><br /><sub><b>Eunjae Lee</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=eunjae-lee" title="Code">💻</a></td><td align="center"><a href="http://davidpeter.me"><img src="https://avatars2.githubusercontent.com/u/167743?v=4" width="100px;" alt="David Peter"/><br /><sub><b>David Peter</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=sarenji" title="Code">💻</a></td><td align="center"><a href="https://twitter.com/@puemos"><img src="https://avatars0.githubusercontent.com/u/13174025?v=4" width="100px;" alt="Shy Alter"/><br /><sub><b>Shy Alter</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=puemos" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=puemos" title="Documentation">📖</a></td><td align="center"><a href="https://lukaszmakuch.pl"><img src="https://avatars1.githubusercontent.com/u/11966621?v=4" width="100px;" alt="Łukasz Makuch"/><br /><sub><b>Łukasz Makuch</b></sub></a><br /><a href="#platform-lukaszmakuch" title="Packaging/porting to new platform">📦</a></td><td align="center"><a href="https://github.com/tylerthehaas"><img src="https://avatars1.githubusercontent.com/u/11150235?v=4" width="100px;" alt="Tyler Haas"/><br /><sub><b>Tyler Haas</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tylerthehaas" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tylerthehaas" title="Tests">⚠️</a></td></tr><tr><td align="center"><a href="http://vesalaakso.com"><img src="https://avatars2.githubusercontent.com/u/482561?v=4" width="100px;" alt="Vesa Laakso"/><br /><sub><b>Vesa Laakso</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=valscion" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=valscion" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/Tolsee"><img src="https://avatars0.githubusercontent.com/u/16590492?v=4" width="100px;" alt="Tulsi Sapkota"/><br /><sub><b>Tulsi Sapkota</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=Tolsee" title="Code">💻</a></td><td align="center"><a href="https://github.com/tnunes"><img src="https://avatars1.githubusercontent.com/u/163187?v=4" width="100px;" alt="Tiago Nunes"/><br /><sub><b>Tiago Nunes</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tnunes" title="Code">💻</a> <a href="https://github.com/kentcdodds/dom-testing-library/commits?author=tnunes" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/JaxCavalera"><img src="https://avatars1.githubusercontent.com/u/15429762?v=4" width="100px;" alt="JaxCavalera"/><br /><sub><b>JaxCavalera</b></sub></a><br /><a href="https://github.com/kentcdodds/dom-testing-library/commits?author=JaxCavalera" title="Code">💻</a></td></tr></table>

@@ -137,0 +137,0 @@ <!-- ALL-CONTRIBUTORS-LIST:END -->

import {Matcher, MatcherOptions} from './matches'
import {SelectorMatcherOptions} from './query-helpers'
import {WaitForElementOptions} from './wait-for-element'

@@ -16,2 +17,9 @@ export type QueryByBoundAttribute = (

export type FindAllByBoundAttribute = (
container: HTMLElement,
id: Matcher,
options?: MatcherOptions,
waitForElementOptions?: WaitForElementOptions
) => Promise<HTMLElement[]> | Error
export type GetByBoundAttribute = (

@@ -23,2 +31,9 @@ container: HTMLElement,

export type FindByBoundAttribute = (
container: HTMLElement,
id: Matcher,
options?: MatcherOptions,
waitForElementOptions?: WaitForElementOptions
) => Promise<HTMLElement> | Error
export type QueryByText = (

@@ -36,2 +51,9 @@ container: HTMLElement,

export type FindAllByText = (
container: HTMLElement,
id: Matcher,
options?: SelectorMatcherOptions,
waitForElementOptions?: WaitForElementOptions
) => Promise<HTMLElement[]> | Error
export type GetByText = (

@@ -43,41 +65,64 @@ container: HTMLElement,

export type FindByText = (
container: HTMLElement,
id: Matcher,
options?: SelectorMatcherOptions,
waitForElementOptions?: WaitForElementOptions
) => Promise<HTMLElement> | Error
export const getByLabelText: GetByText
export const getAllByLabelText: AllByText
export const queryByLabelText: QueryByText
export const queryAllByLabelText: AllByText
export const findByLabelText: FindByText
export const findAllByLabelText: FindAllByText
export const getByPlaceholderText: GetByBoundAttribute
export const getAllByPlaceholderText: AllByBoundAttribute
export const queryByPlaceholderText: QueryByBoundAttribute
export const queryAllByPlaceholderText: AllByBoundAttribute
export const getByPlaceholderText: GetByBoundAttribute
export const getAllByPlaceholderText: AllByBoundAttribute
export const queryBySelectText: QueryByBoundAttribute
export const queryAllBySelectText: AllByBoundAttribute
export const getBySelectText: GetByBoundAttribute
export const getAllBySelectText: AllByBoundAttribute
export const findByPlaceholderText: FindByBoundAttribute
export const findAllByPlaceholderText: FindAllByBoundAttribute
export const getByText: GetByText
export const getAllByText: AllByText
export const queryByText: QueryByText
export const queryAllByText: AllByText
export const getByText: GetByText
export const getAllByText: AllByText
export const queryByLabelText: QueryByText
export const queryAllByLabelText: AllByText
export const getByLabelText: GetByText
export const getAllByLabelText: AllByText
export const findByText: FindByText
export const findAllByText: FindAllByText
export const getByAltText: GetByBoundAttribute
export const getAllByAltText: AllByBoundAttribute
export const queryByAltText: QueryByBoundAttribute
export const queryAllByAltText: AllByBoundAttribute
export const getByAltText: GetByBoundAttribute
export const getAllByAltText: AllByBoundAttribute
export const queryByTestId: QueryByBoundAttribute
export const queryAllByTestId: AllByBoundAttribute
export const getByTestId: GetByBoundAttribute
export const getAllByTestId: AllByBoundAttribute
export const findByAltText: FindByBoundAttribute
export const findAllByAltText: FindAllByBoundAttribute
export const getByTitle: GetByBoundAttribute
export const getAllByTitle: AllByBoundAttribute
export const queryByTitle: QueryByBoundAttribute
export const queryAllByTitle: AllByBoundAttribute
export const getByTitle: GetByBoundAttribute
export const getAllByTitle: AllByBoundAttribute
export const queryByValue: QueryByBoundAttribute
export const queryAllByValue: AllByBoundAttribute
export const getByValue: GetByBoundAttribute
export const getAllByValue: AllByBoundAttribute
export const findByTitle: FindByBoundAttribute
export const findAllByTitle: FindAllByBoundAttribute
export const getByDisplayValue: GetByBoundAttribute
export const getAllByDisplayValue: AllByBoundAttribute
export const queryByDisplayValue: QueryByBoundAttribute
export const queryAllByDisplayValue: AllByBoundAttribute
export const getByDisplayValue: GetByBoundAttribute
export const getAllByDisplayValue: AllByBoundAttribute
export const findByDisplayValue: FindByBoundAttribute
export const findAllByDisplayValue: FindAllByBoundAttribute
export const getByRole: GetByBoundAttribute
export const getAllByRole: AllByBoundAttribute
export const queryByRole: QueryByBoundAttribute
export const queryAllByRole: AllByBoundAttribute
export const getByRole: GetByBoundAttribute
export const getAllByRole: AllByBoundAttribute
export const findByRole: FindByBoundAttribute
export const findAllByRole: FindAllByBoundAttribute
export const getByTestId: GetByBoundAttribute
export const getAllByTestId: AllByBoundAttribute
export const queryByTestId: QueryByBoundAttribute
export const queryAllByTestId: AllByBoundAttribute
export const findByTestId: FindByBoundAttribute
export const findAllByTestId: FindAllByBoundAttribute
export const getBySelectText: GetByBoundAttribute
export const getAllBySelectText: AllByBoundAttribute
export const queryBySelectText: QueryByBoundAttribute
export const queryAllBySelectText: AllByBoundAttribute
export const getByValue: GetByBoundAttribute
export const getAllByValue: AllByBoundAttribute
export const queryByValue: QueryByBoundAttribute
export const queryAllByValue: AllByBoundAttribute

@@ -0,8 +1,10 @@

export interface WaitForElementOptions {
container?: HTMLElement
timeout?: number
mutationObserverOptions?: MutationObserverInit
}
export function waitForElement<T>(
callback: () => T,
options?: {
container?: HTMLElement
timeout?: number
mutationObserverOptions?: MutationObserverInit
},
options?: WaitForElementOptions,
): Promise<T>
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc