Skip to content
Permalink
Browse files

Fixing range option for prototype engine. Fixes #1509

  • Loading branch information...
markstory committed Feb 8, 2011
1 parent f2a4b1e commit 584116524bcf9f217122b050a02b7eb3301afa0f
@@ -330,10 +330,14 @@ function slider($options = array()) {
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 @@ function testSlider() {
'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);
}

0 comments on commit 5841165

Please sign in to comment.
You can’t perform that action at this time.