def test_string_namespaced_attributes(self):
     bs_elt = DOMString.create_tag("svg")
     DOMString.append_child(
         bs_elt, DOMString.create_tag("use", {"xlink:href": "test"}))
     self.assertEqual(
         DOMString.render_debug(bs_elt),
         '<svg><use xlink:href="test"></use></svg>',
     )
 def test_render_children(self):
     self.assertEqual(
         DOMString.render_children([
             "render children",
             DOMString.create_tag("p", {"class": "intro"}),
             "test test",
         ]),
         'render children<p class="intro"></p>test test',
     )
 def test_render_attrs(self):
     self.assertEqual(
         DOMString.render_attrs({
             "alt": "img's alt",
             "class": "intro",
             "src": "src.png"
         }),
         ' alt="img&#x27;s alt" class="intro" src="src.png"',
     )
Ejemplo n.º 4
0
 def test_append_child_identical_elements(self):
     parent = DOMString.create_tag('p')
     DOMString.append_child(parent, DOMString.create_tag('br'))
     DOMString.append_child(parent, DOMString.create_tag('br'))
     self.assertEqual(DOMString.render_debug(parent), '<p><br/><br/></p>')
Ejemplo n.º 5
0
 def test_render_children(self):
     self.assertEqual(DOMString.render_children([
         'render children',
         DOMString.create_tag('p', {'class': 'intro'}),
         'test test',
     ]), 'render children<p class="intro"></p>test test')
Ejemplo n.º 6
0
 def test_create_tag_empty(self):
     self.assertEqual(DOMString.render_debug(DOMString.create_tag('p')), '<p></p>')
Ejemplo n.º 7
0
 def test_append_child(self):
     parent = DOMString.create_tag('p')
     DOMString.append_child(parent, DOMString.create_tag('span', {}))
     self.assertEqual(DOMString.render_debug(parent), '<p><span></span></p>')
 def test_create_tag(self):
     self.assertEqual(DOMString.render_debug(DOMString.create_tag('p', {'class': 'intro'})), '<p class="intro"></p>')
 def test_string_html_parsing(self):
     self.assertEqual(DOMString.render_debug(DOMString.parse_html('<p>Invalid > " &</p>')), '<p>Invalid > " &</p>')
 def test_append_child(self):
     parent = DOMString.create_tag("p")
     DOMString.append_child(parent, DOMString.create_tag("span", {}))
     self.assertEqual(DOMString.render_debug(parent),
                      "<p><span></span></p>")
 def test_render_attrs(self):
     self.assertEqual(DOMString.render_attrs({
         'src': 'src.png',
         'alt': 'img\'s alt',
         'class': 'intro',
     }), ' alt="img&#x27;s alt" class="intro" src="src.png"')
Ejemplo n.º 12
0
 def test_string_html_escaping(self):
     self.assertEqual(
         DOMString.render_debug(
             DOMString.create_tag('img', {
                 'alt': '< " \' < > &',
             })), '<img alt="&lt; &quot; &#x27; &lt; &gt; &amp;"/>')
 def test_create_tag_empty(self):
     self.assertEqual(DOMString.render_debug(DOMString.create_tag("p")),
                      "<p></p>")
Ejemplo n.º 14
0
 def test_string_namespaced_attributes(self):
     bs_elt = DOMString.create_tag('svg')
     DOMString.append_child(
         bs_elt, DOMString.create_tag('use', {'xlink:href': 'test'}))
     self.assertEqual(DOMString.render_debug(bs_elt),
                      '<svg><use xlink:href="test"></use></svg>')
Ejemplo n.º 15
0
 def test_string_invalid_attributes(self):
     self.assertEqual(
         DOMString.render_debug(
             DOMString.create_tag('div', {'*ngFor': 'test'})),
         '<div *ngFor="test"></div>')
Ejemplo n.º 16
0
 def test_string_self_closing_tags(self):
     self.assertEqual(DOMString.render_debug(DOMString.create_tag('hr')),
                      '<hr/>')
 def test_string_invalid_attributes(self):
     self.assertEqual(DOMString.render_debug(DOMString.create_tag('div', {'*ngFor': 'test'})), '<div *ngFor="test"></div>')
 def test_append_child_identical_text(self):
     parent = DOMString.create_tag("p")
     DOMString.append_child(parent, DOMString.parse_html("test"))
     DOMString.append_child(parent, DOMString.parse_html("test"))
     self.assertEqual(DOMString.render_debug(parent), "<p>testtest</p>")
 def test_append_child_identical_elements(self):
     parent = DOMString.create_tag('p')
     DOMString.append_child(parent, DOMString.create_tag('br'))
     DOMString.append_child(parent, DOMString.create_tag('br'))
     self.assertEqual(DOMString.render_debug(parent), '<p><br/><br/></p>')
 def test_string_self_closing_tags(self):
     self.assertEqual(DOMString.render_debug(DOMString.create_tag("hr")),
                      "<hr/>")
 def test_render_children(self):
     self.assertEqual(DOMString.render_children([
         'render children',
         DOMString.create_tag('p', {'class': 'intro'}),
         'test test',
     ]), 'render children<p class="intro"></p>test test')
 def test_string_namespaced_attributes(self):
     bs_elt = DOMString.create_tag('svg')
     DOMString.append_child(bs_elt, DOMString.create_tag('use', {'xlink:href': 'test'}))
     self.assertEqual(DOMString.render_debug(bs_elt), '<svg><use xlink:href="test"></use></svg>')
 def test_string_html_parsing(self):
     self.assertEqual(
         DOMString.render_debug(
             DOMString.parse_html('<p>Invalid > " &</p>')),
         '<p>Invalid > " &</p>',
     )
 def test_string_html_escaping(self):
     self.assertEqual(DOMString.render_debug(DOMString.create_tag('img', {
         'alt': '< " \' < > &',
     })), '<img alt="&lt; &quot; &#x27; &lt; &gt; &amp;"/>')
 def test_string_invalid_attributes(self):
     self.assertEqual(
         DOMString.render_debug(
             DOMString.create_tag("div", {"*ngFor": "test"})),
         '<div *ngFor="test"></div>',
     )
 def test_render_debug(self):
     self.assertEqual(
         DOMString.render_debug(
             DOMString.create_tag("p", {"class": "intro"})),
         '<p class="intro"></p>',
     )
 def test_string_html_escaping(self):
     self.assertEqual(
         DOMString.render_debug(
             DOMString.create_tag("img", {"alt": "< \" ' < > &"})),
         '<img alt="&lt; &quot; &#x27; &lt; &gt; &amp;"/>',
     )
 def test_create_tag_empty(self):
     self.assertEqual(DOMString.render_debug(DOMString.create_tag('p')), '<p></p>')
Ejemplo n.º 29
0
 def test_parse_html(self):
     self.assertEqual(DOMString.render(DOMString.parse_html('<p><span>Test text</span></p>')), '<p><span>Test text</span></p>')
 def test_parse_html(self):
     self.assertEqual(DOMString.render(DOMString.parse_html('<p><span>Test text</span></p>')), '<p><span>Test text</span></p>')
Ejemplo n.º 31
0
 def test_append_child_identical_text(self):
     parent = DOMString.create_tag('p')
     DOMString.append_child(parent, DOMString.parse_html('test'))
     DOMString.append_child(parent, DOMString.parse_html('test'))
     self.assertEqual(DOMString.render_debug(parent), '<p>testtest</p>')
 def test_append_child(self):
     parent = DOMString.create_tag('p')
     DOMString.append_child(parent, DOMString.create_tag('span', {}))
     self.assertEqual(DOMString.render_debug(parent), '<p><span></span></p>')
Ejemplo n.º 33
0
 def test_render_attrs(self):
     self.assertEqual(DOMString.render_attrs({
         'src': 'src.png',
         'alt': 'img\'s alt',
         'class': 'intro',
     }), ' alt="img&#x27;s alt" class="intro" src="src.png"')
 def test_append_child_identical_text(self):
     parent = DOMString.create_tag('p')
     DOMString.append_child(parent, 'test')
     DOMString.append_child(parent, 'test')
     self.assertEqual(DOMString.render_debug(parent), '<p>testtest</p>')
Ejemplo n.º 35
0
 def test_create_tag(self):
     self.assertEqual(DOMString.render_debug(DOMString.create_tag('p', {'class': 'intro'})), '<p class="intro"></p>')
 def test_string_self_closing_tags(self):
     self.assertEqual(DOMString.render_debug(DOMString.create_tag('hr')), '<hr/>')