table_test.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. // Copyright 2011 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. goog.provide('goog.editor.TableTest');
  15. goog.setTestOnly('goog.editor.TableTest');
  16. goog.require('goog.dom');
  17. goog.require('goog.dom.TagName');
  18. goog.require('goog.editor.Table');
  19. goog.require('goog.testing.jsunit');
  20. function setUp() {
  21. var inputTables = goog.dom.getElementsByTagName(goog.dom.TagName.TABLE);
  22. testElements = {};
  23. testObjects = {};
  24. for (var i = 0; i < inputTables.length; i++) {
  25. var originalTable = inputTables[i];
  26. if (originalTable.id.substring(0, 5) == 'test-') {
  27. var tableName = originalTable.id.substring(5);
  28. var testTable = originalTable.cloneNode(true);
  29. testTable.id = tableName;
  30. testElements[tableName] = testTable;
  31. document.body.appendChild(testTable);
  32. testObjects[tableName] = new goog.editor.Table(testTable);
  33. }
  34. }
  35. }
  36. function tearDown() {
  37. for (var tableName in testElements) {
  38. document.body.removeChild(testElements[tableName]);
  39. delete testElements[tableName];
  40. delete testObjects[tableName];
  41. }
  42. testElements = null;
  43. testObjects = null;
  44. }
  45. function tableSanityCheck(editableTable, rowCount, colCount) {
  46. assertEquals(
  47. 'Table has expected number of rows', rowCount, editableTable.rows.length);
  48. for (var i = 0, row; row = editableTable.rows[i]; i++) {
  49. assertEquals(
  50. 'Row ' + i + ' has expected number of columns', colCount,
  51. row.columns.length);
  52. }
  53. }
  54. function testBasicTable() {
  55. // Do some basic sanity checking on the editable table structure
  56. tableSanityCheck(testObjects.basic, 4, 3);
  57. var originalRows =
  58. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.basic);
  59. assertEquals(
  60. 'Basic table row count, compared to source', originalRows.length,
  61. testObjects.basic.rows.length);
  62. assertEquals(
  63. 'Basic table row count, known value', 4, testObjects.basic.rows.length);
  64. assertEquals(
  65. 'Basic table first row element', originalRows[0],
  66. testObjects.basic.rows[0].element);
  67. assertEquals(
  68. 'Basic table last row element', originalRows[3],
  69. testObjects.basic.rows[3].element);
  70. assertEquals(
  71. 'Basic table first row length', 3,
  72. testObjects.basic.rows[0].columns.length);
  73. assertEquals(
  74. 'Basic table last row length', 3,
  75. testObjects.basic.rows[3].columns.length);
  76. }
  77. function testTortureTable() {
  78. // Do basic sanity checking on torture table structure
  79. tableSanityCheck(testObjects.torture, 9, 3);
  80. var originalRows =
  81. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.torture);
  82. assertEquals(
  83. 'Torture table row count, compared to source', originalRows.length,
  84. testObjects.torture.rows.length);
  85. assertEquals(
  86. 'Torture table row count, known value', 9,
  87. testObjects.torture.rows.length);
  88. }
  89. function _testInsertRowResult(element, editableTable, newTr, index) {
  90. var originalRowCount;
  91. if (element == testElements.basic) {
  92. originalRowCount = 4;
  93. } else if (element == testElements.torture) {
  94. originalRowCount = 9;
  95. }
  96. assertEquals(
  97. 'Row was added to table', originalRowCount + 1,
  98. goog.dom.getElementsByTagName(goog.dom.TagName.TR, element).length);
  99. assertEquals(
  100. 'Row was added at position ' + index,
  101. goog.dom.getElementsByTagName(goog.dom.TagName.TR, element)[index],
  102. newTr);
  103. assertEquals(
  104. 'Row knows its own position', index, editableTable.rows[index].index);
  105. assertEquals(
  106. 'EditableTable shows row at position ' + index, newTr,
  107. editableTable.rows[index].element);
  108. assertEquals(
  109. 'New row has correct number of TDs', 3,
  110. goog.dom.getElementsByTagName(goog.dom.TagName.TD, newTr).length);
  111. }
  112. function testInsertRowAtBeginning() {
  113. var tr = testObjects.basic.insertRow(0);
  114. _testInsertRowResult(testElements.basic, testObjects.basic, tr, 0);
  115. }
  116. function testInsertRowInMiddle() {
  117. var tr = testObjects.basic.insertRow(2);
  118. _testInsertRowResult(testElements.basic, testObjects.basic, tr, 2);
  119. }
  120. function testInsertRowAtEnd() {
  121. assertEquals(
  122. 'Table has expected number of existing rows', 4,
  123. testObjects.basic.rows.length);
  124. var tr = testObjects.basic.insertRow(4);
  125. _testInsertRowResult(testElements.basic, testObjects.basic, tr, 4);
  126. }
  127. function testInsertRowAtEndNoIndexArgument() {
  128. assertEquals(
  129. 'Table has expected number of existing rows', 4,
  130. testObjects.basic.rows.length);
  131. var tr = testObjects.basic.insertRow();
  132. _testInsertRowResult(testElements.basic, testObjects.basic, tr, 4);
  133. }
  134. function testInsertRowAtBeginningRowspan() {
  135. // Test inserting a row when the existing DOM row at that index has
  136. // a cell with a rowspan. This should be just like a regular insert -
  137. // the rowspan shouldn't have any effect.
  138. assertEquals(
  139. 'Cell has starting rowspan', 2,
  140. goog.dom
  141. .getFirstElementChild(goog.dom.getElementsByTagName(
  142. goog.dom.TagName.TR, testElements.torture)[0])
  143. .rowSpan);
  144. var tr = testObjects.torture.insertRow(0);
  145. // Among other things this verifies that the new row has 3 child TDs.
  146. _testInsertRowResult(testElements.torture, testObjects.torture, tr, 0);
  147. }
  148. function testInsertRowAtEndingRowspan() {
  149. // Test inserting a row when there's a cell in a previous DOM row
  150. // with a rowspan that extends into the row with the given index
  151. // and ends there. This should be just like a regular insert -
  152. // the rowspan shouldn't have any effect.
  153. assertEquals(
  154. 'Cell has ending rowspan', 4,
  155. goog.dom
  156. .getLastElementChild(goog.dom.getElementsByTagName(
  157. goog.dom.TagName.TR, testElements.torture)[5])
  158. .rowSpan);
  159. var tr = testObjects.torture.insertRow();
  160. // Among other things this verifies that the new row has 3 child TDs.
  161. _testInsertRowResult(testElements.torture, testObjects.torture, tr, 9);
  162. }
  163. function testInsertRowAtSpanningRowspan() {
  164. // Test inserting a row at an index where there's a cell with a rowspan
  165. // that begins in a previous row and continues into the next row. In this
  166. // case the existing cell's rowspan should be extended, and the new
  167. // tr should have one less child element.
  168. var rowSpannedCell = testObjects.torture.rows[7].columns[2];
  169. assertTrue(
  170. 'Existing cell has overlapping rowspan',
  171. rowSpannedCell.startRow == 5 && rowSpannedCell.endRow == 8);
  172. var tr = testObjects.torture.insertRow(7);
  173. assertEquals(
  174. 'New DOM row has one less cell', 2,
  175. goog.dom.getElementsByTagName(goog.dom.TagName.TD, tr).length);
  176. assertEquals(
  177. 'Rowspanned cell listed in new EditableRow\'s columns',
  178. testObjects.torture.rows[6].columns[2].element,
  179. testObjects.torture.rows[7].columns[2].element);
  180. }
  181. function _testInsertColumnResult(newCells, element, editableTable, index) {
  182. for (var rowNo = 0, row; row = editableTable.rows[rowNo]; rowNo++) {
  183. assertEquals('Row includes new column', 4, row.columns.length);
  184. }
  185. assertEquals(
  186. 'New cell in correct position', newCells[0],
  187. editableTable.rows[0].columns[index].element);
  188. }
  189. function testInsertColumnAtBeginning() {
  190. var startColCount = testObjects.basic.rows[0].columns.length;
  191. var newCells = testObjects.basic.insertColumn(0);
  192. assertEquals(
  193. 'New cell added for each row', testObjects.basic.rows.length,
  194. newCells.length);
  195. assertEquals(
  196. 'Insert column incremented column length', startColCount + 1,
  197. testObjects.basic.rows[0].columns.length);
  198. _testInsertColumnResult(newCells, testElements.basic, testObjects.basic, 0);
  199. }
  200. function testInsertColumnAtEnd() {
  201. var startColCount = testObjects.basic.rows[0].columns.length;
  202. var newCells = testObjects.basic.insertColumn(3);
  203. assertEquals(
  204. 'New cell added for each row', testObjects.basic.rows.length,
  205. newCells.length);
  206. assertEquals(
  207. 'Insert column incremented column length', startColCount + 1,
  208. testObjects.basic.rows[0].columns.length);
  209. _testInsertColumnResult(newCells, testElements.basic, testObjects.basic, 3);
  210. }
  211. function testInsertColumnAtEndNoIndexArgument() {
  212. var startColCount = testObjects.basic.rows[0].columns.length;
  213. var newCells = testObjects.basic.insertColumn();
  214. assertEquals(
  215. 'New cell added for each row', testObjects.basic.rows.length,
  216. newCells.length);
  217. assertEquals(
  218. 'Insert column incremented column length', startColCount + 1,
  219. testObjects.basic.rows[0].columns.length);
  220. _testInsertColumnResult(newCells, testElements.basic, testObjects.basic, 3);
  221. }
  222. function testInsertColumnInMiddle() {
  223. var startColCount = testObjects.basic.rows[0].columns.length;
  224. var newCells = testObjects.basic.insertColumn(2);
  225. assertEquals(
  226. 'New cell added for each row', testObjects.basic.rows.length,
  227. newCells.length);
  228. assertEquals(
  229. 'Insert column incremented column length', startColCount + 1,
  230. testObjects.basic.rows[0].columns.length);
  231. _testInsertColumnResult(newCells, testElements.basic, testObjects.basic, 2);
  232. }
  233. function testInsertColumnAtBeginningColSpan() {
  234. var cells = testObjects.torture.insertColumn(0);
  235. tableSanityCheck(testObjects.torture, 9, 4);
  236. assertEquals(
  237. 'New cell was added before colspanned cell', 1,
  238. testObjects.torture.rows[3].columns[0].colSpan);
  239. assertEquals(
  240. 'New cell was added and returned',
  241. testObjects.torture.rows[3].columns[0].element, cells[3]);
  242. }
  243. function testInsertColumnAtEndingColSpan() {
  244. var cells = testObjects.torture.insertColumn();
  245. tableSanityCheck(testObjects.torture, 9, 4);
  246. assertEquals(
  247. 'New cell was added after colspanned cell', 1,
  248. testObjects.torture.rows[0].columns[3].colSpan);
  249. assertEquals(
  250. 'New cell was added and returned',
  251. testObjects.torture.rows[0].columns[3].element, cells[0]);
  252. }
  253. function testInsertColumnAtSpanningColSpan() {
  254. assertEquals(
  255. 'Existing cell has expected colspan', 3,
  256. testObjects.torture.rows[4].columns[1].colSpan);
  257. var cells = testObjects.torture.insertColumn(1);
  258. tableSanityCheck(testObjects.torture, 9, 4);
  259. assertEquals(
  260. 'Existing cell increased colspan', 4,
  261. testObjects.torture.rows[4].columns[1].colSpan);
  262. assertEquals(
  263. '3 cells weren\'t created due to existing colspans', 6, cells.length);
  264. }
  265. function testRemoveFirstRow() {
  266. var originalRow =
  267. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.basic)[0];
  268. testObjects.basic.removeRow(0);
  269. tableSanityCheck(testObjects.basic, 3, 3);
  270. assertNotEquals(
  271. 'Row was removed from table element', originalRow,
  272. goog.dom.getElementsByTagName(
  273. goog.dom.TagName.TR, testElements.basic)[0]);
  274. }
  275. function testRemoveLastRow() {
  276. var originalRow =
  277. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.basic)[3];
  278. testObjects.basic.removeRow(3);
  279. tableSanityCheck(testObjects.basic, 3, 3);
  280. assertNotEquals(
  281. 'Row was removed from table element', originalRow,
  282. goog.dom.getElementsByTagName(
  283. goog.dom.TagName.TR, testElements.basic)[3]);
  284. }
  285. function testRemoveMiddleRow() {
  286. var originalRow =
  287. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.basic)[2];
  288. testObjects.basic.removeRow(2);
  289. tableSanityCheck(testObjects.basic, 3, 3);
  290. assertNotEquals(
  291. 'Row was removed from table element', originalRow,
  292. goog.dom.getElementsByTagName(
  293. goog.dom.TagName.TR, testElements.basic)[2]);
  294. }
  295. function testRemoveRowAtBeginingRowSpan() {
  296. var originalRow = testObjects.torture.removeRow(0);
  297. tableSanityCheck(testObjects.torture, 8, 3);
  298. assertNotEquals(
  299. 'Row was removed from table element', originalRow,
  300. goog.dom.getElementsByTagName(
  301. goog.dom.TagName.TR, testElements.basic)[0]);
  302. assertEquals(
  303. 'Rowspan correctly adjusted', 1,
  304. testObjects.torture.rows[0].columns[0].rowSpan);
  305. }
  306. function testRemoveRowAtEndingRowSpan() {
  307. var originalRow = goog.dom.getElementsByTagName(
  308. goog.dom.TagName.TR, testElements.torture)[8];
  309. testObjects.torture.removeRow(8);
  310. tableSanityCheck(testObjects.torture, 8, 3);
  311. assertNotEquals(
  312. 'Row was removed from table element', originalRow,
  313. goog.dom.getElementsByTagName(
  314. goog.dom.TagName.TR, testElements.basic)[8]);
  315. assertEquals(
  316. 'Rowspan correctly adjusted', 3,
  317. testObjects.torture.rows[7].columns[2].rowSpan);
  318. }
  319. function testRemoveRowAtSpanningRowSpan() {
  320. var originalRow = goog.dom.getElementsByTagName(
  321. goog.dom.TagName.TR, testElements.torture)[7];
  322. testObjects.torture.removeRow(7);
  323. tableSanityCheck(testObjects.torture, 8, 3);
  324. assertNotEquals(
  325. 'Row was removed from table element', originalRow,
  326. goog.dom.getElementsByTagName(
  327. goog.dom.TagName.TR, testElements.basic)[7]);
  328. assertEquals(
  329. 'Rowspan correctly adjusted', 3,
  330. testObjects.torture.rows[6].columns[2].rowSpan);
  331. }
  332. function _testRemoveColumn(index) {
  333. var tr =
  334. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.basic)[0];
  335. var sampleCell =
  336. goog.dom.getElementsByTagName(goog.dom.TagName.TH, tr)[index];
  337. testObjects.basic.removeColumn(index);
  338. tableSanityCheck(testObjects.basic, 4, 2);
  339. tr =
  340. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.basic)[0];
  341. assertNotEquals(
  342. 'Test cell removed from column', sampleCell,
  343. goog.dom.getElementsByTagName(goog.dom.TagName.TH, tr)[index]);
  344. }
  345. function testRemoveFirstColumn() {
  346. _testRemoveColumn(0);
  347. }
  348. function testRemoveMiddleColumn() {
  349. _testRemoveColumn(1);
  350. }
  351. function testRemoveLastColumn() {
  352. _testRemoveColumn(2);
  353. }
  354. function testRemoveColumnAtStartingColSpan() {
  355. testObjects.torture.removeColumn(0);
  356. tableSanityCheck(testObjects.torture, 9, 2);
  357. var tr = goog.dom.getElementsByTagName(
  358. goog.dom.TagName.TR, testElements.torture)[5]
  359. assertEquals(
  360. 'Colspan was decremented correctly', 1,
  361. goog.dom.getElementsByTagName(goog.dom.TagName.TH, tr)[0].colSpan);
  362. }
  363. function testRemoveColumnAtEndingColSpan() {
  364. testObjects.torture.removeColumn(2);
  365. tableSanityCheck(testObjects.torture, 9, 2);
  366. var tr = goog.dom.getElementsByTagName(
  367. goog.dom.TagName.TR, testElements.torture)[1];
  368. assertEquals(
  369. 'Colspan was decremented correctly', 1,
  370. goog.dom.getElementsByTagName(goog.dom.TagName.TD, tr)[0].colSpan);
  371. }
  372. function testRemoveColumnAtSpanningColSpan() {
  373. testObjects.torture.removeColumn(2);
  374. tableSanityCheck(testObjects.torture, 9, 2);
  375. var tr = goog.dom.getElementsByTagName(
  376. goog.dom.TagName.TR, testElements.torture)[4]
  377. assertEquals(
  378. 'Colspan was decremented correctly', 2,
  379. goog.dom.getElementsByTagName(goog.dom.TagName.TH, tr)[0].colSpan);
  380. }
  381. function testMergeCellsInRow() {
  382. testObjects.basic.mergeCells(0, 0, 0, 2);
  383. tableSanityCheck(testObjects.basic, 4, 3);
  384. var trs =
  385. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.basic);
  386. assertEquals(
  387. 'Cells merged', 1,
  388. goog.dom.getElementsByTagName(goog.dom.TagName.TH, trs[0]).length);
  389. assertEquals(
  390. 'Merged cell has correct colspan', 3,
  391. goog.dom.getElementsByTagName(goog.dom.TagName.TH, trs[0])[0].colSpan);
  392. assertEquals(
  393. 'Merged cell has correct rowspan', 1,
  394. goog.dom.getElementsByTagName(goog.dom.TagName.TH, trs[0])[0].rowSpan);
  395. }
  396. function testMergeCellsInColumn() {
  397. testObjects.basic.mergeCells(0, 0, 2, 0);
  398. tableSanityCheck(testObjects.basic, 4, 3);
  399. var trs =
  400. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.basic);
  401. assertEquals(
  402. 'Other cells still in row', 3,
  403. goog.dom.getElementsByTagName(goog.dom.TagName.TH, trs[0]).length);
  404. assertEquals(
  405. 'Merged cell has correct colspan', 1,
  406. goog.dom.getElementsByTagName(goog.dom.TagName.TH, trs[0])[0].colSpan);
  407. assertEquals(
  408. 'Merged cell has correct rowspan', 3,
  409. goog.dom.getElementsByTagName(goog.dom.TagName.TH, trs[0])[0].rowSpan);
  410. assert(
  411. 'Cell appears in multiple rows after merge',
  412. testObjects.basic.rows[0].columns[0] ==
  413. testObjects.basic.rows[2].columns[0]);
  414. }
  415. function testMergeCellsInRowAndColumn() {
  416. testObjects.basic.mergeCells(1, 1, 3, 2);
  417. tableSanityCheck(testObjects.basic, 4, 3);
  418. var trs =
  419. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.basic);
  420. var mergedCell =
  421. goog.dom.getElementsByTagName(goog.dom.TagName.TD, trs[1])[1];
  422. assertEquals('Merged cell has correct rowspan', 3, mergedCell.rowSpan);
  423. assertEquals('Merged cell has correct colspan', 2, mergedCell.colSpan);
  424. }
  425. function testMergeCellsAlreadyMerged() {
  426. testObjects.torture.mergeCells(5, 0, 8, 2);
  427. tableSanityCheck(testObjects.torture, 9, 3);
  428. var trs =
  429. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.torture);
  430. var mergedCell =
  431. goog.dom.getElementsByTagName(goog.dom.TagName.TH, trs[5])[0];
  432. assertEquals('Merged cell has correct rowspan', 4, mergedCell.rowSpan);
  433. assertEquals('Merged cell has correct colspan', 3, mergedCell.colSpan);
  434. }
  435. function testIllegalMergeNonRectangular() {
  436. // This should fail because it involves trying to merge two parts
  437. // of a 3-colspan cell with other cells
  438. var mergeSucceeded = testObjects.torture.mergeCells(3, 1, 5, 2);
  439. if (mergeSucceeded) {
  440. throw 'EditableTable allowed impossible merge!';
  441. }
  442. tableSanityCheck(testObjects.torture, 9, 3);
  443. }
  444. function testIllegalMergeSingleCell() {
  445. // This should fail because it involves merging a single cell
  446. var mergeSucceeded = testObjects.torture.mergeCells(0, 1, 0, 1);
  447. if (mergeSucceeded) {
  448. throw 'EditableTable allowed impossible merge!';
  449. }
  450. tableSanityCheck(testObjects.torture, 9, 3);
  451. }
  452. function testSplitCell() {
  453. testObjects.torture.splitCell(1, 1);
  454. tableSanityCheck(testObjects.torture, 9, 3);
  455. var trs =
  456. goog.dom.getElementsByTagName(goog.dom.TagName.TR, testElements.torture);
  457. assertEquals(
  458. 'Cell was split into multiple columns in row 1', 3,
  459. trs[1].getElementsByTagName('*').length);
  460. assertEquals(
  461. 'Cell was split into multiple columns in row 2', 3,
  462. trs[2].getElementsByTagName('*').length);
  463. }
  464. function testChildTableRowsNotCountedInParentTable() {
  465. tableSanityCheck(testObjects.nested, 2, 3);
  466. for (var i = 0; i < testObjects.nested.rows.length; i++) {
  467. var tr = testObjects.nested.rows[i].element;
  468. // A tr's parent is tbody, parent of that is table - check to
  469. // make sure the ancestor table is as expected. This means
  470. // that none of the child table's rows have been erroneously
  471. // loaded into the EditableTable.
  472. assertEquals(
  473. 'Row is child of parent table', testElements.nested,
  474. tr.parentNode.parentNode);
  475. }
  476. }
  477. /*
  478. // TODO(user): write more unit tests for selection stuff.
  479. // The following code is left in here for reference in implementing
  480. // this TODO.
  481. var tds = goog.dom.getElementsByTagName(
  482. goog.dom.TagName.TD, goog.dom.getElement('test1'));
  483. var range = goog.dom.Range.createFromNodes(tds[7], tds[9]);
  484. range.select();
  485. var cellSelection = new goog.editor.Table.CellSelection(range);
  486. assertEquals(0, cellSelection.getFirstColumnIndex());
  487. assertEquals(2, cellSelection.getLastColumnIndex());
  488. assertEquals(2, cellSelection.getFirstRowIndex());
  489. assertEquals(2, cellSelection.getLastRowIndex());
  490. assertTrue(cellSelection.isRectangle());
  491. range = goog.dom.Range.createFromNodes(tds[7], tds[12]);
  492. range.select();
  493. var cellSelection2 = new goog.editor.Table.CellSelection(range);
  494. assertFalse(cellSelection2.isRectangle());
  495. */