From b06c7f88e282a548b5008d978c86e464c067c6d9 Mon Sep 17 00:00:00 2001 From: "mariano.iglesias" Date: Thu, 11 Oct 2007 16:45:23 +0000 Subject: [PATCH] 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 --- cake/libs/view/helpers/form.php | 10 +--------- cake/tests/cases/libs/view/helpers/form.test.php | 9 ++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 50771f47a..140099da0 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -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': diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index fe489b169..67ab89fe7 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -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('/^
field<\/legend>(]+>]+>option [AB]<\/label>)+<\/fieldset>$/', $result); $this->assertPattern('/(]+name="data\[Model\]\[field\]"[^<>]+>.+){2}/', $result); + + $result = $this->Form->radio('Model.field', array('option A', 'option B'), array('separator' => '
')); + $this->assertPattern('/id="Field0"/', $result); + $this->assertPattern('/id="Field1"/', $result); + $this->assertNoPattern('/id="ModelField"/', $result); + $this->assertNoPattern('/checked="checked"/', $result); + $this->assertPattern('/^
field<\/legend>]+>]+>option A<\/label>+]>]+>]+>option B<\/label><\/fieldset>$/', $result); + $this->assertPattern('/(]+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);