mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +02:00
Type checks involving e_formTest
- MOD: e107::getTemplate() now accepts blank strings for the plugin name to mean that a core template should be loaded - FIX: e_form::progressBar() now supports input values that already have % at the end - FIX: Null check for $options['list'] in e_form::progressBar() - NEW: Test rounding in e_formTest::testProgressBar()
This commit is contained in:
@@ -2821,7 +2821,7 @@ class e107
|
|||||||
*/
|
*/
|
||||||
public static function getTemplate($plug_name, $id = null, $key = null, $override = true, $merge = false, $info = false)
|
public static function getTemplate($plug_name, $id = null, $key = null, $override = true, $merge = false, $info = false)
|
||||||
{
|
{
|
||||||
if(null === $plug_name)
|
if(!$plug_name)
|
||||||
{
|
{
|
||||||
return self::getCoreTemplate($id, $key, $override, $merge, $info);
|
return self::getCoreTemplate($id, $key, $override, $merge, $info);
|
||||||
}
|
}
|
||||||
|
@@ -2257,11 +2257,11 @@ class e_form
|
|||||||
$value = ((int) $score / (int) $denom) * 100;
|
$value = ((int) $score / (int) $denom) * 100;
|
||||||
|
|
||||||
// $value = (int) $score * (int) $multiplier;
|
// $value = (int) $score * (int) $multiplier;
|
||||||
$percVal = number_format($value,0).'%';
|
$percVal = round(floatval($value)).'%';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$percVal = number_format($value,0).'%';
|
$percVal = round(floatval($value)).'%';
|
||||||
$label = $percVal;
|
$label = $percVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2597,7 +2597,7 @@ class e_form
|
|||||||
$id = empty($options['id']) ? $this->name2id($name).'-container' : $options['id'];
|
$id = empty($options['id']) ? $this->name2id($name).'-container' : $options['id'];
|
||||||
|
|
||||||
// return print_a($checked,true);
|
// return print_a($checked,true);
|
||||||
if($options['list'])
|
if(isset($options['list']) && $options['list'])
|
||||||
{
|
{
|
||||||
return "<ul id='".$id."' class='checkboxes'><li>".implode("</li><li>",$text)."</li></ul>";
|
return "<ul id='".$id."' class='checkboxes'><li>".implode("</li><li>",$text)."</li></ul>";
|
||||||
}
|
}
|
||||||
|
@@ -366,6 +366,8 @@ class e_formTest extends \Codeception\Test\Unit
|
|||||||
1 => array('value' => '4/5', 'expected' => 'width: 80%'),
|
1 => array('value' => '4/5', 'expected' => 'width: 80%'),
|
||||||
2 => array('value' => '150/300', 'expected' => 'width: 50%'),
|
2 => array('value' => '150/300', 'expected' => 'width: 50%'),
|
||||||
3 => array('value' => '30%', 'expected' => 'width: 30%'),
|
3 => array('value' => '30%', 'expected' => 'width: 30%'),
|
||||||
|
4 => array('value' => '30.4%', 'expected' => 'width: 30%'),
|
||||||
|
5 => array('value' => '30.5%', 'expected' => 'width: 31%'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($tests as $var)
|
foreach($tests as $var)
|
||||||
|
Reference in New Issue
Block a user