AccessibilityIssueMarkupFinder { List<AccessibilityIssue> get() { fetchElementPositions(); return issues; } AccessibilityIssueMarkupFinder(String html, String json);   }
@Test public void get_SingleIssueWithNoOffset() { String html = "<a/>"; String issuesJson = "[{\"code\":\"1\",\"message\":\"m\",\"type\":1,\"elementString\":\"<a/>\"}]"; issues = new AccessibilityIssueMarkupFinder(html, issuesJson).get(); verifySingleIssue(issues.get(0), 1, 1); }
@Test public void get_SingleIssueWithColOffset() { String html = "xxxx<a/>"; String issuesJson = "[{\"code\":\"1\",\"message\":\"m\",\"type\":1,\"elementString\":\"<a/>\"}]"; issues = new AccessibilityIssueMarkupFinder(html, issuesJson).get(); verifySingleIssue(issues.get(0), 1, 5); }
@Test public void get_SingleIssueWithColLineOffset() { String html = "\nxx\n\nxx<a/>xx"; String issuesJson = "[{\"code\":\"1\",\"message\":\"m\",\"type\":1,\"elementString\":\"<a/>\"}]"; issues = new AccessibilityIssueMarkupFinder(html, issuesJson).get(); verifySingleIssue(issues.get(0), 4, 3); }
@Test public void get_OneElementDifferentIssueTypes() { String html = "\n\nx<a/>"; String issuesJson = "[{\"code\":\"1\",\"message\":\"m\",\"type\":1,\"elementString\":\"<a/>\"}," + "{\"code\":\"1\",\"message\":\"m\",\"type\":2,\"elementString\":\"<a/>\"}]"; issues = new AccessibilityIssueMarkupFinder(html, issuesJson).get(); verifySingleIssue(issues.get(0), 3, 2); verifySingleIssue(issues.get(1), 3, 2); }
@Test public void get_ManySameIssues() { String html = "\nxx\n\nxx<a/>xx\n\n\n<a/>xxx"; String issuesJson = "[{\"code\":\"1\",\"message\":\"m\",\"type\":1,\"elementString\":\"<a/>\"}," + "{\"code\":\"1\",\"message\":\"m\",\"type\":1,\"elementString\":\"<a/>\"}]"; issues = new AccessibilityIssueMarkupFinder(html, issuesJson).get(); verifySingleIssue(issues.get(0), 4, 3); verifySingleIssue(issues.get(1), 7, 1); }
@Test public void get_NestedIssues() { String html = "\nx\nxxx\n<div id=\"footer\"><a href=\"test\"></a></div>"; String issuesJson = "[{\"code\":\"1\",\"message\":\"m\",\"type\":1,\"elementString\":\"<div id=\\\"footer\\\"><a href=\\\"test\\\"></a></div>\"}," + "{\"code\":\"1\",\"message\":\"m\",\"type\":1,\"elementString\":\"<a href=\\\"test\\\"></a>\"}]"; issues = new AccessibilityIssueMarkupFinder(html, issuesJson).get(); verifySingleIssue(issues.get(0), 4, 1); verifySingleIssue(issues.get(1), 4, 18); }