* Test that highlighting a cell correctly sets the style.
*/
public void testHighlight() {
// Initialize the grid
SelectionGrid testGrid = getSelectionGrid();
RowFormatter rowFormatter = testGrid.getRowFormatter();
CellFormatter cellFormatter = testGrid.getCellFormatter();
// Highlight a cell
assertEquals(rowFormatter.getStyleName(1), "");
assertEquals(cellFormatter.getStyleName(1, 1), "");
testGrid.highlightCell(cellFormatter.getElement(1, 1));
assertEquals(rowFormatter.getStyleName(1), "highlighted");
assertEquals(cellFormatter.getStyleName(1, 1), "highlighted");
// Highlight a cell in the same row
testGrid.highlightCell(cellFormatter.getElement(1, 3));
assertEquals(rowFormatter.getStyleName(1), "highlighted");
assertEquals(cellFormatter.getStyleName(1, 1), "");
assertEquals(cellFormatter.getStyleName(1, 3), "highlighted");
// Highlight a cell in a different row
testGrid.highlightCell(cellFormatter.getElement(2, 4));
assertEquals(rowFormatter.getStyleName(1), "");
assertEquals(cellFormatter.getStyleName(1, 3), "");
assertEquals(rowFormatter.getStyleName(2), "highlighted");
assertEquals(cellFormatter.getStyleName(2, 4), "highlighted");
// Unhighlight the cell
testGrid.highlightCell(null);
assertEquals(rowFormatter.getStyleName(2), "");
assertEquals(cellFormatter.getStyleName(2, 4), "");
}