Add pending indication to all of Vest's APIs #1067
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Can be tested by:
Add pending indication to the following:
Result Object:
isPending selector
Returns whether the suite, or a specific field are pending or not. A suite is considered pending if it has unresolved async tests.
Returns
true
if the suite is pending,false
otherwise.classnames
import classnames from 'vest/classnames'; import suite from './suite'; const res = suite(data); const cn = classnames(res, { untested: 'is-untested', // will only be applied if the provided field did not run yet tested: 'some-tested-class', // will only be applied if the provided field did run invalid: 'my_invalid_class', // will only be applied if the provided field ran at least once and has an error valid: 'my_valid_class', // will only be applied if the provided field ran at least once does not have errors or warnings warning: 'my_warning_class', // will only be applied if the provided field ran at least once and has a warning + pending: 'my_pending_class', // will only be applied if the provided field has pending async tests }); const fieldOneClasses = cn('field_1'); // "is-untested" const fieldTwoClasses = cn('field_2'); // "some-tested-class my_invalid_class"