mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Added tests for Document's Link cache
This commit is contained in:
parent
330f72fba5
commit
66eb73ca44
1 changed files with 37 additions and 0 deletions
37
src/test/content/test_document_links_cache.html
Normal file
37
src/test/content/test_document_links_cache.html
Normal file
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue