def test_parse_html(self): self.assertEqual( DOM_HTML5LIB.render_debug( DOM_HTML5LIB.parse_html("<p><span>Test text</span></p>") ), "<p><span>Test text</span></p>", )
def test_create_tag(self): self.assertEqual( DOM_HTML5LIB.render_debug( DOM_HTML5LIB.create_tag("p", {"class": "intro"}) ), '<p class="intro"></p>', )
def test_html5lib_namespaced_attributes(self): bs_elt = DOM_HTML5LIB.create_tag("svg") DOM_HTML5LIB.append_child( bs_elt, DOM_HTML5LIB.create_tag("use", {"xlink:href": "test"})) self.assertEqual( DOM_HTML5LIB.render_debug(bs_elt), '<svg><use xlink:href="test"></use></svg>', )
def test_append_child(self): parent = DOM_HTML5LIB.create_tag("p") DOM_HTML5LIB.append_child(parent, DOM_HTML5LIB.create_tag("span", {})) self.assertEqual( DOM_HTML5LIB.render_debug(parent), "<p><span></span></p>" )
def test_parse_html(self): self.assertEqual(DOM_HTML5LIB.render_debug(DOM_HTML5LIB.parse_html('<p><span>Test text</span></p>')), '<p><span>Test text</span></p>')
def test_html5lib_html_parsing(self): self.assertEqual( DOM_HTML5LIB.render_debug( DOM_HTML5LIB.parse_html('<p>Invalid > " &</p>')), '<p>Invalid > " &</p>', )
def test_html5lib_html_escaping(self): self.assertEqual(DOM_HTML5LIB.render_debug(DOM_HTML5LIB.create_tag('img', { 'alt': '< " \' < > &', })), '<img alt="< " \' < > &"/>')
def test_create_tag(self): self.assertEqual( DOM_HTML5LIB.render_debug( DOM_HTML5LIB.create_tag('p', {'class': 'intro'})), '<p class="intro"></p>')
def test_html5lib_invalid_attributes(self): self.assertEqual(DOM_HTML5LIB.render_debug(DOM_HTML5LIB.create_tag('div', {'*ngFor': 'test'})), '<div *ngFor="test"></div>')
def test_html5lib_namespaced_attributes(self): bs_elt = DOM_HTML5LIB.create_tag('svg') DOM_HTML5LIB.append_child(bs_elt, DOM_HTML5LIB.create_tag('use', {'xlink:href': 'test'})) self.assertEqual(DOM_HTML5LIB.render_debug(bs_elt), '<svg><use xlink:href="test"></use></svg>')
def test_html5lib_self_closing_tags(self): self.assertEqual(DOM_HTML5LIB.render_debug(DOM_HTML5LIB.create_tag('hr')), '<hr/>')
def test_create_tag(self): self.assertEqual(DOM_HTML5LIB.render_debug(DOM_HTML5LIB.create_tag('p', {'class': 'intro'})), '<p class="intro"></p>')
def test_append_child(self): parent = DOM_HTML5LIB.create_tag('p') DOM_HTML5LIB.append_child(parent, DOM_HTML5LIB.create_tag('span', {})) self.assertEqual(DOM_HTML5LIB.render_debug(parent), '<p><span></span></p>')
def test_create_tag_empty(self): self.assertEqual( DOM_HTML5LIB.render_debug(DOM_HTML5LIB.create_tag('p')), '<p></p>')
def test_html5lib_html_parsing(self): self.assertEqual(DOM_HTML5LIB.render_debug(DOM_HTML5LIB.parse_html('<p>Invalid > " &</p>')), '<p>Invalid > " &</p>')
def test_html5lib_invalid_attributes(self): self.assertEqual( DOM_HTML5LIB.render_debug( DOM_HTML5LIB.create_tag('div', {'*ngFor': 'test'})), '<div *ngFor="test"></div>')
def test_html5lib_invalid_attributes(self): self.assertEqual( DOM_HTML5LIB.render_debug( DOM_HTML5LIB.create_tag("div", {"*ngFor": "test"})), '<div *ngFor="test"></div>', )
def test_html5lib_namespaced_attributes(self): bs_elt = DOM_HTML5LIB.create_tag('svg') DOM_HTML5LIB.append_child( bs_elt, DOM_HTML5LIB.create_tag('use', {'xlink:href': 'test'})) self.assertEqual(DOM_HTML5LIB.render_debug(bs_elt), '<svg><use xlink:href="test"></use></svg>')
def test_html5lib_html_escaping(self): self.assertEqual( DOM_HTML5LIB.render_debug( DOM_HTML5LIB.create_tag("img", {"alt": "< \" ' < > &"})), '<img alt="< " \' < > &"/>', )
def test_html5lib_html_escaping(self): self.assertEqual( DOM_HTML5LIB.render_debug( DOM_HTML5LIB.create_tag('img', { 'alt': '< " \' < > &', })), '<img alt="< " \' < > &"/>')
def test_html5lib_self_closing_tags(self): self.assertEqual( DOM_HTML5LIB.render_debug(DOM_HTML5LIB.create_tag("hr")), "<hr/>")
def test_create_tag_empty(self): self.assertEqual(DOM_HTML5LIB.render_debug(DOM_HTML5LIB.create_tag('p')), '<p></p>')