Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 95cc445

Browse files
fix: allow multiple calling of updateProps (#170)
* Changed updateProps to return the Promise created from wrapper.setProps. * Updated the `updateProps` test to make sure the function can be called multiple times without producing errors.
1 parent dbcf740 commit 95cc445

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

‎src/__tests__/update-props.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ test('calling render with the same component but different props does not remoun
1414
expect(getByTestId('number-display')).toHaveTextContent('1')
1515

1616
await updateProps({number: 2})
17-
1817
expect(getByTestId('number-display')).toHaveTextContent('2')
1918

19+
await updateProps({number: 3})
20+
expect(getByTestId('number-display')).toHaveTextContent('3')
21+
2022
// Assert that, even after updating props, the component hasn't remounted,
2123
// meaning we are testing the same component instance we rendered initially.
2224
expect(getByTestId('instance-id')).toHaveTextContent('1')

‎src/vue-testing-library.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ function render(
8080
isUnmounted: () => wrapper.vm._isDestroyed,
8181
html: () => wrapper.html(),
8282
emitted: () => wrapper.emitted(),
83-
updateProps: _ => {
84-
wrapper.setProps(_)
85-
return waitFor(() => {})
86-
},
83+
updateProps: _ => wrapper.setProps(_),
8784
...getQueriesForElement(baseElement),
8885
}
8986
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /