all files / src/datums/ label.cjsx

93.75% Statements 15/16
75% Branches 3/4
100% Functions 4/4
93.33% Lines 14/15
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                                              24× 15×          
 
React = require('react')
_ = require('underscore')
 
Text = require('./text')
 
 
###
  see ./label.md
###
module.exports = class Label extends Text
  @displayName: "react-datum.Label"
 
  render: ->
    super    # for breakpoint debugging
 
 
  renderValueForDisplay: ->
    superVal = super
    
    labelProps = {
      style: @props.style
    }
    tooltip = @getPropOrMetadata('tooltip')
      
    label = Eif superVal?
      @renderWithPopover(<label {... labelProps}>{superVal}</label>, tooltip, 'datumLabelTooltip', 'datum-tooltip')
    else
      null
    
    return label
    
    
  getModelValue: (newProps = @props, newContext = @context) ->
    if newProps.children?
      return newProps.children
    
    return super