/**
  * Renders the hierselect using the given renderer
  *
  * @param HTML_QuickForm2_Renderer $renderer
  *
  * @return   HTML_QuickForm2_Renderer
  * @throws   HTML_QuickForm2_Exception   if number of selects in hierselect cannot
  *                                       be determined
  */
 public function render(HTML_QuickForm2_Renderer $renderer)
 {
     if (0 == $this->size) {
         throw new HTML_QuickForm2_Exception('Unable to determine number of selects in hierselect');
     }
     if ($this->toggleFrozen()) {
         // frozen hierselect does not need any javascript
         return parent::render($renderer);
     }
     $jsBuilder = $renderer->getJavascriptBuilder();
     $jsBuilder->addLibrary('hierselect', 'quickform-hierselect.js');
     $jsBuilder->addElementJavascript($this->_generateInitScript());
     $script = $this->appendChild(new HTML_QuickForm2_Element_Script('script'))->setContent($this->_generateInlineScript());
     parent::render($renderer);
     $this->removeChild($script);
     return $renderer;
 }
 public function testFrozenGroupsHaveNoClientValidation()
 {
     $group = new HTML_QuickForm2_Container_Group('aGroup');
     $ruleGroup = $this->getMock('HTML_QuickForm2_Rule', array('validateOwner', 'getJavascriptCallback'), array($group));
     $ruleGroup->expects($this->never())->method('getJavascriptCallback');
     $group->addRule($ruleGroup, HTML_QuickForm2_Rule::CLIENT);
     $group->toggleFrozen(true);
     $this->assertEquals('', $group->render(HTML_QuickForm2_Renderer::factory('default'))->getJavascriptBuilder()->getFormJavascript());
 }