def _table_head( treename: str, id_: str, isopen: bool, title: str, show_more_toggle: bool, help_text: Union[str, HTML, None] = None, ) -> None: onclick = foldable_container_onclick(treename, id_, fetch_url=None) img_id = foldable_container_img_id(treename, id_) html.open_thead() html.open_tr(class_="heading") html.open_td(id_="nform.%s.%s" % (treename, id_), onclick=onclick, colspan=2) html.img( id_=img_id, class_=["treeangle", "nform", "open" if isopen else "closed"], src=theme.url("images/tree_closed.svg"), align="absbottom", ) html.write_text(title) html.help(help_text) if show_more_toggle: html.more_button("foldable_" + id_, dom_levels_up=4, with_text=True) html.close_td() html.close_tr() html.close_thead()
def test_foldable_container_onclick_without_url() -> None: assert foldable_container_onclick( "name", "id", None) == 'cmk.foldable_container.toggle("name", "id", "")'
def test_foldable_container_onclick_with_url() -> None: assert foldable_container_onclick( "name", "id", "http://bla" ) == 'cmk.foldable_container.toggle("name", "id", "http:\\/\\/bla")'
def test_foldable_container_onclick_no_save() -> None: assert (foldable_container_onclick( "name", "id", None, False) == 'cmk.foldable_container.toggle("name", "id", "", false)')