1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/dom-level2-html/test_HTMLTableRowElement20.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,177 @@ 1.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 1.5 +<html> 1.6 +<head> 1.7 +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> 1.8 +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> 1.9 +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement20</title> 1.10 +<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css"> 1.11 +<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script> 1.12 +<script src="DOMTestCase.js" type="text/javascript"></script> 1.13 +<script type="text/javascript"> 1.14 +// expose test function names 1.15 +function exposeTestFunctionNames() 1.16 +{ 1.17 +return ['HTMLTableRowElement20']; 1.18 +} 1.19 + 1.20 +var docsLoaded = -1000000; 1.21 +var builder = null; 1.22 + 1.23 +// 1.24 +// This function is called by the testing framework before 1.25 +// running the test suite. 1.26 +// 1.27 +// If there are no configuration exceptions, asynchronous 1.28 +// document loading is started. Otherwise, the status 1.29 +// is set to complete and the exception is immediately 1.30 +// raised when entering the body of the test. 1.31 +// 1.32 +function setUpPage() { 1.33 + setUpPageStatus = 'running'; 1.34 + try { 1.35 + // 1.36 + // creates test document builder, may throw exception 1.37 + // 1.38 + builder = createConfiguredBuilder(); 1.39 + 1.40 + docsLoaded = 0; 1.41 + 1.42 + var docRef = null; 1.43 + if (typeof(this.doc) != 'undefined') { 1.44 + docRef = this.doc; 1.45 + } 1.46 + docsLoaded += preload(docRef, "doc", "tablerow"); 1.47 + 1.48 + if (docsLoaded == 1) { 1.49 + setUpPage = 'complete'; 1.50 + } 1.51 + } catch(ex) { 1.52 + catchInitializationError(builder, ex); 1.53 + setUpPage = 'complete'; 1.54 + } 1.55 +} 1.56 + 1.57 + 1.58 + 1.59 +// 1.60 +// This method is called on the completion of 1.61 +// each asychronous load started in setUpTests. 1.62 +// 1.63 +// When every synchronous loaded document has completed, 1.64 +// the page status is changed which allows the 1.65 +// body of the test to be executed. 1.66 +function loadComplete() { 1.67 + if (++docsLoaded == 1) { 1.68 + setUpPageStatus = 'complete'; 1.69 + runJSUnitTests(); 1.70 + SimpleTest.finish(); 1.71 + } 1.72 +} 1.73 + 1.74 + 1.75 +/** 1.76 +* 1.77 + The insertCell() method inserts an empty TD cell into this row. 1.78 + If index is -1 or equal to the number of cells, the new cell is 1.79 + appended. 1.80 + 1.81 + 1.82 + Retrieve the fourth TR element and examine the value of 1.83 + the cells length attribute which should be set to six. 1.84 + Check the value of the last TD element. Invoke the 1.85 + insertCell() with an index of negative one 1.86 + which will append the empty cell to the end of the list. 1.87 + Check the value of the newly created cell and make sure it is null 1.88 + and also the numbers of cells should now be seven. 1.89 + 1.90 +* @author NIST 1.91 +* @author Rick Rivello 1.92 +* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016 1.93 +*/ 1.94 +function HTMLTableRowElement20() { 1.95 + var success; 1.96 + if(checkInitialization(builder, "HTMLTableRowElement20") != null) return; 1.97 + var nodeList; 1.98 + var cellsnodeList; 1.99 + var testNode; 1.100 + var trNode; 1.101 + var cellNode; 1.102 + var value; 1.103 + var newCell; 1.104 + var vcells; 1.105 + var doc; 1.106 + 1.107 + var docRef = null; 1.108 + if (typeof(this.doc) != 'undefined') { 1.109 + docRef = this.doc; 1.110 + } 1.111 + doc = load(docRef, "doc", "tablerow"); 1.112 + nodeList = doc.getElementsByTagName("tr"); 1.113 + assertSize("Asize",5,nodeList); 1.114 +testNode = nodeList.item(3); 1.115 + cellsnodeList = testNode.cells; 1.116 + 1.117 + vcells = cellsnodeList.length; 1.118 + 1.119 + assertEquals("cellsLink1",6,vcells); 1.120 + trNode = cellsnodeList.item(5); 1.121 + cellNode = trNode.firstChild; 1.122 + 1.123 + value = cellNode.nodeValue; 1.124 + 1.125 + assertEquals("value1Link","1230 North Ave. Dallas, Texas 98551",value); 1.126 + newCell = testNode.insertCell(-1); 1.127 + testNode = nodeList.item(3); 1.128 + cellsnodeList = testNode.cells; 1.129 + 1.130 + vcells = cellsnodeList.length; 1.131 + 1.132 + assertEquals("cellsLink2",7,vcells); 1.133 + trNode = cellsnodeList.item(6); 1.134 + cellNode = trNode.firstChild; 1.135 + 1.136 + assertNull("value2Link",cellNode); 1.137 + 1.138 +} 1.139 + 1.140 +</script> 1.141 +</head> 1.142 +<body> 1.143 +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableRowElement20</h2> 1.144 +<p><test name='HTMLTableRowElement20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'><br> <metadata><br> <title>HTMLTableRowElement20</title> 1.145 +<br> <creator>NIST</creator> 1.146 +<br> <description> 1.147 + The insertCell() method inserts an empty TD cell into this row. 1.148 + If index is -1 or equal to the number of cells, the new cell is 1.149 + appended. 1.150 + 1.151 + 1.152 + Retrieve the fourth TR element and examine the value of 1.153 + the cells length attribute which should be set to six. 1.154 + Check the value of the last TD element. Invoke the 1.155 + insertCell() with an index of negative one 1.156 + which will append the empty cell to the end of the list. 1.157 + Check the value of the newly created cell and make sure it is null 1.158 + and also the numbers of cells should now be seven. 1.159 +</description> 1.160 +<br> <contributor>Rick Rivello</contributor> 1.161 +<br> <date qualifier='created'>2002-11-07</date> 1.162 +<br> <subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-68927016</a>'/> 1.163 +<br></metadata><br> <var name='nodeList' type='NodeList'/><br> <var name='cellsnodeList' type='HTMLCollection'/><br> <var name='testNode' type='Node'/><br> <var name='trNode' type='Node'/><br> <var name='cellNode' type='Node'/><br> <var name='value' type='DOMString'/><br> <var name='newCell' type='HTMLElement'/><br> <var name='vcells' type='int'/><br> <var name='doc' type='Document'/><br> <load var='doc' href='tablerow' willBeModified='true'/><br> <getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"tr"'/><br> <assertSize collection='nodeList' size='5' <a id="Asize">id='Asize'</a>/><br> <item interface='NodeList' obj='nodeList' var='testNode' index='3'/><br> <cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/><br> <length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/><br> <assertEquals actual='vcells' expected='6' <a id="cellsLink1">id='cellsLink1'</a> ignoreCase='false'/><br> <item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='5'/><br> <firstChild interface='Node' obj='trNode' var='cellNode'/><br> <nodeValue obj='cellNode' var='value'/><br> <assertEquals actual='value' expected='"1230 North Ave. Dallas, Texas 98551"' <a id="value1Link">id='value1Link'</a> ignoreCase='false'/><br> <insertCell interface='HTMLTableRowElement' obj='testNode' var='newCell' index='-1'/><br> <item interface='NodeList' obj='nodeList' var='testNode' index='3'/><br> <cells interface='HTMLTableRowElement' obj='testNode' var='cellsnodeList'/><br> <length interface='HTMLCollection' obj='cellsnodeList' var='vcells'/><br> <assertEquals actual='vcells' expected='7' <a id="cellsLink2">id='cellsLink2'</a> ignoreCase='false'/><br> <item interface='HTMLCollection' obj='cellsnodeList' var='trNode' index='6'/><br> <firstChild interface='Node' obj='trNode' var='cellNode'/><br> <assertNull actual='cellNode' <a id="value2Link">id='value2Link'</a>/><br></test><br> 1.164 +</p> 1.165 +<p> 1.166 + Copyright (c) 2001-2004 World Wide Web Consortium, 1.167 + (Massachusetts Institute of Technology, Institut National de 1.168 + Recherche en Informatique et en Automatique, Keio University). All 1.169 + Rights Reserved. This program is distributed under the W3C's Software 1.170 + Intellectual Property License. This program is distributed in the 1.171 + hope that it will be useful, but WITHOUT ANY WARRANTY; without even 1.172 + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 1.173 + PURPOSE. 1.174 + </p> 1.175 +<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a> 1.176 + for more details.</p> 1.177 +<iframe name="doc" src="files/tablerow.html"></iframe> 1.178 +<br> 1.179 +</body> 1.180 +</html>