API CHANGE: FormAction::FieldHolder() now returns just the Field(), so that a FieldList::forTemplate() returns a sensible result for an action list.

This commit is contained in:
Sam Minnee 2012-03-08 10:02:57 +13:00
parent e4dbf8065b
commit 1fd8d19e28
2 changed files with 17 additions and 0 deletions

View File

@ -73,6 +73,10 @@ class FormAction extends FormField {
);
return $this->customise($properties)->renderWith($this->getTemplate());
}
function FieldHolder() {
return $this->Field();
}
public function Type() {
return 'action';

View File

@ -725,7 +725,20 @@ class FieldListTest extends SapphireTest {
);
$this->assertEquals($a->FieldHolder() . $b->FieldHolder(), $set->forTempalte());
}
/**
* FieldList::forTemplate() for an action list returns a concatenation of Field values.
* Internally, this works by having FormAction::FieldHolder return just the field, but it's an important
* use-case to test.
*/
function testForTemplateForActionList() {
$set = new FieldList(
$a = new FormAction('A'),
$b = new FormAction('B')
);
$this->assertEquals($a->Field() . $b->Field(), $set->forTempalte());
}
function testMakeFieldReadonly() {