Exemplo n.º 1
0
def test_cache_dom():
    dom = Observable()
    dom.uuid = 'dom'
    vdom.cache_dom(dom)
    assert vdom.get_dom(dom.uuid) == dom
    dom.trigger('unmounted')
    with raises(Exception):
        assert vdom.get_dom(dom.uuid)
Exemplo n.º 2
0
def test_mount_tag():
    root = PyQuery('<root></root>')
    tag = {'name': 'custom', 'html': '<custom><text>{opts.txt}</text></custom>'}
    dom = vdom.mount_tag(root, tag, {'txt': 'hello world'})
    assert dom and dom.uuid # dom created
    assert vdom.get_dom(dom.uuid) # dom cached
    assert root.html() # mounted something