'.
'
'.
diff --git a/vendor/anahkiasen/former/tests/Fields/PlainTextTest.php b/vendor/anahkiasen/former/tests/Fields/PlainTextTest.php
new file mode 100644
index 00000000..2943008c
--- /dev/null
+++ b/vendor/anahkiasen/former/tests/Fields/PlainTextTest.php
@@ -0,0 +1,124 @@
+ 'label',
+ 'attributes' => array('for' => 'foo'),
+ );
+ }
+
+ /**
+ * Matches a plain label without 'for' attribute
+ *
+ * @return array
+ */
+ public function matchPlainLabelWithBS3()
+ {
+ return array(
+ 'tag' => 'label',
+ );
+ }
+
+ /**
+ * Matches an plain text fallback input
+ * Which is a disabled input
+ *
+ * @return array
+ */
+ public function matchPlainTextFallbackInput()
+ {
+ return array(
+ 'tag' => 'input',
+ 'attributes' => array(
+ 'disabled' => 'true',
+ 'type' => 'text',
+ 'name' => 'foo',
+ 'value' => 'bar',
+ 'id' => 'foo',
+ ),
+ );
+ }
+
+ /**
+ * Matches an plain text input as a p tag
+ *
+ * @return array
+ */
+ public function matchPlainTextInput()
+ {
+ return array(
+ 'tag' => 'div',
+ 'content' => 'bar',
+ 'attributes' => array(
+ 'class' => 'form-control-static',
+ ),
+ );
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ ////////////////////////////// ASSERTIONS //////////////////////////
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Matches a Form Static Group
+ *
+ * @param string $input
+ * @param string $label
+ *
+ * @return boolean
+ */
+ protected function formStaticGroup(
+ $input = '
bar
',
+ $label = '
'
+ ) {
+ return $this->formGroup($input, $label);
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ //////////////////////////////// TESTS /////////////////////////////
+ ////////////////////////////////////////////////////////////////////
+
+ public function testCanCreatePlainTextFallbackInputFields()
+ {
+ $this->former->framework('Nude');
+ $nude = $this->former->plaintext('foo')->value('bar')->__toString();
+
+ $this->assertHTML($this->matchPlainLabel(), $nude);
+ $this->assertHTML($this->matchPlainTextFallbackInput(), $nude);
+
+ $this->resetLabels();
+ $this->former->framework('ZurbFoundation');
+ $zurb = $this->former->plaintext('foo')->value('bar')->__toString();
+
+ $this->assertHTML($this->matchPlainLabel(), $zurb);
+ $this->assertHTML($this->matchPlainTextFallbackInput(), $zurb);
+ }
+
+ public function testCanCreatePlainTextFieldsWithBS3()
+ {
+ $this->former->framework('TwitterBootstrap3');
+ $input = $this->former->plaintext('foo')->value('bar')->__toString();
+
+ $this->assertHTML($this->matchPlainLabelWithBS3(), $input);
+ $this->assertHTML($this->matchPlainTextInput(), $input);
+
+ $matcher = $this->formStaticGroup();
+ $this->assertEquals($matcher, $input);
+ }
+}
diff --git a/vendor/anahkiasen/former/tests/Fields/RadioTest.php b/vendor/anahkiasen/former/tests/Fields/RadioTest.php
index 68051398..8b058764 100644
--- a/vendor/anahkiasen/former/tests/Fields/RadioTest.php
+++ b/vendor/anahkiasen/former/tests/Fields/RadioTest.php
@@ -21,29 +21,53 @@ class RadioTest extends FormerTests
*
* @return string
*/
- private function matchRadio($name = 'foo', $label = null, $value = 1, $inline = false, $checked = false)
- {
+ private function matchRadio(
+ $name = 'foo',
+ $label = null,
+ $value = 1,
+ $inline = false,
+ $checked = false,
+ $disabled = false
+ ) {
$radioAttr = array(
- 'id' => $name,
- 'type' => 'radio',
- 'name' => preg_replace('/[0-9]/', null, $name),
- 'checked' => 'checked',
- 'value' => $value,
+ 'disabled' => 'true',
+ 'id' => $name,
+ 'type' => 'radio',
+ 'name' => preg_replace('/[0-9]/', null, $name),
+ 'checked' => 'checked',
+ 'value' => $value,
);
$labelAttr = array(
'for' => $name,
'class' => 'radio',
);
if ($inline) {
- $labelAttr['class'] .= $this->former->framework() === 'TwitterBootstrap3' ? ' radio-inline' : ' inline';
+ if ($this->former->framework() === 'TwitterBootstrap3') {
+ $labelAttr['class'] = 'radio-inline';
+ } else {
+ $labelAttr['class'] .= ' inline';
+ }
}
if (!$checked) {
unset($radioAttr['checked']);
}
+ if (!$disabled) {
+ unset($radioAttr['disabled']);
+ }
$radio = '
attributes($radioAttr).'>';
- return $label ? '
' : $radio;
+ if (!$inline && $this->former->framework() === 'TwitterBootstrap3') {
+ unset($labelAttr['class']);
+ }
+
+ $control = $label ? '
' : $radio;
+
+ if (!$inline && $this->former->framework() === 'TwitterBootstrap3') {
+ $control = '
'.$control.'
';
+ }
+
+ return $control;
}
/**
@@ -135,6 +159,21 @@ public function testStacked()
$this->assertEquals($matcher, $radios2);
}
+ public function testStackedTwitterBootstrap3()
+ {
+
+ $this->former->framework('TwitterBootstrap3');
+
+ $radios1 = $this->former->stacked_radios('foo')->radios('foo', 'bar')->__toString();
+ $this->resetLabels();
+ $radios2 = $this->former->radios('foo')->stacked()->radios('foo', 'bar')->__toString();
+
+ $matcher = $this->formGroup($this->matchRadio('foo', 'Foo', 0).$this->matchRadio('foo2', 'Bar', 1));
+
+ $this->assertEquals($matcher, $radios1);
+ $this->assertEquals($matcher, $radios2);
+ }
+
public function testMultipleArray()
{
$radios = $this->former->radios('foo')->radios(array('Foo' => 'foo', 'Bar' => 'bar'))->__toString();
@@ -222,9 +261,9 @@ public function testCheckMultiple()
public function testCheckMultipleCustom()
{
$radios = $this->former->radios('foo')->radios($this->radioCheckables)->check(array(
- 'foo' => true,
- 'bar' => false
- ))->__toString();
+ 'foo' => true,
+ 'bar' => false,
+ ))->__toString();
$matcher = $this->controlGroup(
'