public function testRender() { $text = new Text('test'); $text->addDecorator('inputGroup', ['prependAddon' => '@', 'appendAddon' => '*']); $expected = '<div class="input-group">' . '<span class="input-group-addon">@</span>' . '<input id="form_test" class="form-control" name="test" type="text" />' . '<span class="input-group-addon">*</span>' . '</div>'; $this->assertEquals($expected, $text->render()); }
public function testRender() { $text = new Text('test'); $text->addDecorator('wrapper', ['name' => 'formgroup', 'class' => 'form-group']); $expected = '<div class="form-group">' . '<input id="form_test" class="form-control" name="test" type="text" />' . '</div>'; $this->assertEquals($expected, $text->render()); }
public function testSetPlacementBefore() { $text = new Text('test'); $text->addDecorator('helpblock', ['name' => 'helpblock', 'placement' => 'before']); $text->setHelp('This is a help text!'); $expected = '<span class="help-block">This is a help text!</span>' . '<input id="form_test" class="form-control" name="test" type="text" />'; $this->assertEquals($expected, $text->render()); }
public function testSetGroupSize() { $element = new Text('test'); $element->addDecorator('wrapper', ['name' => 'formgroup', 'class' => 'form-group']); $element->groupLarge(); $this->assertTrue($element->getDecorator('formgroup')->hasClass('form-group-lg')); $element->groupSmall(); $this->assertFalse($element->getDecorator('formgroup')->hasClass('form-group-lg')); $this->assertTrue($element->getDecorator('formgroup')->hasClass('form-group-sm')); $element->groupSize('other'); $this->assertFalse($element->getDecorator('formgroup')->hasClass('form-group-sm')); }
public function testGetFor() { $text = new Text('test', ['label' => 'Test Label']); $text->addDecorator('label', ['name' => 'label']); $this->assertEquals('form_test', $text->getDecorator('label')->getFor()); }