def test_tag_with_event_handler(self): self.assertEquals( [ html_linter.ConcernsSeparationMessage( line=1, column=7, tag='body', attribute='onload') ], html_linter.HTML5Linter('<body onload="foo();">').messages)
def test_style_attribute(self): self.assertEquals( [ html_linter.ConcernsSeparationMessage( line=1, column=4, tag='a', attribute='style') ], html_linter.HTML5Linter('<a style="color:red">a</a>').messages)
def test_style_type(self): self.assertEquals( [html_linter.ConcernsSeparationMessage( line=1, column=1, tag='style'), html_linter.TypeAttributeMessage(line=1, column=8, tag='style')], html_linter.HTML5Linter('<style type="text/css">').messages )
def test_tag_with_event_handler_and_js_protocol(self): self.assertEquals([ html_linter.ConcernsSeparationMessage( line=1, column=7, tag='body', attribute='onload'), html_linter.InvalidHandlerMessage( line=1, column=15, attribute='onload') ], html_linter.HTML5Linter( '<body onload="javascript:foo();">').messages)
def test_a_tag_with_javascript(self): self.assertEquals( [ html_linter.ConcernsSeparationMessage( line=1, column=10, tag='a', attribute='href') ], html_linter.HTML5Linter('<a href="javascript:foo();">').messages) self.assertEquals([], html_linter.HTML5Linter('<a href="foo">').messages)
def test_script_with_content(self): self.assertEquals( [ html_linter.ConcernsSeparationMessage( line=1, column=1, tag='script') ], html_linter.HTML5Linter('<script></script>').messages) self.assertEquals( [], html_linter.HTML5Linter('<script src="foo.js"></script>').messages)
def test_inline_script_with_charset(self): self.assertEquals([ html_linter.ConcernsSeparationMessage( line=1, column=1, tag='script'), html_linter.InvalidAttributeMessage( line=1, column=9, attribute='charset') ], html_linter.HTML5Linter( '<script charset="utf-8"></script>').messages) self.assertEquals( [], html_linter.HTML5Linter( '<script src="foo.js" charset="utf-8"></script>').messages)
def test_script_with_obsolete_language(self): self.assertEquals( [html_linter.ConcernsSeparationMessage( line=1, column=1, tag='script'), html_linter.InvalidAttributeMessage( line=1, column=9, attribute='language')], html_linter.HTML5Linter( '<script language="foo"></script>').messages ) self.assertEquals( [html_linter.InvalidAttributeMessage( line=1, column=22, attribute='language')], html_linter.HTML5Linter( '<script src="foo.js" language="utf-8"></script>').messages )
def test_style_tag(self): self.assertEquals([ html_linter.ConcernsSeparationMessage( line=1, column=1, tag='style') ], html_linter.HTML5Linter('<style></style>').messages)