Ticket #1444: empty_async.py

File empty_async.py, 763 bytes (added by bertrand.croq, 7 years ago)

test case

Line 
1from nagare import component, presentation
2
3
4class App:
5    pass
6
7
8@presentation.render_for(App)
9def render(self, h, *args):
10    # create an async root component and renders it with an AsyncRenderer
11    h << component.Component(self, 'async').render(h.AsyncRenderer())
12    return h.root
13
14@presentation.render_for(App, 'async')
15def render(self, h, comp, *args):
16    # register an action whose rendering returns no HTML, only javascript
17    h << h.a('click here').action(lambda: comp.becomes(self, 'empty'))
18    return h.root
19
20
21@presentation.render_for(App, 'empty')
22def render(self, h, *args):
23    # should display an alert box... instead, the browser fails in
24    # nagare_replaceNode because there is no HTML
25    h << h.script('alert("plop")')
26    return h.root