mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Reflecting new radio signature in usage, and adding tests for separator usage
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5749 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
e7bccfe7a8
commit
b06c7f88e2
2 changed files with 9 additions and 10 deletions
|
@ -517,14 +517,6 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
unset($options['options']);
|
||||
}
|
||||
|
||||
$inBetween = null;
|
||||
if (isset($options['inbetween'])) {
|
||||
if (!empty($options['inbetween'])) {
|
||||
$inBetween = $options['inbetween'];
|
||||
}
|
||||
unset($options['inbetween']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($options['type'])) {
|
||||
|
@ -670,7 +662,7 @@ class FormHelper extends AppHelper {
|
|||
$out = $before . $this->checkbox($fieldName, $options) . $between . $out;
|
||||
break;
|
||||
case 'radio':
|
||||
$out = $before . $out . $this->radio($fieldName, $radioOptions, $inBetween, $options) . $between;
|
||||
$out = $before . $out . $this->radio($fieldName, $radioOptions, $options) . $between;
|
||||
break;
|
||||
case 'text':
|
||||
case 'password':
|
||||
|
|
|
@ -478,9 +478,16 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertPattern('/id="Field1"/', $result);
|
||||
$this->assertNoPattern('/id="ModelField"/', $result);
|
||||
$this->assertNoPattern('/checked="checked"/', $result);
|
||||
|
||||
$this->assertPattern('/^<fieldset><legend>field<\/legend>(<input[^<>]+><label[^<>]+>option [AB]<\/label>)+<\/fieldset>$/', $result);
|
||||
$this->assertPattern('/(<input[^<>]+name="data\[Model\]\[field\]"[^<>]+>.+){2}/', $result);
|
||||
|
||||
$result = $this->Form->radio('Model.field', array('option A', 'option B'), array('separator' => '<br/>'));
|
||||
$this->assertPattern('/id="Field0"/', $result);
|
||||
$this->assertPattern('/id="Field1"/', $result);
|
||||
$this->assertNoPattern('/id="ModelField"/', $result);
|
||||
$this->assertNoPattern('/checked="checked"/', $result);
|
||||
$this->assertPattern('/^<fieldset><legend>field<\/legend><input[^<>]+><label[^<>]+>option A<\/label><br[^<>+]><input[^<>]+><label[^<>]+>option B<\/label><\/fieldset>$/', $result);
|
||||
$this->assertPattern('/(<input[^<>]+name="data\[Model\]\[field\]"[^<>]+>.+){2}/', $result);
|
||||
|
||||
$result = $this->Form->radio('Model.field', array('1' => 'Yes', '0' => 'No'), array('value' => '1'));
|
||||
$this->assertPattern('/id="Field1".*checked="checked"/', $result);
|
||||
|
|
Loading…
Add table
Reference in a new issue