Exam Plat-Dev-301 Topic 1 Question 188 Discussion
Actual exam question for Salesforce's Plat-Dev-301 exam
Question #: 188
Topic #: 1
Question #: 188
Topic #: 1
A developer is writing a Jest test for a Lightning web component that conditionally displays child components based on a user's checkbox selections.
What should the developer do to properly test that the correct components display and hide for each scenario?
What should the developer do to properly test that the correct components display and hide for each scenario?
Suggested Answer: B Vote an answer
To ensure that the DOM is clean before each test runs, the developer should use the afterEach() method to reset it. This is part of the setup and teardown process in Jest tests, which helps to avoid state leakage between tests. Reference:
Jest Globals afterEach
Jest Globals afterEach
by Abraham at Jul 24, 2026, 10:57 PM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).