public function testValidatorAlwaysPresentWhenClientRulesAdded()
 {
     $fieldset = new HTML_QuickForm2_Container_Fieldset();
     $repeat = new HTML_QuickForm2_Container_Repeat(null, null, array('prototype' => $fieldset));
     $fieldset->addText('foo')->addRule('required', 'Required!', null, HTML_QuickForm2_Rule::CLIENT_SERVER);
     $repeat->setIndexes(array());
     $renderer = HTML_QuickForm2_Renderer::factory('array');
     $renderer->getJavascriptBuilder()->setFormId('fake-repeat');
     $repeat->render($renderer);
     $this->assertContains('new qf.Validator', $renderer->getJavascriptBuilder()->getValidator());
 }
 public static function _renderRepeat(HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Container_Repeat $repeat)
 {
     $break = HTML_Common2::getOption('linebreak');
     $html[] = '<div class="row repeat" id="' . $repeat->getId() . '">';
     $label = $repeat->getLabel();
     if (!is_array($label)) {
         $label = array($label);
     }
     if (!empty($label[0])) {
         $html[] = '<p>' . array_shift($label) . '</p>';
     }
     $elements = array_pop($renderer->html);
     $content = implode($break, $elements);
     $html[] = $content;
     $html[] = '</div>';
     return implode($break, $html) . $break;
 }