You are here

public function ViewsTableHighlighterTestCase::testNumberField in Views Table Highlighter 6

File

tests/views_table_highlighter.test, line 93
Test Views Table Highlighter.

Class

ViewsTableHighlighterTestCase
@file Test Views Table Highlighter.

Code

public function testNumberField() {
  $this
    ->drupalSetContent(views_embed_view('views_table_highlighter_test'));
  $rows = $this
    ->xpath("//table/tbody/tr");

  // since we have 3 nodes, our table should have 3 rows.
  $this
    ->assertEqual(3, count($rows), "view result doesn't have 3 rows");

  // row 0 should be unlit
  $attr = $rows[0]
    ->attributes();
  $this
    ->assertEqual($attr['class'], 'odd views-row-first', "row 0 doesn't have the correct classes");

  // row 1 should be blue
  $attr = $rows[1]
    ->attributes();
  $this
    ->assertEqual($attr['class'], 'even views-table-highlighter-blue', "row 1 doesn't have the correct classes");

  // row 2 should be red
  $attr = $rows[2]
    ->attributes();
  $this
    ->assertEqual($attr['class'], 'odd views-row-last views-table-highlighter-red', "row 2 doesn't have the correct classes");
}