use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class FieldsetWithoutLegendCheckTest method detected.
@Test
public void detected() throws Exception {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/FieldsetWithoutLegendCheck.html"), new FieldsetWithoutLegendCheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLocation(2, 2, 2, 12).withMessage("Add a <legend> tag to this fieldset.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class FrameWithoutTitleCheckTest method test.
@Test
public void test() throws Exception {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/FrameWithoutTitleCheck.html"), new FrameWithoutTitleCheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLocation(1, 0, 1, 23).withMessage("Add a \"title\" attribute to this <iframe> tag.").next().atLine(2).withMessage("Add a \"title\" attribute to this <fRamE> tag.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class InputWithoutLabelCheckTest method detected.
@Test
public void detected() throws Exception {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/InputWithoutLabelCheck.html"), new InputWithoutLabelCheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLocation(6, 0, 6, 31).withMessage("Associate a valid label to this input field.").next().atLine(19).next().atLocation(23, 0, 23, 19).withMessage("Add an \"id\" attribute to this input field and associate it with a label.").next().atLine(25).withMessage("Add an \"id\" attribute to this input field and associate it with a label.").next().atLine(26).withMessage("Add an \"id\" attribute to this input field and associate it with a label.").next().atLine(28).withMessage("Associate a valid label to this input field.").next().atLine(32).next().atLine(43).next().atLine(56).next().atLocation(59, 0, 59, 72).withMessage("Use valid ids in \"aria-labelledby\" attribute. Following ids were not found: \"missing\",\"missing2\".");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class MultiplePageDirectivesCheckTest method test3.
@Test
public void test3() throws Exception {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/multiplePageDirectivesCheck3.html"), new MultiplePageDirectivesCheck());
assertThat(sourceCode.getIssues()).isEmpty();
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class LongJavaScriptCheckTest method custom.
@Test
public void custom() {
LongJavaScriptCheck check = new LongJavaScriptCheck();
check.maxLines = 4;
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/LongJavaScriptCheck.html"), check);
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(7).withCost(2d).withMessage("The length of this JS script (6) exceeds the maximum set to 4.");
}
Aggregations