8000 Add number input field. Fixes #4 by driesvints · Pull Request #8 · LaravelCollective/html · GitHub
[go: up one dir, main page]

Skip to content

Add number input field. Fixes #4 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add number input field. Fixes #4
  • Loading branch information
driesvints committed Feb 19, 2015
commit 6a4f601e8b44956489fdfeb43a2e757443b3bd80
13 changes: 13 additions & 0 deletions src/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,19 @@ public function email($name, $value = null, $options = array())
return $this->input('email', $name, $value, $options);
}

/**
* Create a number input field.
*
* @param string $name
* @param string $value
* @param array $options
* @return string
*/
public function number($name, $value = null, $options = array())
{
return $this->input('number', $name, $value, $options);
}

/**
* Create a url input field.
*
Expand Down
12 changes: 12 additions & 0 deletions tests/FormBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ public function testFormEmail()
}


public function testFormNumber()
{
$form1 = $this->formBuilder->number('foo');
$form2 = $this->formBuilder->number('foo', 1);
$form3 = $this->formBuilder->number('foo', null, ['class' => 'span2']);

$this->assertEquals('<input name="foo" type="number">', $form1);
$this->assertEquals('<input name="foo" type="number" value="1">', $form2);
$this->assertEquals('<input class="span2" name="foo" type="number">', $form3);
}


public function testFormFile()
{
$form1 = $this->formBuilder->file('foo');
Expand Down
0