def test_render_element_simple(): tag = render_element("a", "content", href="ding") assert isinstance(tag, HTML) assert str(tag) == '<a href="ding">content</a>'
def test_render_element_escape_content(): tag = render_element("a", "b<script>alert(1)</script>la", href="ding") assert isinstance(tag, HTML) assert str( tag) == '<a href="ding">b<script>alert(1)</script>la</a>'
def test_render_element_do_not_escape_html(): tag = render_element("a", HTML("b<script>alert(1)</script>la"), href="ding") assert isinstance(tag, HTML) assert str(tag) == '<a href="ding">b<script>alert(1)</script>la</a>'
def test_render_element_none_content(): tag = render_element("a", None, href="ding") assert isinstance(tag, HTML) assert str(tag) == '<a href="ding"></a>'