Skip to content

Commit

Permalink
TransientFragment test
Browse files Browse the repository at this point in the history
  • Loading branch information
boxed committed Oct 9, 2024
1 parent 8dace21 commit 0889d0f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion iommi/fragment__tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
)
from iommi.attrs import Attrs
from iommi.evaluate import evaluate_strict
from iommi.fragment import fragment__render
from iommi.fragment import (
fragment__render,
TransientFragment,
)
from iommi.struct import Struct
from tests.helpers import (
req,
verify_part_html,
Expand Down Expand Up @@ -363,3 +367,14 @@ def side_effect(func_or_value, __signature=None, __match_empty=True, **kwargs):
verify_part_html(part=part, expected_html='<p> This is static Not so static </p>')

assert next(counter) == 1


def test_transient_fragment():
assert TransientFragment(
tag='div',
attrs__class__foo=True,
attrs__bar='baz',
attrs__style__display='block',
parent=Struct(get_context=lambda: {}, iommi_evaluate_parameters=lambda: {}, get_request=lambda: None),
children={},
).__html__() == '<div bar="baz" class="foo" style="display: block"></div>'

0 comments on commit 0889d0f

Please sign in to comment.