summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests/test_nsITableEditor_getCellDataAt.html
blob: 388281c04445b7152a7160c8d7faf342454bb0a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
<!DOCTYPE html>
<html>
<head>
  <title>Test for nsITableEditor.getCellDataAt()</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<div id="display">
</div>
<div id="content" contenteditable>out of table<table><tr><td>default content</td></tr></table></div>
<pre id="test">
</pre>

<script class="testbody" type="application/javascript">

SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
  let editor = document.getElementById("content");
  let selection = document.getSelection();

  let cellElementWrapper;
  let startRowIndexWrapper, startColumnIndexWrapper;
  let rowspanWrapper, colspanWrapper;
  let effectiveRowspanWrapper, effectiveColspanWrapper;
  let isSelectedWrapper;

  function reset() {
    cellElementWrapper = {};
    startRowIndexWrapper = {};
    startColumnIndexWrapper = {};
    rowspanWrapper = {};
    colspanWrapper = {};
    effectiveRowspanWrapper = {};
    effectiveColspanWrapper = {};
    isSelectedWrapper = {};
  }

  editor.focus();
  selection.collapse(editor.firstChild, 0);
  try {
    getTableEditor().getCellDataAt(null, 0, 0,
                                   cellElementWrapper,
                                   startRowIndexWrapper, startColumnIndexWrapper,
                                   rowspanWrapper, colspanWrapper,
                                   effectiveRowspanWrapper, effectiveColspanWrapper,
                                   isSelectedWrapper);
    ok(false, "getTableEditor().getCellDataAt(null, 0, 0) should throw exception when selection is outside of any <table>s");
  } catch (e) {
    ok(true, "getTableEditor().getCellDataAt(null, 0, 0) should throw exception when selection is outside of any <table>s");
  }

  selection.removeAllRanges();
  try {
    getTableEditor().getCellDataAt(null, 0, 0,
                                   cellElementWrapper,
                                   startRowIndexWrapper, startColumnIndexWrapper,
                                   rowspanWrapper, colspanWrapper,
                                   effectiveRowspanWrapper, effectiveColspanWrapper,
                                   isSelectedWrapper);
    ok(false, "getTableEditor().getCellDataAt(null, 0, 0) should throw exception when selection has no ranges");
  } catch (e) {
    ok(true, "getTableEditor().getCellDataAt(null, 0, 0) should throw exception when selection has no ranges");
  }

  // Collapse in text node in the cell element.
  selection.collapse(editor.firstChild.nextSibling.firstChild.firstChild.firstChild.firstChild, 0);
  reset();
  getTableEditor().getCellDataAt(null, 0, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.nextSibling.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(null, 0, 0) should return the <td> element when selection is in it");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 0 for startRowIndex when selection is in the cell");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 0 for startColumnIndex when selection is in the cell");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for rowspan when selection is in the cell");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for colspan when selection is in the cell");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for effectiveRowspan when selection is in the cell");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for effectiveColspan when selection is in the cell");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(null, 0, 0) should return false for isSelected when selection is in the cell");

  // Select the cell
  selection.setBaseAndExtent(editor.firstChild.nextSibling.firstChild.firstChild, 0,
                             editor.firstChild.nextSibling.firstChild.firstChild, 1);
  reset();
  getTableEditor().getCellDataAt(null, 0, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.nextSibling.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(null, 0, 0) should return the <td> element when it's selected");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 0 for startRowIndex when the cell is selected");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 0 for startColumnIndex when the cell is selected");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for rowspan when the cell is selected");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for colspan when the cell is selected");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for effectiveRowspan when the cell is selected");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for effectiveColspan when the cell is selected");
  is(isSelectedWrapper.value, true,
     "getTableEditor().getCellDataAt(null, 0, 0) should return true for isSelected when the cell is selected");

  // Select the <tr>
  selection.setBaseAndExtent(editor.firstChild.nextSibling.firstChild, 0,
                             editor.firstChild.nextSibling.firstChild, 1);
  reset();
  getTableEditor().getCellDataAt(null, 0, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.nextSibling.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(null, 0, 0) should return the <td> element when the <tr> is selected");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 0 for startRowIndex when the <tr> is selected");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 0 for startColumnIndex when the <tr> is selected");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for rowspan when the <tr> is selected");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for colspan when the <tr> is selected");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for effectiveRowspan when the <tr> is selected");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for effectiveColspan when the <tr> is selected");
  is(isSelectedWrapper.value, true,
     "getTableEditor().getCellDataAt(null, 0, 0) should return true for isSelected when the <tr> is selected");

  // Select the <table>
  selection.setBaseAndExtent(editor, 1, editor, 2);
  reset();
  getTableEditor().getCellDataAt(null, 0, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.nextSibling.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(null, 0, 0) should return the <td> element when the <table> is selected");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 0 for startRowIndex when the <table> is selected");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 0 for startColumnIndex when the <table> is selected");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for rowspan when the <table> is selected");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for colspan when the <table> is selected");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for effectiveRowspan when the <table> is selected");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(null, 0, 0) should return 1 for effectiveColspan when the <table> is selected");
  is(isSelectedWrapper.value, true,
     "getTableEditor().getCellDataAt(null, 0, 0) should return true for isSelected when the <table> is selected");

  selection.removeAllRanges();
  editor.innerHTML = "<table>" +
                       "<tr><td>cell1-1</td><td>cell1-2</td></tr>" +
                       "<tr><td>cell2-1</td><td>cell2-2</td></tr>" +
                       "<tr><td>cell3-1</td><td>cell3-2</td></tr>" +
                     "</table>";
  editor.focus();
  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 0, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return the first <td> element");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for startRowIndex");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for startColumnIndex");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for rowspan");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for colspan");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for effectiveRowspan");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for effectiveColspan");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return false for isSelected");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 0, 1,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild.nextSibling,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return the second <td> element");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 0 for startRowIndex");
  is(startColumnIndexWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for startColumnIndex");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for rowspan");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for colspan");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for effectiveRowspan");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for effectiveColspan");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return false for isSelected");

  try {
    getTableEditor().getCellDataAt(editor.firstChild, 0, 2,
                                   cellElementWrapper,
                                   startRowIndexWrapper, startColumnIndexWrapper,
                                   rowspanWrapper, colspanWrapper,
                                   effectiveRowspanWrapper, effectiveColspanWrapper,
                                   isSelectedWrapper);
    ok(false, "getTableEditor().getCellDataAt(<table>, 0, 2) should throw exception since column index is out of bounds");
  } catch (e) {
    ok(true, "getTableEditor().getCellDataAt(<table>, 0, 2) should throw exception since column index is out of bounds");
  }

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 1, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.nextSibling.firstChild,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return the first <td> element in the second row");
  is(startRowIndexWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 1 for startRowIndex");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 0 for startColumnIndex");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 1 for rowspan");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 1 for colspan");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 1 for effectiveRowspan");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 1 for effectiveColspan");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return false for isSelected");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 2, 1,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.nextSibling.nextSibling.firstChild.nextSibling,
     "getTableEditor().getCellDataAt(<table>, 2, 1) should return the second <td> element in the last row");
  is(startRowIndexWrapper.value, 2,
     "getTableEditor().getCellDataAt(<table>, 2, 1) should return 1 for startRowIndex");
  is(startColumnIndexWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 2, 1) should return 1 for startColumnIndex");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 2, 1) should return 1 for rowspan");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 2, 1) should return 1 for colspan");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 2, 1) should return 1 for effectiveRowspan");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 2, 1) should return 1 for effectiveColspan");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 2, 1) should return false for isSelected");

  try {
    getTableEditor().getCellDataAt(editor.firstChild, 2, 2,
                                   cellElementWrapper,
                                   startRowIndexWrapper, startColumnIndexWrapper,
                                   rowspanWrapper, colspanWrapper,
                                   effectiveRowspanWrapper, effectiveColspanWrapper,
                                   isSelectedWrapper);
    ok(false, "getTableEditor().getCellDataAt(<table>, 2, 2) should throw exception since column index is out of bounds");
  } catch (e) {
    ok(true, "getTableEditor().getCellDataAt(<table>, 2, 2) should throw exception since column index is out of bounds");
  }

  try {
    getTableEditor().getCellDataAt(editor.firstChild, 3, 0,
                                   cellElementWrapper,
                                   startRowIndexWrapper, startColumnIndexWrapper,
                                   rowspanWrapper, colspanWrapper,
                                   effectiveRowspanWrapper, effectiveColspanWrapper,
                                   isSelectedWrapper);
    ok(false, "getTableEditor().getCellDataAt(<table>, 3, 0) should throw exception since row index is out of bounds");
  } catch (e) {
    ok(true, "getTableEditor().getCellDataAt(<table>, 3, 0) should throw exception since row index is out of bounds");
  }

  selection.removeAllRanges();
  editor.innerHTML = "<table>" +
                       '<tr><td rowspan="3">cell1-1</td><td>cell1-2</td><td>cell1-3</td><td>cell1-4</td></tr>' +
                       "<tr><td>cell2-2</td></tr>" +
                       "<tr><td>cell3-2</td><td>cell3-3</td></tr>" +
                       '<tr><td colspan="3">cell4-1</td><td>cell4-4</td></tr>' +
                     "</table>";
  editor.focus();
  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 0, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return the first <td> element whose rowspan is 3");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for startRowIndex (the cell's rowspan is 3)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for startColumnIndex (the cell's rowspan is 3)");
  is(rowspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 3 for rowspan (the cell's rowspan is 3)");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for colspan (the cell's rowspan is 3)");
  is(effectiveRowspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 3 for effectiveRowspan (the cell's rowspan is 3)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for effectiveColspan (the cell's rowspan is 3)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return false for isSelected (the cell's rowspan is 3)");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 1, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return the first <td> element whose rowspan is 3");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 0 for startRowIndex (the cell's rowspan is 3)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 0 for startColumnIndex (the cell's rowspan is 3)");
  is(rowspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 3 for rowspan (the cell's rowspan is 3)");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 1 for colspan (the cell's rowspan is 3)");
  is(effectiveRowspanWrapper.value, 2,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 2 for effectiveRowspan (the cell's rowspan is 3)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 1 for effectiveColspan (the cell's rowspan is 3)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return false for isSelected (the cell's rowspan is 3)");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 2, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(<table>, 2, 0) should return the first <td> element whose rowspan is 3");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 2, 0) should return 0 for startRowIndex (the cell's rowspan is 3)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 2, 0) should return 0 for startColumnIndex (the cell's rowspan is 3)");
  is(rowspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 2, 0) should return 3 for rowspan (the cell's rowspan is 3)");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 2, 0) should return 1 for colspan (the cell's rowspan is 3)");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 2, 0) should return 1 for effectiveRowspan (the cell's rowspan is 3)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 2, 0) should return 1 for effectiveColspan (the cell's rowspan is 3)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 2, 0) should return false for isSelected (the cell's rowspan is 3)");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 3, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.firstChild,
     "getTableEditor().getCellDataAt(<table>, 3, 0) should return the first <td> element in the last row whose colspan is 3");
  is(startRowIndexWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 3, 0) should return 3 for startRowIndex (the cell's colspan is 3)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 3, 0) should return 0 for startColumnIndex (the cell's colspan is 3)");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 0) should return 1 for rowspan (the cell's colspan is 3)");
  is(colspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 3, 0) should return 3 for colspan (the cell's colspan is 3)");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 0) should return 1 for effectiveRowspan (the cell's colspan is 3)");
  is(effectiveColspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 3, 0) should return 3 for effectiveColspan (the cell's colspan is 3)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 3, 0) should return false for isSelected (the cell's colspan is 3)");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 3, 1,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.firstChild,
     "getTableEditor().getCellDataAt(<table>, 3, 1) should return the first <td> element in the last row whose colspan is 3");
  is(startRowIndexWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 3, 1) should return 3 for startRowIndex (the cell's colspan is 3)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 3, 1) should return 0 for startColumnIndex (the cell's colspan is 3)");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 1) should return 1 for rowspan (the cell's colspan is 3)");
  is(colspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 3, 1) should return 3 for colspan (the cell's colspan is 3)");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 1) should return 1 for effectiveRowspan (the cell's colspan is 3)");
  is(effectiveColspanWrapper.value, 2,
     "getTableEditor().getCellDataAt(<table>, 3, 1) should return 2 for effectiveColspan (the cell's colspan is 3)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 3, 1) should return false for isSelected (the cell's colspan is 3)");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 3, 2,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.firstChild,
     "getTableEditor().getCellDataAt(<table>, 3, 2) should return the first <td> element in the last row whose colspan is 3");
  is(startRowIndexWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 3, 2) should return 3 for startRowIndex (the cell's colspan is 3)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 3, 2) should return 0 for startColumnIndex (the cell's colspan is 3)");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 2) should return 1 for rowspan (the cell's colspan is 3)");
  is(colspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 3, 2) should return 3 for colspan (the cell's colspan is 3)");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 2) should return 1 for effectiveRowspan (the cell's colspan is 3)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 2) should return 1 for effectiveColspan (the cell's colspan is 3)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 3, 2) should return false for isSelected (the cell's colspan is 3)");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 3, 3,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.firstChild.nextSibling,
     "getTableEditor().getCellDataAt(<table>, 3, 3) should return the second <td> element in the last row");
  is(startRowIndexWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 3, 3) should return 3 for startRowIndex (right cell of the cell whose colspan is 3)");
  is(startColumnIndexWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 3, 3) should return 3 for startColumnIndex (right cell of the cell whose colspan is 3)");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 3) should return 1 for rowspan (right cell of the cell whose colspan is 3)");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 3) should return 1 for colspan (right cell of the cell whose colspan is 3)");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 3) should return 1 for effectiveRowspan (right cell of the cell whose colspan is 3)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 3, 3) should return 1 for effectiveColspan (right cell of the cell whose colspan is 3)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 3, 3) should return false for isSelected (right cell of the cell whose colspan is 3)");

  try {
    getTableEditor().getCellDataAt(editor.firstChild, 3, 4,
                                   cellElementWrapper,
                                   startRowIndexWrapper, startColumnIndexWrapper,
                                   rowspanWrapper, colspanWrapper,
                                   effectiveRowspanWrapper, effectiveColspanWrapper,
                                   isSelectedWrapper);
    ok(false, "getTableEditor().getCellDataAt(<table>, 3, 4) should throw exception since column index is out of bounds");
  } catch (e) {
    ok(true, "getTableEditor().getCellDataAt(<table>, 3, 4) should throw exception since column index is out of bounds");
  }

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 0, 1,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild.nextSibling,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return the second <td> element in the first row");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 0 for startRowIndex (right cell of the cell whose rowspan is 3)");
  is(startColumnIndexWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for startColumnIndex (right cell of the cell whose rowspan is 3)");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for rowspan (right cell of the cell whose rowspan is 3)");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for colspan (right cell of the cell whose rowspan is 3)");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for effectiveRowspan (right cell of the cell whose rowspan is 3)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for effectiveColspan (right cell of the cell whose rowspan is 3)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return false for isSelected (right cell of the cell whose rowspan is 3)");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 1, 1,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.nextSibling.firstChild,
     "getTableEditor().getCellDataAt(<table>, 1, 1) should return the first <td> element in the second row");
  is(startRowIndexWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 1) should return 1 for startRowIndex (right cell of the cell whose rowspan is 3)");
  is(startColumnIndexWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 1) should return 1 for startColumnIndex (right cell of the cell whose rowspan is 3)");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 1) should return 1 for rowspan (right cell of the cell whose rowspan is 3)");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 1) should return 1 for colspan (right cell of the cell whose rowspan is 3)");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 1) should return 1 for effectiveRowspan (right cell of the cell whose rowspan is 3)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 1) should return 1 for effectiveColspan (right cell of the cell whose rowspan is 3)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 1, 1) should return false for isSelected (right cell of the cell whose rowspan is 3)");

  try {
    getTableEditor().getCellDataAt(editor.firstChild, 1, 2,
                                   cellElementWrapper,
                                   startRowIndexWrapper, startColumnIndexWrapper,
                                   rowspanWrapper, colspanWrapper,
                                   effectiveRowspanWrapper, effectiveColspanWrapper,
                                   isSelectedWrapper);
    ok(false, "getTableEditor().getCellDataAt(<table>, 1, 2) should throw exception since there is no cell due to non-rectangular table");
  } catch (e) {
    ok(true, "getTableEditor().getCellDataAt(<table>, 1, 2) should throw exception since there is no cell due to non-rectangular table");
  }

  selection.removeAllRanges();
  editor.innerHTML = "<table>" +
                       '<tr><td rowspan="3" colspan="2">cell1-1</td></tr>' +
                     "</table>";
  editor.focus();
  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 0, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return the first <td> element whose rowspan is 3 and colspan is 2");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for startRowIndex (the cell's rowspan is 3 and colspan is 2)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for startColumnIndex (the cell's rowspan is 3 and colspan is 2)");
  is(rowspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 3 for rowspan (the cell's rowspan is 3 and colspan is 2)");
  is(colspanWrapper.value, 2,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 2 for colspan (the cell's rowspan is 3 and colspan is 2)");
  // XXX Not sure whether expected behavior or not.
  todo_is(effectiveRowspanWrapper.value, 3,
          "getTableEditor().getCellDataAt(<table>, 0, 0) should return 3 for effectiveRowspan (the cell's rowspan is 3 and colspan is 2)");
  is(effectiveColspanWrapper.value, 2,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 2 for effectiveColspan (the cell's rowspan is 3 and colspan is 2)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return false for isSelected (the cell's rowspan is 3 and colspan is 2)");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 0, 1,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return the first <td> element whose rowspan is 3 and colspan is 2");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 0 for startRowIndex (the cell's rowspan is 3 and colspan is 2)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 0 for startColumnIndex (the cell's rowspan is 3 and colspan is 2)");
  is(rowspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 3 for rowspan (the cell's rowspan is 3 and colspan is 2)");
  is(colspanWrapper.value, 2,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 2 for colspan (the cell's rowspan is 3 and colspan is 2)");
  // XXX Not sure whether expected behavior or not.
  todo_is(effectiveRowspanWrapper.value, 3,
          "getTableEditor().getCellDataAt(<table>, 0, 1) should return 3 for effectiveRowspan (the cell's rowspan is 3 and colspan is 2)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return 1 for effectiveColspan (the cell's rowspan is 3 and colspan is 2)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 0, 1) should return false for isSelected (the cell's rowspan is 3 and colspan is 2)");

  try {
    getTableEditor().getCellDataAt(editor.firstChild, 1, 0,
                                   cellElementWrapper,
                                   startRowIndexWrapper, startColumnIndexWrapper,
                                   rowspanWrapper, colspanWrapper,
                                   effectiveRowspanWrapper, effectiveColspanWrapper,
                                   isSelectedWrapper);
    is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild,
       "getTableEditor().getCellDataAt(<table>, 1, 0) should return the first <td> element whose rowspan is 3 and colspan is 2");
    is(startRowIndexWrapper.value, 0,
       "getTableEditor().getCellDataAt(<table>, 1, 0) should return 0 for startRowIndex (the cell's rowspan is 3 and colspan is 2)");
    is(startColumnIndexWrapper.value, 0,
       "getTableEditor().getCellDataAt(<table>, 1, 0) should return 0 for startColumnIndex (the cell's rowspan is 3 and colspan is 2)");
    is(rowspanWrapper.value, 3,
       "getTableEditor().getCellDataAt(<table>, 1, 0) should return 3 for rowspan (the cell's rowspan is 3 and colspan is 2)");
    is(colspanWrapper.value, 2,
       "getTableEditor().getCellDataAt(<table>, 1, 0) should return 2 for colspan (the cell's rowspan is 3 and colspan is 2)");
    // XXX Not sure whether expected behavior or not.
    todo_is(effectiveRowspanWrapper.value, 2,
            "getTableEditor().getCellDataAt(<table>, 1, 0) should return 2 for effectiveRowspan (the cell's rowspan is 3 and colspan is 2)");
    is(effectiveColspanWrapper.value, 1,
       "getTableEditor().getCellDataAt(<table>, 1, 0) should return 1 for effectiveColspan (the cell's rowspan is 3 and colspan is 2)");
    is(isSelectedWrapper.value, false,
       "getTableEditor().getCellDataAt(<table>, 1, 0) should return false for isSelected (the cell's rowspan is 3 and colspan is 2)");
  } catch (e) {
    todo(false, "getTableEditor().getCellDataAt(<table>, 1, 0) shouldn't throw exception since rowspan expands the table");
  }

  selection.removeAllRanges();
  editor.innerHTML = "<table>" +
                       '<tr><td rowspan="0">cell1-1</td><td>cell1-2</td></tr>' +
                       "<tr><td>cell2-2</td></tr>" +
                       "<tr><td>cell3-2</td></tr>" +
                     "</table>";
  editor.focus();
  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 0, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return the first <td> element whose rowspan is 0");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for startRowIndex (the cell's rowspan is 0)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for startColumnIndex (the cell's rowspan is 0)");
  is(rowspanWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for rowspan (the cell's rowspan is 0)");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for colspan (the cell's rowspan is 0)");
  is(effectiveRowspanWrapper.value, 3,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 3 for effectiveRowspan (the cell's rowspan is 0)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for effectiveColspan (the cell's rowspan is 0)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return false for isSelected (the cell's rowspan is 0)");

  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 1, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return the first <td> element whose rowspan is 0");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 0 for startRowIndex (the cell's rowspan is 0)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 0 for startColumnIndex (the cell's rowspan is 0)");
  is(rowspanWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 0 for rowspan (the cell's rowspan is 0)");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 1 for colspan (the cell's rowspan is 0)");
  is(effectiveRowspanWrapper.value, 2,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 3 for effectiveRowspan (the cell's rowspan is 0)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return 1 for effectiveColspan (the cell's rowspan is 0)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 1, 0) should return false for isSelected (the cell's rowspan is 0)");

  // FYI: colspan must be 1 - 1000, 0 is invalid.
  selection.removeAllRanges();
  editor.innerHTML = "<table>" +
                       '<tr><td colspan="0">cell1-1</td></tr>' +
                       "<tr><td>cell2-1</td><td>cell2-2</td><td>cell2-3</td></tr>" +
                     "</table>";
  editor.focus();
  reset();
  getTableEditor().getCellDataAt(editor.firstChild, 0, 0,
                                 cellElementWrapper,
                                 startRowIndexWrapper, startColumnIndexWrapper,
                                 rowspanWrapper, colspanWrapper,
                                 effectiveRowspanWrapper, effectiveColspanWrapper,
                                 isSelectedWrapper);
  is(cellElementWrapper.value, editor.firstChild.firstChild.firstChild.firstChild,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return the first <td> element whose colspan is 0");
  is(startRowIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for startRowIndex (the cell's colspan is 0)");
  is(startColumnIndexWrapper.value, 0,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 0 for startColumnIndex (the cell's colspan is 0)");
  is(rowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for rowspan (the cell's colspan is 0)");
  is(colspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for colspan (the cell's colspan is 0)");
  is(effectiveRowspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 3 for effectiveRowspan (the cell's colspan is 0)");
  is(effectiveColspanWrapper.value, 1,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return 1 for effectiveColspan (the cell's colspan is 0)");
  is(isSelectedWrapper.value, false,
     "getTableEditor().getCellDataAt(<table>, 0, 0) should return false for isSelected (the cell's colspan is 0)");

  try {
    getTableEditor().getCellDataAt(editor.firstChild, 0, 1,
                                   cellElementWrapper,
                                   startRowIndexWrapper, startColumnIndexWrapper,
                                   rowspanWrapper, colspanWrapper,
                                   effectiveRowspanWrapper, effectiveColspanWrapper,
                                   isSelectedWrapper);
    ok(false, "getTableEditor().getCellDataAt(<table>, 0, 1) should throw exception since there is no cell due to right side of a cell whose colspan is 0");
  } catch (e) {
    ok(true, "getTableEditor().getCellDataAt(<table>, 0, 1) should throw exception since there is no cell due to right side of a cell whose colspan is 0");
  }

  SimpleTest.finish();
});

function getTableEditor() {
  var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
  return editingSession.getEditorForWindow(window).QueryInterface(SpecialPowers.Ci.nsITableEditor);
}

</script>
</body>

</html>