From 30f4ebc42933cd5a54da7f0ddac39596a1a56859 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Sun, 4 Feb 2024 10:43:10 -0800 Subject: [PATCH] Add test coverage for vbml.Component --- tests/test_vbml.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/test_vbml.py diff --git a/tests/test_vbml.py b/tests/test_vbml.py new file mode 100644 index 0000000..ff4bc15 --- /dev/null +++ b/tests/test_vbml.py @@ -0,0 +1,40 @@ +from vesta.vbml import Component + + +class TestComponent: + def test_template(self): + assert Component("template").asdict() == {"template": "template"} + + def test_style(self): + assert Component("template", style={}).asdict() == {"template": "template"} + assert Component( + "template", + style={"height": 4, "width": 10, "justify": "left", "align": "top"}, + ).asdict() == { + "template": "template", + "style": {"height": 4, "width": 10, "justify": "left", "align": "top"}, + } + + def test_height(self): + assert Component("template", height=4).asdict() == { + "template": "template", + "style": {"height": 4}, + } + + def test_width(self): + assert Component("template", width=10).asdict() == { + "template": "template", + "style": {"width": 10}, + } + + def test_justify(self): + assert Component("template", justify="left").asdict() == { + "template": "template", + "style": {"justify": "left"}, + } + + def test_align(self): + assert Component("template", align="top").asdict() == { + "template": "template", + "style": {"align": "top"}, + }