function test_sortable_element() { $result = ScriptaculousHelper::sortable_element('list', array('url' => '/', 'containment' => array('left', 'right'), 'only' => 'middle')); $expected = <<<SCRIPT <script type="text/javascript"> //<![CDATA[ Sortable.create('list', {containment:['left','right'], onUpdate:function(){new Ajax.Request('/', {asynchronous:true, evalScripts:false, parameters:Sortable.serialize('list')})}, only:'middle'}) //]]> </script> SCRIPT; $this->assertEqual($result, $expected); }
/** * Starts a script.aculo.us visual effect. See * ScriptaculousHelper for more information. * * @param type <description> * @param type <description> * @param type <description> * * @return void */ function visual_effect($name, $id = FALSE, $js_opt = array()) { $this->record(ScriptaculousHelper::visual_effect($name, $id, $js_opt)); }
/** * Makes the element with the DOM ID specified by +element_id+ draggable. * * Example: * <?= draggable_element("my_image", 'revert' => true) * * You can change the behaviour with various options, see * http://script.aculo.us for more documentation. */ function draggable_element($element_id, $options = array()) { return JavascriptHelper::javascript_tag(ScriptaculousHelper::draggable_element_js($element_id, $options)); }