All files / molecule/field/src useTypeValidationLabel.js

84.61% Statements 11/13
85.71% Branches 12/14
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13    1x 13x 10x 10x 9x 8x 7x        
import {AtomLabelTypes} from '@s-ui/react-atom-label'
 
const useTypeValidationLabel = ({useContrastLabel, errorText, successText, alertText, disabled, status}) => {
  if (status && [AtomLabelTypes.SUCCESS, AtomLabelTypes.ERROR, AtomLabelTypes.ALERT].includes(status)) return status
  Iif (disabled) return AtomLabelTypes.DISABLED
  if (alertText) return AtomLabelTypes.ALERT
  if (successText) return AtomLabelTypes.SUCCESS
  if (errorText) return AtomLabelTypes.ERROR
  Iif (useContrastLabel) return AtomLabelTypes.CONTRAST
}
 
export default useTypeValidationLabel