/** @test */ public function it_should_render_a_row_with_a_multi_checkbox_element() { $interests = new MultiCheckbox('interests', ['u' => 'Usability', 's' => 'Security', 't' => 'Testing']); $interests->setValue('t'); $html = $this->renderer->renderRow($interests->buildView(), ['label' => 'Let us know your interests', 'label_attr' => ['class' => 'form-label'], 'attr' => ['class' => 'js-validate']]); $this->assertEquals('<div class="form-group"><label class="form-label">Let us know your interests</label><div><label class="form-label checkbox-inline"><input type="checkbox" name="interests[]" class="js-validate" value="u" >Usability</label><label class="form-label checkbox-inline"><input type="checkbox" name="interests[]" class="js-validate" value="s" >Security</label><label class="form-label checkbox-inline"><input type="checkbox" name="interests[]" class="js-validate" value="t" checked>Testing</label></div></div>', $html); }
/** @test */ public function it_should_render_a_row_with_a_multi_checkbox_element() { $languages = new MultiCheckbox('languages', ['PHP', 'Scala', 'C#']); $languages->setValue([0, 1]); $languages->setMessages(['Something went wrong']); $html = $this->renderer->renderRow($languages->buildView(), ['label' => 'Programming languages', 'label_attr' => ['class' => 'form-label'], ['class' => 'js-cookie']]); $this->assertEquals('<div><label class="form-label">Programming languages</label><label class="form-label"><input type="checkbox" name="languages[]" value="0" checked>PHP</label><label class="form-label"><input type="checkbox" name="languages[]" value="1" checked>Scala</label><label class="form-label"><input type="checkbox" name="languages[]" value="2" >C#</label><ul><li>Something went wrong</li></ul></div>', $html); }