Adding interval to minute() attributes when timeformat = 24.

Tests added.
Closes #5428, refs #4641

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7711 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-10-07 16:57:22 +00:00
parent 11a29679e4
commit acce4fa54e
2 changed files with 25 additions and 12 deletions

View file

@ -1569,6 +1569,7 @@ class FormHelper extends AppHelper {
switch($timeFormat) {
case '24':
$selectMinuteAttr['interval'] = $interval;
$opt .= $this->hour($fieldName, true, $hour, $selectHourAttr, $showEmpty) . ':' .
$this->minute($fieldName, $min, $selectMinuteAttr, $showEmpty);
break;

View file

@ -1375,10 +1375,22 @@ class FormHelperTest extends CakeTestCase {
$this->assertPattern('/option value="23"/', $result[0]);
$this->assertNoPattern('/option value="24"/', $result[0]);
$result = $this->Form->input('Model.field', array('type' => 'time', 'timeFormat' => 12));
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
$result = explode(':', $result);
$this->assertPattern('/option value="12"/', $result[0]);
$this->assertNoPattern('/option value="13"/', $result[0]);
$this->assertPattern('/option value="23"/', $result[0]);
$this->assertNoPattern('/option value="24"/', $result[0]);
$result = $this->Form->input('Model.field', array('type' => 'time', 'timeFormat' => 24, 'interval' => 15));
$result = explode(':', $result);
$this->assertNoPattern('#<option value="12"[^>]*>12</option>#', $result[1]);
$this->assertNoPattern('#<option value="50"[^>]*>50</option>#', $result[1]);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$result = $this->Form->input('Model.field', array('type' => 'time', 'timeFormat' => 12, 'interval' => 15));
$result = explode(':', $result);
$this->assertNoPattern('#<option value="12"[^>]*>12</option>#', $result[1]);
$this->assertNoPattern('#<option value="50"[^>]*>50</option>#', $result[1]);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
//related to ticket #5013
$result = $this->Form->input('Contact.date', array('type' => 'date', 'class' => 'customClass', 'onChange' => 'function(){}'));