How to use the idom.vdom function in idom

To help you get started, we’ve selected a few idom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rmorshea / idom / tests / test_core / test_element.py View on Github external
async def simple_param_element(self, tag):
        return idom.vdom(tag)
github rmorshea / idom / tests / test_core / test_vdom.py View on Github external
            idom.vdom("div", [idom.vdom("div"), 1], (idom.vdom("div"), 2)),
            {
                "tagName": "div",
                "children": [{"tagName": "div"}, 1, {"tagName": "div"}, 2],
            },
        ),
        (
            # multiple dictionaries of attributes are merged
            idom.vdom("div", {"width": "30px"}, {"height": "20px"}),
            {"tagName": "div", "attributes": {"width": "30px", "height": "20px"}},
        ),
        (
            idom.vdom(
                "div",
                {"width": "30px"},
                {"height": "20px"},
                [idom.vdom("div"), 1],
github rmorshea / idom / tests / test_core / test_layout.py View on Github external
async def SimpleElement(self, tag):
        return idom.vdom(tag)
github rmorshea / idom / tests / test_core / test_vdom.py View on Github external
            idom.vdom("div", map(lambda x: x ** 2, [1, 2, 3])),
            {"tagName": "div", "children": [1, 4, 9]},
        ),
    ],
)
def test_simple_node_construction(actual, expected):
    assert actual == expected
github rmorshea / idom / tests / test_core / test_element.py View on Github external
async def simple_stateful_element(self, tag):
        return idom.vdom(tag)
github rmorshea / idom / tests / test_core / test_vdom.py View on Github external
            idom.vdom("div", event_handlers=fake_events),
            {"tagName": "div", "eventHandlers": fake_events},
        ),
        (
            idom.vdom("div", idom.html.h1("hello"), idom.html.h2("world")),
            {
                "tagName": "div",
                "children": [
                    {"tagName": "h1", "children": ["hello"]},
                    {"tagName": "h2", "children": ["world"]},
                ],
            },
        ),
        (
            idom.vdom("div", {"tagName": "div"}),
            {"tagName": "div", "children": [{"tagName": "div"}]},
        ),
github rmorshea / idom / tests / test_core / test_vdom.py View on Github external
def test_vdom_attribute_arguments_come_before_children():
    with pytest.raises(ValueError):
        idom.vdom("div", ["c1", "c2"], {"attr": 1})
github rmorshea / idom / tests / test_core / test_vdom.py View on Github external
            idom.vdom("div", {"width": "30px"}, {"height": "20px"}),
            {"tagName": "div", "attributes": {"width": "30px", "height": "20px"}},
        ),
        (
            idom.vdom(
                "div",
                {"width": "30px"},
                {"height": "20px"},
                [idom.vdom("div"), 1],
                (idom.vdom("div"), 2),
            ),
            {
                "tagName": "div",
                "children": [{"tagName": "div"}, 1, {"tagName": "div"}, 2],
                "attributes": {"width": "30px", "height": "20px"},
            },
        ),
github rmorshea / idom / tests / test_core / test_vdom.py View on Github external
            idom.vdom("div", idom.html.h1("hello"), idom.html.h2("world")),
            {
                "tagName": "div",
                "children": [
                    {"tagName": "h1", "children": ["hello"]},
                    {"tagName": "h2", "children": ["world"]},
                ],
            },
        ),
        (
            idom.vdom("div", {"tagName": "div"}),
            {"tagName": "div", "children": [{"tagName": "div"}]},
        ),
        (
            idom.vdom("div", (i for i in range(3))),
            {"tagName": "div", "children": [0, 1, 2]},
        ),