def test_basic(): output = '<a href="test">hey there</a>' assert str(html.a(href='test')('hey there')) == output assert str(html.a('hey there')(href='test')) == output assert str(html.a(href='test', c='hey there')) == output assert str(html.a('hey there', href='test')) == output assert str(html.a(href='test')('hey ', 'there')) == output assert str(html.a(href='test')(['hey ', 'there'])) == output
def test_basic(): output = '<a href="test">hey there</a>' assert str(html.a(href="test")("hey there")) == output assert str(html.a("hey there")(href="test")) == output assert str(html.a(href="test", c="hey there")) == output assert str(html.a("hey there", href="test")) == output assert str(html.a(href="test")("hey ", "there")) == output assert str(html.a(href="test")(["hey ", "there"])) == output
def __init__(self, header='BaseMenu', **args): super(BaseMenu, self).__init__(**args) super(BaseMenu, self).set('class', 'ctx-menu nav navbar-nav') self._menu = {} # setup dropdown menu and header anchor self.dropdown = html.li() self.dropdown.set('class', 'dropdown') self.header_anchor = html.a(header, class_='dropdown-toggle') self.header_anchor.set('data-toggle', 'dropdown') # we append a caret to the end of the header # to demonstrate that this is a dropdown menu caret = html.b(' ', class_="caret") # append the objects self.header_anchor.append(caret) self.append(self.dropdown) self.dropdown.append(self.header_anchor) # create and append the menu container self.menu_list = UL() self.menu_list.set('class', 'dropdown-menu') self.dropdown.append(self.menu_list)
def append_new_entry(self, name, page): self._menu[name] = html.a(name, href=page) li = html.li(self._menu[name]) self.menu_list.append(li)