def test_html_render_action7(): """ XHTML namespace unit test - asynchronous render - action - put action method on tag imagge """ h = xhtml.AsyncRenderer(static_url='/tmp/static/') h.start_rendering(component.Component(None), None) with h.html: with h.body: a = h.img().action(lambda x: None) h << a assert a.attrib['src'] is not None
def test_html_render_action8(): """ XHTML namespace unit test - asynchronous render - action - put action method on tag a (replace existing href) """ h = xhtml.AsyncRenderer(static_url='/tmp/static/') h.start_rendering(component.Component(None), None) with h.html: with h.body: a = h.a(src="logo.gif").action(lambda x: None) h << a assert a.attrib['src'] != 'http://www.google.com'
def render(self, h, *args): tmpl = template("main", h) if self.model() == "login": cdiv = h.div(id="content") with cdiv: h << self.loginManager elif self.model() == "game": cdiv = h.div(id="content") with cdiv: h << self.playerBox h << self.playerBox.render(xhtml.AsyncRenderer(h), model="wordbag") h << self.spellInput.render(h) h << self.roomDisplay h << self.eventlog h << h.div(self.roomDisplay.render(h, model="map"), style="position:absolute; right: 0; top: 0;") tmpl.findmeld("content").replace(cdiv) h << tmpl return h.root