Closed
Description
DOM Testing Library
version: 6.12.0node
version: 10.11.0npm
(oryarn
) version: 6.4.1
Relevant code:
import React from 'react';
import { render } from '@testing-library/react';
import { getByDisplayValue } from '@testing-library/dom';
describe('test', () => {
test('test', () => {
const { getByDisplayValue } = render(
<select value="2" onChange={() => {}}>
<option value="1">one</option>
<option value="2">two</option>
</select>
);
getByDisplayValue("2");
});
});
What happened:
After executing this test, the warning message is "Unable to find an element with the value: 2."
Reproduction:
https://github.com/xgbuils/select-issue-rtl
Problem description:
As suggested @eps1lon in this issue, the warning message is quite misleading.
Suggested solution:
Show the message: "with the display value:"
Instead of: "with the value:"