All files / molecule/badgeCounter/src config.js

77.77% Statements 21/27
25% Branches 3/12
100% Functions 2/2
80% Lines 20/25

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 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 551x 1x   1x 1x   1x 1x 1x   1x 1x   1x 1x   1x           1x           1x           1x   1x 5x 5x                   1x 5x          
export const BASE_CLASS = `sui-MoleculeBadgeCounter`
export const CLASS_WITH_CHILDREN = `${BASE_CLASS}--withChildren`
 
export const CLASS_BULLET = `${BASE_CLASS}-bullet`
export const CLASS_BULLET_WITH_CHILDREN = `${CLASS_BULLET}--withChildren`
 
export const CLASS_SMALL = `${CLASS_BULLET}-small`
export const CLASS_MEDIUM = `${CLASS_BULLET}-medium`
export const CLASS_LARGE = `${CLASS_BULLET}-large`
 
export const CLASS_DISABLED = 'is-disabled'
export const CLASS_SELECTED = 'is-selected'
 
export const CLASS_MEDIUM_THREE_CHARS = `${CLASS_MEDIUM}--threeCharacters`
export const CLASS_LARGE_THREE_CHARS = `${CLASS_LARGE}--threeCharacters`
 
export const SIZES = {
  SMALL: 'small',
  MEDIUM: 'medium',
  LARGE: 'large'
}
 
export const STATUS = {
  DEFAULT: 'default',
  DISABLED: 'disabled',
  SELECTED: 'selected'
}
 
export const VARIANTS = {
  DOT: 'dot',
  EXCLAMATION: 'exclamation',
  EXTENDED: 'extended'
}
 
export const MAX_LABEL = 99
 
export const getClassSize = ({size, hasLabel}) => {
  Eif (size !== SIZES.SMALL) {
    return {
      [SIZES.MEDIUM]: CLASS_MEDIUM,
      [SIZES.LARGE]: CLASS_LARGE
    }[size]
  } else if (hasLabel && size === SIZES.SMALL) {
    return CLASS_MEDIUM
  }
  return CLASS_SMALL
}
 
export const getClassLengthLabel = ({hasLabel, label, size}) => {
  Eif (!hasLabel || (label + '').length < 3) return ''
 
  if (size === SIZES.MEDIUM) return CLASS_MEDIUM_THREE_CHARS
  return CLASS_LARGE_THREE_CHARS
}