Salesforce Certified Platform Developer II — Question 111

A lead developer is creating tests for a Lightning web component. The component re-renders when a property called bypassSelection changes its value.

What should the developer use to test that the component re-renders successfully when the property changes?

Answer options

Correct answer: C

Explanation

The correct answer is C because using dispatchEvent with a CustomEvent allows the developer to simulate the change of the bypassSelection property, triggering the re-render of the component. Options A and B are not relevant as they do not pertain to testing property changes in the context of Lightning web components, while D does not directly test re-rendering behavior.