content/base/test/test_title.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_title.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +
     1.7 +<head>
     1.8 +  <title>Test for titles</title>
     1.9 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.10 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.11 +  <style type="text/css">
    1.12 +  </style>
    1.13 +</head>
    1.14 +
    1.15 +<body onload="runTests()">
    1.16 +
    1.17 +<p id="display"></p>
    1.18 +<div style="display:none;">
    1.19 +  <iframe id="html1" src="data:text/html,<html><head><title id='t'>Test</title></head></html>"></iframe>
    1.20 +  <iframe id="html2" src="data:text/html,<html><head><title id='t'>Test</title><title>Foo</title></head></html>"></iframe>
    1.21 +  <iframe id="html3" src="data:text/html,<html></html>"></iframe>
    1.22 +  <iframe id="xhtml1" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'><body><title id='t'>Test</title></body></html>"></iframe>
    1.23 +  <iframe id="xhtml2" src="data:text/xml,<title xmlns='http://www.w3.org/1999/xhtml'>Test</title>"></iframe>
    1.24 +  <iframe id="xhtml3" src="data:text/xml,<title xmlns='http://www.w3.org/1999/xhtml'>Te<div>bogus</div>st</title>"></iframe>
    1.25 +  <iframe id="xhtml4" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'/>"></iframe>
    1.26 +  <iframe id="xhtml5" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'><head/></html>"></iframe>
    1.27 +  <iframe id="xhtml6" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'><head><style/></head></html>"></iframe>
    1.28 +  <iframe id="xul1" src="data:application/vnd.mozilla.xul+xml,<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' title='Test'/>"></iframe>
    1.29 +  <iframe id="xul2" src="data:application/vnd.mozilla.xul+xml,<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' title='Test'/>"></iframe>
    1.30 +  <iframe id="svg1" src="data:text/xml,<svg xmlns='http://www.w3.org/2000/svg'><title id='t'>Test</title></svg>"></iframe>
    1.31 +  <iframe id="svg2" src="data:text/xml,<svg xmlns='http://www.w3.org/2000/svg'><title id='t'>Test</title></svg>"></iframe>
    1.32 +</div>
    1.33 +
    1.34 +<pre id="test">
    1.35 +<script>
    1.36 +SimpleTest.waitForExplicitFinish();
    1.37 +
    1.38 +function runTests() {
    1.39 +  function testStatic(id, expect, description) {
    1.40 +    is(document.getElementById(id).contentDocument.title, expect, description);
    1.41 +  }
    1.42 +
    1.43 +  testStatic("html1", "Test", "HTML <title>");
    1.44 +  testStatic("html2", "Test", "choose the first HTML <title>");
    1.45 +  testStatic("html3", "", "No title");
    1.46 +  testStatic("xhtml1", "Test", "XHTML <title> in body");
    1.47 +  testStatic("xhtml2", "Test", "XHTML <title> as root element");
    1.48 +  testStatic("xhtml3", "Test", "XHTML <title> containing an element");
    1.49 +  testStatic("xul1", "Test", "XUL <window> title attribute");
    1.50 +  testStatic("svg1", "Test", "SVG <title>");
    1.51 +
    1.52 +  SimpleTest.finish();
    1.53 +}
    1.54 +</script>
    1.55 +</pre>
    1.56 +</body>
    1.57 +</html>

mercurial