mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Fixing range option for prototype engine. Fixes #1509
This commit is contained in:
parent
f2a4b1e959
commit
584116524b
2 changed files with 10 additions and 4 deletions
|
@ -330,10 +330,14 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
|
|||
unset($options['handle']);
|
||||
|
||||
if (isset($options['min']) && isset($options['max'])) {
|
||||
$options['range'] = array($options['min'], $options['max']);
|
||||
$options['range'] = sprintf('$R(%s,%s)', $options['min'], $options['max']);
|
||||
unset($options['min'], $options['max']);
|
||||
}
|
||||
$optionString = $this->_processOptions('slider', $options);
|
||||
$options = $this->_mapOptions('slider', $options);
|
||||
$options = $this->_prepareCallbacks('slider', $options);
|
||||
$optionString = $this->_parseOptions(
|
||||
$options, array_merge(array_keys($this->_callbackArguments['slider']), array('range'))
|
||||
);
|
||||
if (!empty($optionString)) {
|
||||
$optionString = ', {' . $optionString . '}';
|
||||
}
|
||||
|
|
|
@ -348,9 +348,11 @@ class PrototypeEngineHelperTestCase extends CakeTestCase {
|
|||
'handle' => '#handle',
|
||||
'change' => 'change();',
|
||||
'complete' => 'complete();',
|
||||
'value' => 4
|
||||
'value' => 4,
|
||||
'min' => 10,
|
||||
'max' => 100
|
||||
));
|
||||
$expected = 'var jsSlider = new Control.Slider($("handle"), $("element"), {onChange:function (value) {complete();}, onSlide:function (value) {change();}, sliderValue:4});';
|
||||
$expected = 'var jsSlider = new Control.Slider($("handle"), $("element"), {onChange:function (value) {complete();}, onSlide:function (value) {change();}, range:$R(10,100), sliderValue:4});';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue