diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-12-14 15:15:05 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-12-14 15:15:05 +0000 |
| commit | 841de73928538038496f15467aba9001b47a2d9c (patch) | |
| tree | e49be2abcffebe693e74ab3f8157414b978a8ea8 /tests/html_generation_tests.py | |
| parent | 14ca5c4d6993806b568ba5a9befb81326d9ed806 (diff) | |
Add appending of other HTML generators
Diffstat (limited to 'tests/html_generation_tests.py')
| -rw-r--r-- | tests/html_generation_tests.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/html_generation_tests.py b/tests/html_generation_tests.py index fac6f05..f32b713 100644 --- a/tests/html_generation_tests.py +++ b/tests/html_generation_tests.py @@ -73,3 +73,21 @@ def opening_tag_can_have_attributes(): generator.text("Hello!") generator.end() assert_equal('<p data-blah="42">Hello!</p>', generator.html_string()) + + +@istest +def appending_another_html_generator_does_nothing_if_empty(): + generator = HtmlGenerator() + generator.start("p") + generator.append(HtmlGenerator()) + assert_equal('', generator.html_string()) + + +@istest +def appending_another_html_generator_writes_out_elements_if_other_generator_is_not_empty(): + generator = HtmlGenerator() + generator.start("p") + other = HtmlGenerator() + other.text("Hello!") + generator.append(other) + assert_equal('<p>Hello!', generator.html_string()) |
