Permalink
Browse files

API CHANGE: FormAction::FieldHolder() now returns just the Field(), s…

…o that a FieldList::forTemplate() returns a sensible result for an action list.
  • Loading branch information...
1 parent e4dbf80 commit 1fd8d19e287cc22ccbf580be8202745eb85033ef @sminnee sminnee committed Mar 7, 2012
Showing with 17 additions and 0 deletions.
  1. +4 −0 forms/FormAction.php
  2. +13 −0 tests/forms/FieldListTest.php
View
@@ -73,6 +73,10 @@ function Field($properties = array()) {
);
return $this->customise($properties)->renderWith($this->getTemplate());
}
+
+ function FieldHolder() {
+ return $this->Field();
+ }
public function Type() {
return 'action';
@@ -725,7 +725,20 @@ function testForTemplate() {
);
$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() {

0 comments on commit 1fd8d19

Please sign in to comment.