Example #1
0
    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, [''])
Example #2
0
    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, ['&lt;tag&gt;'])
Example #3
0
    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, ['&lt;tag&gt;'])
Example #4
0
    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, ['[]'])
Example #5
0
 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
Example #6
0
 def populate_item(li):
     li.add(basic.Label('c', li.model.object))
Example #7
0
 def populate_item(li):
     li.add(basic.Label('c', li.model.object))
     li.find('c').render_body_only = True