Skip to content

Commit

Permalink
Merge pull request #67 from deizel/disabled-title
Browse files Browse the repository at this point in the history
Update next/prev links to respect disable title and escape options
  • Loading branch information
slywalker committed Nov 7, 2014
2 parents 361789c + 87907ee commit bb1fa0d
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 17 deletions.
19 changes: 18 additions & 1 deletion Controller/BoostCakeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ class BoostCakeController extends AppController {
);

/**
* beforeFilter
* Before filter
*
* @throws MethodNotAllowedException
* @return void
*/
public function beforeFilter() {
if (Configure::read('debug') < 1) {
Expand All @@ -24,9 +26,19 @@ public function beforeFilter() {
parent::beforeFilter();
}

/**
* Action for plugin documentation home page
*
* @return void
*/
public function index() {
}

/**
* Action for Bootstrap 2 example page
*
* @return void
*/
public function bootstrap2() {
$this->Session->setFlash(__('Alert notice message testing...'), 'alert', array(
'plugin' => 'BoostCake',
Expand All @@ -41,6 +53,11 @@ public function bootstrap2() {
), 'error');
}

/**
* Action for Bootstrap 3 example page
*
* @return void
*/
public function bootstrap3() {
$this->Session->setFlash(__('Alert success message testing...'), 'alert', array(
'plugin' => 'BoostCake',
Expand Down
5 changes: 5 additions & 0 deletions Test/Case/AllBoostCakeTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php
class AllBoostCakeTest extends CakeTestSuite {

/**
* Adds all tests to the AllBoostCakeTest case
*
* @return CakeTestSuite
*/
public static function suite() {
$suite = new CakeTestSuite('All tests');
$path = dirname(__FILE__);
Expand Down
50 changes: 50 additions & 0 deletions Test/Case/View/Helper/BoostCakeFormHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class Contact extends CakeTestModel {

class BoostCakeFormHelperTest extends CakeTestCase {

/**
* setUp
*
* @return void
*/
public function setUp() {
parent::setUp();
$this->View = new View();
Expand All @@ -40,11 +45,21 @@ public function setUp() {
ClassRegistry::addObject('Contact', new Contact());
}

/**
* tearDown
*
* @return void
*/
public function tearDown() {
unset($this->View);
unset($this->Form);
}

/**
* testInput
*
* @return void
*/
public function testInput() {
$result = $this->Form->input('name');
$this->assertTags($result, array(
Expand Down Expand Up @@ -108,6 +123,11 @@ public function testInput() {
));
}

/**
* testBeforeInputAfterInput
*
* @return void
*/
public function testBeforeInputAfterInput() {
$result = $this->Form->input('name', array(
'beforeInput' => 'Before Input',
Expand All @@ -127,6 +147,11 @@ public function testBeforeInputAfterInput() {
));
}

/**
* testCheckbox
*
* @return void
*/
public function testCheckbox() {
$result = $this->Form->input('name', array('type' => 'checkbox'));
$this->assertTags($result, array(
Expand Down Expand Up @@ -179,6 +204,11 @@ public function testCheckbox() {
));
}

/**
* testCheckboxLabelEscape
*
* @return void
*/
public function testCheckboxLabelEscape() {
$result = $this->Form->input('name', array(
'type' => 'checkbox',
Expand All @@ -199,6 +229,11 @@ public function testCheckboxLabelEscape() {
));
}

/**
* testSelectMultipleCheckbox
*
* @return void
*/
public function testSelectMultipleCheckbox() {
$result = $this->Form->select('name',
array(
Expand Down Expand Up @@ -290,6 +325,11 @@ public function testSelectMultipleCheckbox() {
));
}

/**
* testRadio
*
* @return void
*/
public function testRadio() {
$result = $this->Form->input('name', array(
'type' => 'radio',
Expand Down Expand Up @@ -320,6 +360,11 @@ public function testRadio() {
));
}

/**
* testErrorMessage
*
* @return void
*/
public function testErrorMessage() {
$Contact = ClassRegistry::getObject('Contact');
$Contact->validationErrors['password'] = array('Please provide a password');
Expand Down Expand Up @@ -402,6 +447,11 @@ public function testErrorMessage() {
));
}

/**
* testPostLink
*
* @return void
*/
public function testPostLink() {
$result = $this->Form->postLink('Delete', '/posts/delete/1', array(
'block' => 'form'
Expand Down
20 changes: 20 additions & 0 deletions Test/Case/View/Helper/BoostCakeHtmlHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,31 @@

class BoostCakeHtmlHelperTest extends CakeTestCase {

/**
* setUp
*
* @return void
*/
public function setUp() {
parent::setUp();
$View = new View();
$this->Html = new BoostCakeHtmlHelper($View);
}

/**
* tearDown
*
* @return void
*/
public function tearDown() {
unset($this->Html);
}

/**
* testUseTag
*
* @return void
*/
public function testUseTag() {
$result = $this->Html->useTag(
'radio', 'one', 'two', array('three' => 'four'), '<label for="one">label</label>'
Expand All @@ -36,6 +51,11 @@ public function testUseTag() {
));
}

/**
* testImage
*
* @return void
*/
public function testImage() {
$result = $this->Html->image('', array('data-src' => 'holder.js/24x24'));
$this->assertTags($result, array(
Expand Down
32 changes: 18 additions & 14 deletions View/Helper/BoostCakeFormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class BoostCakeFormHelper extends FormHelper {

/**
* Overwrite FormHelper::input()
* Generates a form input element complete with label and wrapper div
*
* - Generates a form input element complete with label and wrapper div
*
* ### Options
*
Expand Down Expand Up @@ -139,10 +140,11 @@ public function input($fieldName, $options = array()) {

/**
* Overwrite FormHelper::_divOptions()
* Generate inner and outer div options
* Generate div options for input
*
* @param array $options
* - Generate inner and outer div options
* - Generate div options for input
*
* @param array $options Options list.
* @return array
*/
protected function _divOptions($options) {
Expand All @@ -165,11 +167,12 @@ protected function _divOptions($options) {

/**
* Overwrite FormHelper::_getInput()
* Wrap `<div>` input element
* Generates an input element
*
* @param type $args
* @return type
* - Wrap `<div>` input element
* - Generates an input element
*
* @param array $args The options for the input element
* @return string The generated input element
*/
protected function _getInput($args) {
$input = parent::_getInput($args);
Expand Down Expand Up @@ -203,13 +206,14 @@ protected function _getInput($args) {

/**
* Overwrite FormHelper::_selectOptions()
* If $attributes['style'] is `<input type="checkbox">` then replace `<label>` position
* Returns an array of formatted OPTION/OPTGROUP elements
*
* @param array $elements
* @param array $parents
* @param boolean $showParents
* @param array $attributes
* - If $attributes['style'] is `<input type="checkbox">` then replace `<label>` position
* - Returns an array of formatted OPTION/OPTGROUP elements
*
* @param array $elements Elements to format.
* @param array $parents Parents for OPTGROUP.
* @param bool $showParents Whether to show parents.
* @param array $attributes HTML attributes.
* @return array
*/
protected function _selectOptions($elements = array(), $parents = array(), $showParents = null, $attributes = array()) {
Expand Down
Loading

0 comments on commit bb1fa0d

Please sign in to comment.