diff --git a/composer.json b/composer.json
index fe6b2c1..2469849 100644
--- a/composer.json
+++ b/composer.json
@@ -15,12 +15,12 @@
"license": "MIT",
"require": {
"php": ">=7.2.0",
- "illuminate/support": "~6.0"
+ "illuminate/support": "^6.0"
},
"require-dev": {
"ext-dom": "*",
- "phpunit/phpunit": "~8.0",
- "phpunit/phpcov": "~6.0"
+ "phpunit/phpunit": "^8.0",
+ "phpunit/phpcov": "^6.0"
},
"autoload": {
"psr-4": {
diff --git a/src/Html.php b/src/Html.php
index 5f85d99..61c9af7 100644
--- a/src/Html.php
+++ b/src/Html.php
@@ -472,14 +472,20 @@ public function time($name = null, $value = null, $format = true)
/**
* Make a number input.
*
- * @param string $name
+ * @param string|null $name
* @param string|null $value
+ * @param mixed|null $min
+ * @param mixed|null $max
+ * @param mixed|null $step
*
* @return \Arcanedev\Html\Elements\Input
*/
- public function number($name, $value = null)
+ public function number($name = null, $value = null, $min = null, $max = null, $step = null)
{
- return $this->input('number', $name, $value);
+ return $this->input('number', $name, $value)
+ ->attributeIfNotNull($min, 'min', $min)
+ ->attributeIfNotNull($max, 'max', $max)
+ ->attributeIfNotNull($step, 'step', $step);
}
/**
diff --git a/tests/Html/InputTest.php b/tests/Html/InputTest.php
index 7e9e28c..a39ad16 100644
--- a/tests/Html/InputTest.php
+++ b/tests/Html/InputTest.php
@@ -234,12 +234,36 @@ public function it_can_make_text_input()
/** @test */
public function it_can_make_number_input()
{
+ static::assertHtmlStringEqualsHtmlString(
+ '',
+ $this->html->number()
+ );
+
static::assertHtmlStringEqualsHtmlString(
'',
$this->html->number('price', 120)
);
}
+ /** @test */
+ public function it_can_make_a_number_input_with_min_max_step()
+ {
+ static::assertHtmlStringEqualsHtmlString(
+ '',
+ $this->html->number('percentage', '0', '0', '100')
+ );
+
+ static::assertHtmlStringEqualsHtmlString(
+ '',
+ $this->html->number('percentage', '0', '0', '100', '10')
+ );
+
+ static::assertHtmlStringEqualsHtmlString(
+ '',
+ $this->html->number('percentage', '30', null, '100', '10')
+ );
+ }
+
/** @test */
public function it_avoids_fill_value_for_password_input()
{