mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix broken InlineFormAction
This commit is contained in:
parent
bf966a78ab
commit
db16248b9a
@ -20,7 +20,7 @@ class InlineFormAction extends FormField {
|
||||
*/
|
||||
public function __construct($action, $title = "", $extraClass = '') {
|
||||
$this->extraClass = ' '.$extraClass;
|
||||
parent::__construct($action, $title, null, null);
|
||||
parent::__construct($action, $title);
|
||||
}
|
||||
|
||||
public function performReadonlyTransformation() {
|
||||
@ -39,7 +39,8 @@ class InlineFormAction extends FormField {
|
||||
|
||||
return DBField::create_field(
|
||||
'HTMLText',
|
||||
FormField::create('input', array(
|
||||
FormField::create_tag('input', array(
|
||||
'type' => 'submit',
|
||||
'name' => sprintf('action_%s', $this->getName()),
|
||||
'value' => $this->title,
|
||||
'id' => $this->ID(),
|
||||
|
18
tests/forms/InlineFormActionTest.php
Normal file
18
tests/forms/InlineFormActionTest.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests {@see InlineFormAction}
|
||||
*/
|
||||
class InlineFormActionTest extends SapphireTest {
|
||||
|
||||
public function testField() {
|
||||
$action = new InlineFormAction('dothing', 'My Title', 'ss-action');
|
||||
$html = (string)$action->Field();
|
||||
$this->assertContains('<input', $html);
|
||||
$this->assertContains('type="submit"', $html);
|
||||
$this->assertContains('name="action_dothing"', $html);
|
||||
$this->assertContains('value="My Title"', $html);
|
||||
$this->assertContains('id="dothing"', $html);
|
||||
$this->assertContains('class="action ss-action"', $html);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user