Permalink
Browse files

Remove redundant test and fix failing tests.

Remove a redundant test for disabling the fieldset, and fix remaining
fails.
  • Loading branch information...
1 parent 8451e71 commit 6d1c29f612f1caeedee2eb1a76cf71d07f3f02b7 @markstory markstory committed Mar 4, 2014
Showing with 7 additions and 9 deletions.
  1. +7 −5 src/View/Helper/FormHelper.php
  2. +0 −4 tests/TestCase/View/Helper/FormHelperTest.php
@@ -736,7 +736,9 @@ public function inputs($fields = null, $blacklist = null, $options = array()) {
$model = false;
$fieldset = $legend = true;
$context = $this->_getContext();
- // TODO add context->fields()
+
+ $modelFields = $context->fieldNames();
+
if (is_array($fields)) {
if (array_key_exists('legend', $fields) && !in_array('legend', $modelFields)) {
$legend = $fields['legend'];
@@ -755,17 +757,16 @@ public function inputs($fields = null, $blacklist = null, $options = array()) {
$fields = array();
}
+ if (empty($fields)) {
+ $fields = $modelFields;
+ }
if (isset($options['legend'])) {
$legend = $options['legend'];
}
if (isset($options['fieldset'])) {
$fieldset = $options['fieldset'];
}
- if (empty($fields)) {
- $fields = $modelFields;
- }
-
if ($legend === true) {
$actionName = __d('cake', 'New %s');
$isCreate = $context->isCreate();
@@ -799,6 +800,7 @@ public function inputs($fields = null, $blacklist = null, $options = array()) {
$fieldsetClass = '';
}
+ // TODO cleanup HTML helper usage.
if ($fieldset) {
if ($legend) {
$out = $this->Html->useTag('legend', $legend) . $out;
@@ -2573,10 +2573,6 @@ public function testFormInputs() {
$this->assertTags($result, $expected);
$this->Form->create($this->article);
- $result = $this->Form->inputs(null, null, array('fieldset' => false));
- $this->assertTags($result, $expected);
-
- $this->Form->create($this->article);
$result = $this->Form->inputs(array('fieldset' => true, 'legend' => false));
$expected = array(
'fieldset' => array(),

0 comments on commit 6d1c29f

Please sign in to comment.