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)
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