Skip to content

Commit

Permalink
Added tests for Document's Link cache
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoabinader committed Aug 14, 2014
1 parent 330f72f commit 66eb73c
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/test/content/test_document_links_cache.html
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<script src="harness.js"></script>
<script>
var links = document.links;
is(links, document.links);
is(links.length, 0);

var anchor = document.createElement("a");
anchor.id = "anchor-with-href";
anchor.setAttribute("href", "http://www.google.com");
document.body.appendChild(anchor);
is(links.length, 1);

anchor = document.createElement("a");
anchor.id = "anchor-without-href";
document.body.appendChild(anchor);
is(links.length, 1);

anchor.setAttribute("href", "http://www.google.com");
is(links.length, 2);

anchor.removeAttribute("href", "http://www.google.com");
is(links.length, 1);

document.body.removeChild(document.getElementById("anchor-without-href"));
is(links.length, 1);

document.body.removeChild(document.getElementById("anchor-with-href"));
is(links, document.links);
is(links.length, 0);

finish();
</script>
</head>
</html>

0 comments on commit 66eb73c

Please sign in to comment.