def test_label(self): c = basic.Label('a') self.assert_is_none(c.model) elem = c.render(markup.Element(None)) self.assert_equal(elem.attrib, {}) self.assert_equal(elem.children, [''])
def test_label_with_string(self): with self.application(): c = basic.Label('a', '<tag>') self.assert_equal(c.model.object, '<tag>') elem = c.render(markup.Element(None)) self.assert_equal(elem.attrib, {}) self.assert_equal(elem.children, ['<tag>'])
def test_label_with_string_model(self): with self.application(): m = model.Model('<tag>') c = basic.Label('a', m) self.assert_is(c.model, m) elem = c.render(markup.Element(None)) self.assert_equal(elem.attrib, {}) self.assert_equal(elem.children, ['<tag>'])
def test_label_with_object_model(self): with self.application(): m = model.Model([]) c = basic.Label('a', m) self.assert_is(c.model, m) elem = c.render(markup.Element(None)) self.assert_equal(elem.attrib, {}) self.assert_equal(elem.children, ['[]'])
def __init__(self, id, model=None): super(Border, self).__init__(id, model) self.add(basic.Label('class', self.__class__.__name__)) self.body.find('class').render_body_only = True
def populate_item(li): li.add(basic.Label('c', li.model.object))
def populate_item(li): li.add(basic.Label('c', li.model.object)) li.find('c').render_body_only = True