Permalink
Browse files

MINOR More solid markup testing in TableListFieldTest through xpath (…

…from r105305)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112496 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
chillu committed Oct 15, 2010
1 parent 1dc0675 commit 567143b3ff673cc7004c3420f9a096c9157866fd
Showing with 6 additions and 4 deletions.
  1. +6 −4 tests/forms/TableListFieldTest.php
@@ -150,11 +150,13 @@ function testSelectOptionsRendering() {
$table->addSelectOptions(array("F"=>"FieldF"));
$tableHTML = $table->FieldHolder();
- $this->assertContains('rel="F"', $tableHTML);
- $this->assertRegExp('/<tr[^>]*id="record-Tester-' . $obj1->ID . '"[^>]*>[^<]*<td[^>]*class="markingcheckbox F"[^>]*>/si', $tableHTML);
- $this->assertRegExp('/<tr[^>]*id="record-Tester-' . $obj1->ID . '"[^>]*>[^<]*<td[^>]*class="markingcheckbox"[^>]*>/si', $tableHTML);
- $this->assertRegExp('/<tr[^>]*id="record-Tester-' . $obj3->ID . '"[^>]*>[^<]*<td[^>]*class="markingcheckbox F"[^>]*>/si', $tableHTML);
+ $p = new CSSContentParser($tableHTML);
+ $this->assertContains('rel="F"', $tableHTML);
+ $tbody = $p->getByXpath('//tbody');
+ $this->assertContains('markingcheckbox F', (string)$tbody[0]->tr[0]->td[0]['class']);
+ $this->assertContains('markingcheckbox', (string)$tbody[0]->tr[1]->td[0]['class']);
+ $this->assertContains('markingcheckbox F', (string)$tbody[0]->tr[2]->td[0]['class']);
}
/**

0 comments on commit 567143b

Please sign in to comment.