Skip to content

Commit

Permalink
renamed method to applyButtonClasses
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkingmedia committed Mar 29, 2016
1 parent d642032 commit efb0efc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/View/Helper/FormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function create($model = null, array $options = [])
*/
public function submit($caption = null, array $options = [])
{
$options = $this->applyButtonStyles($options);
$options = $this->applyButtonClasses($options);
return parent::submit($caption, $options);
}

Expand Down
2 changes: 1 addition & 1 deletion src/View/Helper/OptionsAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ trait OptionsAwareTrait
* @param array $data An array of HTML attributes and options.
* @return array An array of HTML attributes and options.
*/
public function applyButtonStyles(array $data)
public function applyButtonClasses(array $data)
{
if ($this->hasAnyClass($this->buttonClasses, $data)) {
$data = $this->injectClasses('btn', $data);
Expand Down
2 changes: 1 addition & 1 deletion src/View/Widget/ButtonWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ButtonWidget extends \Cake\View\Widget\ButtonWidget
*/
public function render(array $data, ContextInterface $context)
{
$data = $this->applyButtonStyles($data);
$data = $this->applyButtonClasses($data);
return parent::render($data, $context);
}
}
6 changes: 3 additions & 3 deletions tests/TestCase/View/Helper/OptionsAwareTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public function setUp()

public function testApplyButtonStyles()
{
$this->assertEquals(['class' => 'btn btn-default'], $this->object->applyButtonStyles([]));
$this->assertEquals(['class' => 'btn btn-default'], $this->object->applyButtonClasses([]));
foreach (['default', 'success', 'warning', 'danger', 'info', 'primary'] as $style) {
$this->assertEquals(['class' => "btn-{$style} btn"], $this->object->applyButtonStyles(['class' => $style]));
$this->assertEquals(['class' => "btn-{$style} btn"], $this->object->applyButtonStyles(['class' => "btn-$style"]));
$this->assertEquals(['class' => "btn-{$style} btn"], $this->object->applyButtonClasses(['class' => $style]));
$this->assertEquals(['class' => "btn-{$style} btn"], $this->object->applyButtonClasses(['class' => "btn-$style"]));
}
}

Expand Down

0 comments on commit efb0efc

Please sign in to comment.