Skip to content

Commit

Permalink
Changed test attribute to data-name more meaningful
Browse files Browse the repository at this point in the history
Removed rogue `label` element set
  • Loading branch information
lilHermit committed Feb 2, 2017
1 parent 9495517 commit 9779b57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/View/Helper/FormHelper.php
Expand Up @@ -1856,7 +1856,7 @@ public function submit($caption = null, array $options = [])

$input = $this->formatTemplate('inputSubmit', [
'type' => $type,
'attrs' => $this->templater()->formatAttributes($options, ['label']),
'attrs' => $this->templater()->formatAttributes($options),
'templateVars' => $options['templateVars']
]);

Expand Down
12 changes: 6 additions & 6 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -8601,17 +8601,17 @@ public function testControlLabelManipulation()
$result = $this->Form->radio('test', ['A', 'B'], [
'label' => [
'class' => ['custom-class', 'another-class'],
'some-other-attr' => 'blah'
'data-name' => 'bob'
],
'value' => 1
]);
$expected = [
'input' => ['type' => 'hidden', 'name' => 'test', 'value' => ''],
['label' => ['class' => 'custom-class another-class', 'some-other-attr' => 'blah', 'for' => 'test-0']],
['label' => ['class' => 'custom-class another-class', 'data-name' => 'bob', 'for' => 'test-0']],
['input' => ['type' => 'radio', 'name' => 'test', 'value' => '0', 'id' => 'test-0']],
'A',
'/label',
['label' => ['class' => 'custom-class another-class selected', 'some-other-attr' => 'blah', 'for' => 'test-1']],
['label' => ['class' => 'custom-class another-class selected', 'data-name' => 'bob', 'for' => 'test-1']],
['input' => [
'type' => 'radio',
'name' => 'test',
Expand Down Expand Up @@ -8712,7 +8712,7 @@ public function testControlLabelManipulation()
['text' => 'First Checkbox', 'value' => 1],
['text' => 'Second Checkbox', 'value' => 2]
],
'optionsLabel' => ['class' => ['custom-class', 'another-class'], 'some-other-attr' => 'blah'],
'optionsLabel' => ['class' => ['custom-class', 'another-class'], 'data-name' => 'bob'],
'value' => ['1']

]);
Expand All @@ -8726,7 +8726,7 @@ public function testControlLabelManipulation()
['div' => ['class' => 'checkbox']],
['label' => [
'class' => 'custom-class another-class selected',
'some-other-attr' => 'blah',
'data-name' => 'bob',
'for' => 'checkbox1-1'
]],
['input' => [
Expand All @@ -8742,7 +8742,7 @@ public function testControlLabelManipulation()
['div' => ['class' => 'checkbox']],
['label' => [
'class' => 'custom-class another-class',
'some-other-attr' => 'blah',
'data-name' => 'bob',
'for' => 'checkbox1-2'
]],
['input' => [
Expand Down

0 comments on commit 9779b57

Please sign in to comment.