function testCanReferenceCustomMethodsAndFieldsOnObject() { $table = new TableListField("Tester", "TableListFieldTest_Obj", array("A" => "Col A", "B" => "Col B", "C" => "Col C", "D" => "Col D", "E" => "Col E")); // A TableListField must be inside a form for its links to be generated $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet($table), new FieldSet()); $result = $table->FieldHolder(); // Do a quick check to ensure that some of the D() and getE() values got through $this->assertRegExp('/>\\s*a2\\s*</', $result); $this->assertRegExp('/>\\s*a2\\/b2\\/c2\\s*</', $result); $this->assertRegExp('/>\\s*a2-e</', $result); }
function testSelectOptionsRendering() { $obj1 = $this->objFromFixture('TableListFieldTest_Obj', 'one'); $obj2 = $this->objFromFixture('TableListFieldTest_Obj', 'two'); $obj3 = $this->objFromFixture('TableListFieldTest_Obj', 'three'); $table = new TableListField("Tester", "TableListFieldTest_Obj", array("A" => "Col A")); $table->Markable = true; $table->addSelectOptions(array("F" => "FieldF")); $tableHTML = $table->FieldHolder(); $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']); }
function FieldHolder() { Requirements::javascript('queuedjobs/javascript/QueuedJobListField.js'); return parent::FieldHolder(); }