Update checks to use `testutils.getCheckEvaluate` helper to prevent not having needed messages
There are several checks which can return a state that the check does not have a message for. This was identified in https://github.com/dequelabs/axe-core/pull/5367:
Seven checks return undefined with no incomplete message:
label-content-name-mismatch,listitem,only-dlitems,only-listitems,important-letter-spacing,important-line-height,important-word-spacing.
The testutils file has a helper function getCheckEvaluate which validating that the check has a message that corresponds to the return type. We should update all our check tests to use this helper to ensure that we don't allow checks to not have messages.
- const check = checks['label-content-name-mismatch'];
+ const labelContentNameMismatchEvaluate = testutils.getCheckEvaluate('label-content-name-mismatch');
- check.evaluate(vNode.actualNode, options, vNode)
+ labelContentNameMismatchEvaluate(vNode.actualNode, options, vNode);We'll also need to make sure that each check has a test to check for undefined (listitem uses getCheckEvaluate but does not have a test for undefined).
Source: dequelabs/axe-core