Search in sources :

Example 36 with WebSourceCode

use of org.sonar.plugins.web.visitor.WebSourceCode in project sonar-web by SonarSource.

the class NonConsecutiveHeadingCheckTest method only_h1_tags.

@Test
public void only_h1_tags() throws Exception {
    WebSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/NonConsecutiveHeadingCheck/OnlyH1Tags.html"), new NonConsecutiveHeadingCheck());
    checkMessagesVerifier.verify(sourceCode.getIssues());
}
Also used : WebSourceCode(org.sonar.plugins.web.visitor.WebSourceCode) File(java.io.File) Test(org.junit.Test)

Example 37 with WebSourceCode

use of org.sonar.plugins.web.visitor.WebSourceCode in project sonar-web by SonarSource.

the class PageWithoutTitleCheckTest method detected.

@Test
public void detected() throws Exception {
    WebSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/PageWithoutTitleCheck.html"), new PageWithoutTitleCheck());
    checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(1).withMessage("Add a <title> tag to this page.").next().atLine(5).next().atLine(15).next().atLine(21).next().atLine(25).next().atLine(31).next().atLine(37);
}
Also used : WebSourceCode(org.sonar.plugins.web.visitor.WebSourceCode) File(java.io.File) Test(org.junit.Test)

Example 38 with WebSourceCode

use of org.sonar.plugins.web.visitor.WebSourceCode in project sonar-web by SonarSource.

the class ServerSideImageMapsCheckTest method detected.

@Test
public void detected() throws Exception {
    WebSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/ServerSideImageMapsCheck.html"), new ServerSideImageMapsCheck());
    checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(1).withMessage("Use the \"map\" tag and \"area\" tags instead.");
}
Also used : WebSourceCode(org.sonar.plugins.web.visitor.WebSourceCode) File(java.io.File) Test(org.junit.Test)

Example 39 with WebSourceCode

use of org.sonar.plugins.web.visitor.WebSourceCode in project sonar-web by SonarSource.

the class TableHeaderHasIdOrScopeCheckTest method detected.

@Test
public void detected() throws Exception {
    WebSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/TableHeaderHasIdOrScopeCheck.html"), new TableHeaderHasIdOrScopeCheck());
    checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(7).withMessage("Add either an 'id' or a 'scope' attribute to this <th> tag.").next().atLine(8).withMessage("Add either an 'id' or a 'scope' attribute to this <tH> tag.").next().atLine(34);
}
Also used : WebSourceCode(org.sonar.plugins.web.visitor.WebSourceCode) File(java.io.File) Test(org.junit.Test)

Example 40 with WebSourceCode

use of org.sonar.plugins.web.visitor.WebSourceCode in project sonar-web by SonarSource.

the class TableWithoutCaptionCheckTest method detected.

@Test
public void detected() throws Exception {
    WebSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/TableWithoutCaptionCheck.html"), new TableWithoutCaptionCheck());
    checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(1).withMessage("Add a <caption> tag to this table.");
}
Also used : WebSourceCode(org.sonar.plugins.web.visitor.WebSourceCode) File(java.io.File) Test(org.junit.Test)

Aggregations

WebSourceCode (org.sonar.plugins.web.visitor.WebSourceCode)93 File (java.io.File)91 Test (org.junit.Test)89 DefaultInputFile (org.sonar.api.batch.fs.internal.DefaultInputFile)10 InputFile (org.sonar.api.batch.fs.InputFile)8 FileReader (java.io.FileReader)6 PageLexer (org.sonar.plugins.web.lex.PageLexer)3 Node (org.sonar.plugins.web.node.Node)3 HtmlAstScanner (org.sonar.plugins.web.visitor.HtmlAstScanner)3 FileNotFoundException (java.io.FileNotFoundException)1 ExpectedException (org.junit.rules.ExpectedException)1 FilePredicates (org.sonar.api.batch.fs.FilePredicates)1 FileSystem (org.sonar.api.batch.fs.FileSystem)1 ComplexityVisitor (org.sonar.plugins.web.analyzers.ComplexityVisitor)1 PageCountLines (org.sonar.plugins.web.analyzers.PageCountLines)1