All files / molecule/inputTags/src config.js

100% Statements 16/16
75% Branches 3/4
100% Functions 5/5
100% Lines 14/14

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 211x 1x 1x 1x 1x 1x 1x   1x 6x 3x     23x     1x 54x 7x    
export const BASE_CLASS = 'sui-AtomInput'
export const BASE_CLASS_TAG = 'sui-AtomTag'
export const BASE_CLASS_TAG_CONTAINER = `${BASE_CLASS_TAG}_Container`
export const CLASS_TAGS = `${BASE_CLASS}--withTags`
export const CLASS_TAGS_ERROR = `${CLASS_TAGS}--error`
export const CLASS_TAGS_SUCCESS = `${CLASS_TAGS}--success`
export const CLASS_TAGS_DISABLED = `${CLASS_TAGS}--disabled`
 
export const isDuplicate = (values, newValue) => {
  const upperTags = values.map(val => (typeof val === 'object' ? val.label.toUpperCase() : val.toUpperCase()))
  return upperTags.includes(newValue.toUpperCase())
}
 
export const isFunction = fn => typeof fn === 'function'
 
export const handleOnFocusBlur =
  (handler, {...args}) =>
  ev => {
    isFunction(handler) && handler(ev, {...args})
  }