def test_dl_component_tooltip_no_data(self): self.assertEqual(dl_component_tooltip({}, "VOLUME_Q1", value=VOLUME), VOLUME) self.assertEqual( dl_component_tooltip( {'differences': { 'components_initial_data': {} }}, "VOLUME_Q1", value=VOLUME), VOLUME)
def test_dl_component_tooltip(self): lcy = LearningComponentYearFactory( hourly_volume_partial_q1=OTHER_VOLUME) context = { 'components_initial_data': { 'components': [ { 'learning_component_year': { 'id': lcy.id, 'hourly_volume_partial_q1': lcy.hourly_volume_partial_q1 }, 'volumes': { 'VOLUME_Q1': OTHER_VOLUME } }, ] } } expected_html = "<dl><dd data-toggle=tooltip title='{} : {}' class='{}' id='id_volume_q1'><p style='' " \ "title=''>{}</p></dd></dl>". \ format(LABEL_VALUE_BEFORE_PROPOSAL, OTHER_VOLUME, CSS_PROPOSAL_VALUE, VOLUME) self.assertEqual( dl_component_tooltip({'differences': context}, "VOLUME_Q1", value=VOLUME, id=lcy.id), expected_html)