B2G/gecko/accessible/tests/mochitest/table.js
/**
 * Test columnHeaderCells and rowHeaderCells of accessible table.
 */
Test columnHeaderCells and rowHeaderCells of accessible table.
Test columnHeaderCells and rowHeaderCells of accessible table .
function testHeaderCells(aHeaderInfoMap)
{
  for (var testIdx = 0; testIdx < aHeaderInfoMap.length; testIdx++) {
    var dataCellIdentifier = aHeaderInfoMap[testIdx].cell;
    var dataCell = getAccessible(dataCellIdentifier, [nsIAccessibleTableCell]);
    var rowHeaderCells = aHeaderInfoMap[testIdx].rowHeaderCells;
    var rowHeaderCellsCount = rowHeaderCells.length;
    var actualRowHeaderCells = dataCell.rowHeaderCells;
    var actualRowHeaderCellsCount = actualRowHeaderCells.length;
    is(actualRowHeaderCellsCount, rowHeaderCellsCount,
       "Wrong number of row header cells for the cell " +
       prettyName(dataCellIdentifier));
    if (actualRowHeaderCellsCount == rowHeaderCellsCount) {
      for (var idx = 0; idx < rowHeaderCellsCount; idx++) {
        var rowHeaderCell = getAccessible(rowHeaderCells[idx]);
        var actualRowHeaderCell =
          actualRowHeaderCells.queryElementAt(idx, nsIAccessible);
        ok(actualRowHeaderCell, rowHeaderCell,
           "Wrong row header cell at index " + idx + " for the cell " +
           prettyName(rowHeaderCells[idx]));
      }
    }
    var colHeaderCells = aHeaderInfoMap[testIdx].columnHeaderCells;
    var colHeaderCellsCount = colHeaderCells.length;
    var actualColHeaderCells = dataCell.columnHeaderCells;
    var actualColHeaderCellsCount = actualColHeaderCells.length;
    is(actualColHeaderCellsCount, colHeaderCellsCount,
       "Wrong number of column header cells for the cell " +
       prettyName(dataCellIdentifier));
    if (actualColHeaderCellsCount == colHeaderCellsCount) {
      for (var idx = 0; idx < colHeaderCellsCount; idx++) {
        var colHeaderCell = getAccessible(colHeaderCells[idx]);
        var actualColHeaderCell =
          actualColHeaderCells.queryElementAt(idx, nsIAccessible);
        ok(actualColHeaderCell, colHeaderCell,
           "Wrong column header cell at index " + idx + " for the cell " +
           prettyName(colHeaderCells[idx]));
      }
    }
  }
}
function testHeaderCells ( aHeaderInfoMap ) { for ( var testIdx = 0 ; testIdx < aHeaderInfoMap . length ; testIdx ++ ) { var dataCellIdentifier = aHeaderInfoMap [ testIdx ] . cell ; var dataCell = getAccessible ( dataCellIdentifier , [ nsIAccessibleTableCell ] ) ; var rowHeaderCells = aHeaderInfoMap [ testIdx ] . rowHeaderCells ; var rowHeaderCellsCount = rowHeaderCells . length ; var actualRowHeaderCells = dataCell . rowHeaderCells ; var actualRowHeaderCellsCount = actualRowHeaderCells . length ; is ( actualRowHeaderCellsCount , rowHeaderCellsCount , "Wrong number of row header cells for the cell " + prettyName ( dataCellIdentifier ) ) ; if ( actualRowHeaderCellsCount == rowHeaderCellsCount ) { for ( var idx = 0 ; idx < rowHeaderCellsCount ; idx ++ ) { var rowHeaderCell = getAccessible ( rowHeaderCells [ idx ] ) ; var actualRowHeaderCell = actualRowHeaderCells . queryElementAt ( idx , nsIAccessible ) ; ok ( actualRowHeaderCell , rowHeaderCell , "Wrong row header cell at index " + idx + " for the cell " + prettyName ( rowHeaderCells [ idx ] ) ) ; } } var colHeaderCells = aHeaderInfoMap [ testIdx ] . columnHeaderCells ; var colHeaderCellsCount = colHeaderCells . length ; var actualColHeaderCells = dataCell . columnHeaderCells ; var actualColHeaderCellsCount = actualColHeaderCells . length ; is ( actualColHeaderCellsCount , colHeaderCellsCount , "Wrong number of column header cells for the cell " + prettyName ( dataCellIdentifier ) ) ; if ( actualColHeaderCellsCount == colHeaderCellsCount ) { for ( var idx = 0 ; idx < colHeaderCellsCount ; idx ++ ) { var colHeaderCell = getAccessible ( colHeaderCells [ idx ] ) ; var actualColHeaderCell = actualColHeaderCells . queryElementAt ( idx , nsIAccessible ) ; ok ( actualColHeaderCell , colHeaderCell , "Wrong column header cell at index " + idx + " for the cell " + prettyName ( colHeaderCells [ idx ] ) ) ; } } } }
Test columnHeaderCells and rowHeaderCells of accessible table.
Test columnHeaderCells and rowHeaderCells of accessible table .
// row header cells // column header cells