Skip to content

Commit 0ae6dd0

Browse files
committed
chore: migrate other use-cases to use getTextInputValue
1 parent 9de3717 commit 0ae6dd0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/queries/__tests__/display-value.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ const Banana = () => (
3030

3131
test('getByDisplayValue, queryByDisplayValue', () => {
3232
render(<Banana />);
33-
const input = screen.getByDisplayValue(/custom/i);
3433

34+
const input = screen.getByDisplayValue(/custom/i);
3535
expect(input).toHaveDisplayValue(INPUT_FRESHNESS);
3636

3737
const sameInput = screen.getByDisplayValue(INPUT_FRESHNESS);
38-
3938
expect(sameInput).toHaveDisplayValue(INPUT_FRESHNESS);
4039
expect(() => screen.getByDisplayValue('no value')).toThrow(
4140
'Unable to find an element with displayValue: no value',

src/user-event/type/type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export async function type(
4747

4848
let currentText = getTextInputValue(element);
4949
for (const key of keys) {
50-
const previousText = element.props.value ?? currentText;
50+
const previousText = getTextInputValue(element);
5151
const proposedText = applyKey(previousText, key);
5252
const isAccepted = isTextChangeAccepted(element, proposedText);
5353
currentText = isAccepted ? proposedText : previousText;
@@ -60,7 +60,7 @@ export async function type(
6060
});
6161
}
6262

63-
const finalText = element.props.value ?? currentText;
63+
const finalText = getTextInputValue(element);
6464
await wait(this.config);
6565

6666
if (options?.submitEditing) {

0 commit comments

Comments
 (0)