Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99342cc225 | ||
|
|
e8b6bb0ff9 | ||
|
|
b788835612 | ||
|
|
d24e18156f | ||
|
|
3dd594748c | ||
|
|
f620ae4b9c | ||
|
|
2b67d708ce | ||
|
|
bdc56f0239 | ||
|
|
6b68b0856c | ||
|
|
466aabedbd | ||
|
|
ef11b7dd2f | ||
|
|
f8cd022c4f | ||
|
|
bca8b11d67 | ||
|
|
db665c9f0f | ||
|
|
f62269629b | ||
|
|
2516472b3f | ||
|
|
828da38dcd | ||
|
|
292a4787a4 | ||
|
|
b6b3693586 | ||
|
|
acb21a9364 | ||
|
|
b5d6fdedb6 | ||
|
|
9ab4568241 | ||
|
|
575d891b64 |
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ language: php
|
||||
php:
|
||||
- 5.5
|
||||
- 5.6
|
||||
- hhvm
|
||||
- 7.0
|
||||
|
||||
sudo: false
|
||||
|
||||
|
||||
+1089
-1073
File diff suppressed because it is too large.
Load diff
+10
-4
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Collective\Html;
|
||||
|
||||
use Illuminate\Routing\UrlGenerator;
|
||||
use Illuminate\Contracts\Routing\UrlGenerator;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
|
||||
class HtmlBuilder
|
||||
@@ -12,14 +12,14 @@ class HtmlBuilder
|
||||
/**
|
||||
* The URL generator instance.
|
||||
*
|
||||
* @var \Illuminate\Routing\UrlGenerator
|
||||
* @var \Illuminate\Contracts\Routing\UrlGenerator
|
||||
*/
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* Create a new HTML builder instance.
|
||||
*
|
||||
* @param \Illuminate\Routing\UrlGenerator $url
|
||||
* @param \Illuminate\Contracts\Routing\UrlGenerator $url
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -294,7 +294,13 @@ class HtmlBuilder
|
||||
$html = "<dl{$attributes}>";
|
||||
|
||||
foreach ($list as $key => $value) {
|
||||
$html .= "<dt>$key</dt><dd>$value</dd>";
|
||||
$value = (array) $value;
|
||||
|
||||
$html .= "<dt>$key</dt>";
|
||||
|
||||
foreach ($value as $v_key => $v_value) {
|
||||
$html .= "<dd>$v_value</dd>";
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</dl>';
|
||||
|
||||
+45
-13
@@ -13,20 +13,20 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* Setup the test environment.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->urlGenerator = new UrlGenerator(new RouteCollection(), Request::create('/foo', 'GET'));
|
||||
$this->htmlBuilder = new HtmlBuilder($this->urlGenerator);
|
||||
$this->formBuilder = new FormBuilder($this->htmlBuilder, $this->urlGenerator, 'abc');
|
||||
}
|
||||
public function setUp()
|
||||
{
|
||||
$this->urlGenerator = new UrlGenerator(new RouteCollection(), Request::create('/foo', 'GET'));
|
||||
$this->htmlBuilder = new HtmlBuilder($this->urlGenerator);
|
||||
$this->formBuilder = new FormBuilder($this->htmlBuilder, $this->urlGenerator, 'abc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the test environment.
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
m::close();
|
||||
}
|
||||
/**
|
||||
* Destroy the test environment.
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
m::close();
|
||||
}
|
||||
|
||||
public function testOpeningForm()
|
||||
{
|
||||
@@ -267,6 +267,27 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase
|
||||
['name' => 'select-name']
|
||||
);
|
||||
$this->assertEquals($select, '<select name="select-name" id="select-name-id"></select>');
|
||||
|
||||
$select = $this->formBuilder->select(
|
||||
'size',
|
||||
[
|
||||
'Large sizes' => [
|
||||
'L' => 'Large',
|
||||
'XL' => 'Extra Large',
|
||||
],
|
||||
'S' => 'Small',
|
||||
],
|
||||
null,
|
||||
[
|
||||
'class' => 'class-name',
|
||||
'id' => 'select-id',
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
$select,
|
||||
'<select class="class-name" id="select-id" name="size"><optgroup label="Large sizes"><option value="L">Large</option><option value="XL">Extra Large</option></optgroup><option value="S">Small</option></select>'
|
||||
);
|
||||
}
|
||||
|
||||
public function testFormSelectRepopulation()
|
||||
@@ -468,6 +489,17 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('<input src="'.$url.'" type="image">', $image);
|
||||
}
|
||||
|
||||
public function testFormColor()
|
||||
{
|
||||
$form1 = $this->formBuilder->color('foo');
|
||||
$form2 = $this->formBuilder->color('foo', '#ff0000');
|
||||
$form3 = $this->formBuilder->color('foo', null, ['class' => 'span2']);
|
||||
|
||||
$this->assertEquals('<input name="foo" type="color">', $form1);
|
||||
$this->assertEquals('<input name="foo" type="color" value="#ff0000">', $form2);
|
||||
$this->assertEquals('<input class="span2" name="foo" type="color">', $form3);
|
||||
}
|
||||
|
||||
protected function setModel(array $data, $object = true)
|
||||
{
|
||||
if ($object) {
|
||||
|
||||
Reference in new issue
Block a user