Exemplo n.º 1
0
 def test_markup_when_empty(self):
     html = HTML()
     with html:
         Head()
         Body()
     self.assertEqual(
         dedent(
             """\
             """
         ),
         html.markup(width=80)
     )
Exemplo n.º 2
0
 def test_markup_when_first_child_is_script(self):
     html = HTML()
     with html:
         with Head():
             Title('Hello')
         with Body():
             Script(src='foo.js')
     self.assertEqual(
         dedent(
             """\
             <title>Hello</title>
             <body>
                 <script src=foo.js></script>
             """
         ),
         html.markup(width=80)
     )
Exemplo n.º 3
0
 def test_markup(self):
     html = HTML()
     with html:
         with Head():
             Title('Hello')
         with Body():
             Div()
     self.assertEqual(
         dedent(
             """\
             <title>Hello</title>
             <div>
             </div>
             """
         ),
         html.markup(width=80)
     )
Exemplo n.º 4
0
 def test_markup_when_followed_by_comment(self):
     html = HTML()
     with html:
         with Head():
             Title('Hello')
         Comment('foobar')
     self.assertEqual(
         dedent(
             """\
             <head>
                 <title>Hello</title>
             </head>
             <!-- foobar -->
             """
         ),
         html.markup(width=80)
     )
Exemplo n.º 5
0
 def test_markup_when_first_child_is_comment(self):
     html = HTML()
     with html:
         with Head():
             Title('Hello')
         with Body():
             Comment('foobar')
             Div()
     self.assertEqual(
         dedent(
             """\
             <title>Hello</title>
             <body>
                 <!-- foobar -->
                 <div>
                 </div>
             """
         ),
         html.markup(width=80)
     )
Exemplo n.º 6
0
 def test_markup(self):
     document = Document()
     with document:
         DocType()
         HTML()
         Comment('a comment')
     self.assertEqual(
         dedent("""\
             <!doctype html>
             <html>
             </html>
             <!-- a comment -->
             """), document.markup(width=80))
Exemplo n.º 7
0
 def test_markup_when_first_child_is_a_comment(self):
     document = Document()
     with document:
         with HTML():
             Comment('foobar')
             with Head():
                 Title('Hello')
             Body()
     self.assertEqual(
         dedent(
             """\
             <html>
             <!-- foobar -->
             <title>Hello</title>
             """
         ),
         document.markup(width=80)
     )