You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exercises/03.best-practices/04.problem.element-presence/README.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# Element presence
2
2
3
-
So far you've been finding and interacting with the elements that are either already present on the page or expected to eventually appear. But what about the cases when you need to check the opposite? That a certain UI element _did not_ render?
3
+
So far we've covered finding and interacting with elements that are present or will appear on the page. But how do we test for elements that should _not_ render?
4
4
5
-
This is where you would normally reach out to an [inverse assertion](https://www.epicweb.dev/inverse-assertions) to get a predictable result and guard yourself from false-positive tests:
5
+
This is where you would normally reach for an [inverse assertion](https://www.epicweb.dev/inverse-assertions) to get a predictable result and guard yourself from false-positive tests:
**However, there's a more convenient way to do this in Vitest!**
25
25
26
-
👨💼 In this exercise, you will utilize the retry-ability of Vitest's `expect.element()` function to assert that the discount code has been removed from the UI once you click the respective button. Go to the <InlineFilefile="./src/discount-code-form.browser.test.tsx">`discount-code-form.browser.test.tsx`</InlineFile> test suite and follow the instructions to complete a new test case.
26
+
👨💼 In this exercise, you will use the retry-ability of Vitest's `expect.element()` function to assert that the discount code has been removed from the UI once you click the respective button. Go to the <InlineFilefile="./src/discount-code-form.browser.test.tsx">`discount-code-form.browser.test.tsx`</InlineFile> test suite and follow the instructions to complete the new test case.
0 commit comments