diff --git a/build/logs/clover.xml b/build/logs/clover.xml
new file mode 100644
index 0000000..3e4d3e9
--- /dev/null
+++ b/build/logs/clover.xml
@@ -0,0 +1,428 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/AdamWathan/BootForms/Elements/InputGroup.php b/src/AdamWathan/BootForms/Elements/InputGroup.php
index 6cadad8..f9896f3 100644
--- a/src/AdamWathan/BootForms/Elements/InputGroup.php
+++ b/src/AdamWathan/BootForms/Elements/InputGroup.php
@@ -5,8 +5,9 @@
class InputGroup extends Text
{
protected $beforeAddon = [];
-
protected $afterAddon = [];
+ protected $classAddon = [];
+ protected $addonID;
public function beforeAddon($addon)
{
@@ -22,6 +23,20 @@ public function afterAddon($addon)
return $this;
}
+ public function addAddonClass($class)
+ {
+ $this->classAddon[] = $class;
+
+ return $this;
+ }
+
+ public function addAddonId($id)
+ {
+ $this->addonID = $id;
+
+ return $this;
+ }
+
public function type($type)
{
$this->attributes['type'] = $type;
@@ -33,9 +48,25 @@ protected function renderAddons($addons)
$html = '';
foreach ($addons as $addon) {
- $html .= '';
- $html .= $addon;
- $html .= '';
+ $html .= sprintf('%s', $this->renderAddonsId(), $this->renderAddonsClass(), $addon);
+ }
+
+ return $html;
+ }
+
+ protected function renderAddonsId()
+ {
+ if($this->addonID) {
+ return sprintf('id="%s"' . ' ', $this->addonID);
+ }
+ }
+
+ protected function renderAddonsClass()
+ {
+ $html = '';
+
+ foreach($this->classAddon as $class) {
+ $html .= ' ' . $class;
}
return $html;
diff --git a/tests/InputGroupTest.php b/tests/InputGroupTest.php
index 6a15ef4..f62d2ce 100644
--- a/tests/InputGroupTest.php
+++ b/tests/InputGroupTest.php
@@ -67,4 +67,31 @@ public function testDefaultValue()
$result = $input->defaultValue('abc')->value('xyz')->render();
$this->assertEquals($expected, $result);
}
+
+ public function testCustomClassAddons()
+ {
+ $input = new InputGroup('example1');
+ $input->afterAddon('@domain.com')->addAddonClass('newCss');
+
+ $expected = '
@domain.com
';
+ $result = $input->render();
+ $this->assertEquals($expected, $result);
+
+ $input = new InputGroup('example2');
+ $input->afterAddon('@domain.com')->addAddonClass('newCss1')->addAddonClass('newCss2');
+
+ $expected = '@domain.com
';
+ $result = $input->render();
+ $this->assertEquals($expected, $result);
+ }
+
+ public function testCustomIdAddons()
+ {
+ $input = new InputGroup('example1');
+ $input->afterAddon('@domain.com')->addAddonId('myID');
+
+ $expected = '@domain.com
';
+ $result = $input->render();
+ $this->assertEquals($expected, $result);
+ }
}