aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-12-14 15:15:05 +0000
committerMichael Williamson <mike@zwobble.org>2013-12-14 15:15:05 +0000
commit841de73928538038496f15467aba9001b47a2d9c (patch)
treee49be2abcffebe693e74ab3f8157414b978a8ea8 /tests
parent14ca5c4d6993806b568ba5a9befb81326d9ed806 (diff)
Add appending of other HTML generators
Diffstat (limited to 'tests')
-rw-r--r--tests/html_generation_tests.py18
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())