Skip to content

Commit

Permalink
Remove redundant test and fix failing tests.
Browse files Browse the repository at this point in the history
Remove a redundant test for disabling the fieldset, and fix remaining
fails.
  • Loading branch information
markstory committed Mar 4, 2014
1 parent 8451e71 commit 6d1c29f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 7 additions & 5 deletions src/View/Helper/FormHelper.php
Expand Up @@ -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'];
Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -2572,10 +2572,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(
Expand Down

0 comments on commit 6d1c29f

Please sign in to comment.