dom/tests/mochitest/dom-level2-html/test_hasFeature02.html

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:f02d7f3ffabd
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6 <title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature02</title>
7 <link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
8 <script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
9 <script src="DOMTestCase.js" type="text/javascript"></script>
10 <script type="text/javascript">
11 // expose test function names
12 function exposeTestFunctionNames()
13 {
14 return ['hasFeature02'];
15 }
16
17 var docsLoaded = -1000000;
18 var builder = null;
19
20 //
21 // This function is called by the testing framework before
22 // running the test suite.
23 //
24 // If there are no configuration exceptions, asynchronous
25 // document loading is started. Otherwise, the status
26 // is set to complete and the exception is immediately
27 // raised when entering the body of the test.
28 //
29 function setUpPage() {
30 setUpPageStatus = 'running';
31 try {
32 //
33 // creates test document builder, may throw exception
34 //
35 builder = createConfiguredBuilder();
36
37 docsLoaded = 0;
38
39 if (docsLoaded == 0) {
40 setUpPage = 'complete';
41 }
42 } catch(ex) {
43 catchInitializationError(builder, ex);
44 setUpPage = 'complete';
45 }
46 runJSUnitTests();
47 SimpleTest.finish();
48 }
49
50
51
52 //
53 // This method is called on the completion of
54 // each asychronous load started in setUpTests.
55 //
56 // When every synchronous loaded document has completed,
57 // the page status is changed which allows the
58 // body of the test to be executed.
59 function loadComplete() {
60 if (++docsLoaded == 0) {
61 setUpPageStatus = 'complete';
62 }
63 }
64
65
66 /**
67 *
68 hasFeature("hTmL", "2.0") should return true.
69
70 * @author Curt Arnold
71 * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7
72 */
73 function hasFeature02() {
74 var success;
75 if(checkInitialization(builder, "hasFeature02") != null) return;
76 var doc;
77 var domImpl;
78 var version = "2.0";
79 var state;
80 domImpl = getImplementation();
81 state = domImpl.hasFeature("hTmL",version);
82 assertTrue("hasHTML2",state);
83
84 }
85
86 </script>
87 </head>
88 <body>
89 <h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/hasFeature02</h2>
90 <p>&lt;test name='hasFeature02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;hasFeature02&lt;/title&gt;
91 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
92 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
93 hasFeature("hTmL", "2.0") should return true.
94 &lt;/description&gt;
95 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2004-03-18&lt;/date&gt;
96 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7</a>'/&gt;
97 <br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='domImpl' type='DOMImplementation'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='version' type='DOMString' value='"2.0"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='state' type='boolean'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;implementation var='domImpl'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;hasFeature obj='domImpl' var='state' feature='"hTmL"' version='version'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertTrue actual='state' <a id="hasHTML2">id='hasHTML2'</a>/&gt;<br>&lt;/test&gt;<br>
98 </p>
99 <p>
100 Copyright (c) 2001-2004 World Wide Web Consortium,
101 (Massachusetts Institute of Technology, Institut National de
102 Recherche en Informatique et en Automatique, Keio University). All
103 Rights Reserved. This program is distributed under the W3C's Software
104 Intellectual Property License. This program is distributed in the
105 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
106 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
107 PURPOSE.
108 </p>
109 <p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
110 for more details.</p>
111 </body>
112 </html>

mercurial