diff --git a/CHANGELOG.md b/CHANGELOG.md
index 51dd203a..83fb5f11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
- Enh #338: Move `Helper` classes to `php-forge/html-helper` package (@terabytesoftw)
- Enh #339: Move interface `ContentInterface::class` and `LabelInterface::class` to `php-forge/html-interop` package
(@terabytesoftw)
+- Enh #340: Move `attributes` classes to `php-forge/html-attributes` package (@terabytesoftw)
## 0.2.0 February 27, 2024
diff --git a/composer.json b/composer.json
index 2ab31577..cbd6c09e 100644
--- a/composer.json
+++ b/composer.json
@@ -16,8 +16,9 @@
"ext-mbstring": "*",
"enshrined/svg-sanitize": "^0.17.0",
"php-forge/awesome-widget": "^0.1.2",
- "php-forge/html-helper": "^0.1",
- "php-forge/html-interop": "^0.1",
+ "php-forge/html-attribute": "dev-main",
+ "php-forge/html-helper": "dev-main",
+ "php-forge/html-interop": "^0.3",
"voku/anti-xss": "^4.1"
},
"require-dev": {
diff --git a/docs/form-control/Button.md b/docs/form-control/Button.md
index b1097a4d..b25a7229 100644
--- a/docs/form-control/Button.md
+++ b/docs/form-control/Button.md
@@ -120,6 +120,11 @@ The following methods are available for setting attributes:
| `class()` | Set the `class` attribute. |
| `content()` | Set the `content` within the `button` element. |
| `dataAttributes()` | Set multiple `data-attributes` at once. |
+| `formaction()` | Set the `formaction` attribute. |
+| `formenctype()` | Set the `formenctype` attribute. |
+| `formmethod()` | Set the `formmethod` attribute. |
+| `formnovalidate()` | Set the `formnovalidate` attribute. |
+| `formtarget()` | Set the `formtarget` attribute. |
| `id()` | Set the `id` attribute. |
| `lang()` | Set the `lang` attribute. |
| `name()` | Set the `name` attribute. |
@@ -143,17 +148,17 @@ The following methods are available for customizing the `HTML` output:
| `containerAttributes()` | Set `attributes` for the `container` element. |
| `containerClass()` | Set the `class` attribute for the `container` element. |
| `containerTag()` | Set the `tag` for the `container` element. |
-| `prefix()` | Add text before the `button` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container`. |
+| `prefix()` | Add text before the `tag` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `button` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `tag` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `tagName()` | Set the `tag` for the `button` element. |
| | Allowed values: `a`, `button`. |
| `template()` | Set the `template` for the `button` element. |
diff --git a/docs/form-control/Label.md b/docs/form-control/Label.md
index e01ec784..6564d292 100644
--- a/docs/form-control/Label.md
+++ b/docs/form-control/Label.md
@@ -33,6 +33,9 @@ If you want to include content within the `label` tag, use the `content` method.
$label->content('MyContent');
```
+> if content is empty, the `label` tag will not be rendered.
+
+
## Rendering
Generate the `HTML` output using the `render` method.
@@ -120,16 +123,16 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `prefix()` | Add text before the `label` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `prefix()` | Add text before the `tag` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `tag` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the `template` for the `label` element. |
| `widget()` | Instantiates the `Label::class`. |
diff --git a/docs/form-control/Select.md b/docs/form-control/Select.md
index da249fd7..5cbaea9b 100644
--- a/docs/form-control/Select.md
+++ b/docs/form-control/Select.md
@@ -12,17 +12,16 @@ $select = Select::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$select->generateField('model', 'field');
+$select->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -205,6 +204,7 @@ The following methods are available for setting attributes:
| ----------------- | ------------------------------------------------------------------------------------------------ |
| `ariaLabel()` | Set the `aria-label` attribute. |
| `attributes()` | Set multiple `attributes` at once. |
+| `autocomplete()` | Set the `autocomplete` attribute. |
| `autofocus()` | Set the `autofocus` attribute. |
| `class()` | Set the `class` attribute. |
| `disabled()` | Set the `disabled` attribute. |
@@ -227,23 +227,24 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
+| `disableLabel()` | Set enabled or disabled for the `label` element. |
+| `fieldAttributes()` | Set `attributes` for the `field` element. |
+| `groups()` | Add `groups` to the `select` element. |
| `items()` | Add `items` to the `select` element. |
| `itemsAttributes()` | Add `attributes` to the `items` element. |
-| `groups()` | Add `groups` to the `select` element. |
| `labelAttributes()` | Set `attributes` for the `label` element. |
| `labelClass()` | Set the `class` attribute for the `label` element. |
| `labelContent()` | Set the `content` for the `label` element. |
| `labelFor()` | Set the `for` attribute for the `label` element. |
-| `notLabel()` | Set enabled or disabled for the `label` element. |
-| `prefix()` | Add text before the `select` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `prefix()` | Add text before the `tag` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `select` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `tag` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `widget()` | Instantiates the `Select::class`. |
diff --git a/docs/form-control/TextArea.md b/docs/form-control/TextArea.md
index 72d7620a..d140869b 100644
--- a/docs/form-control/TextArea.md
+++ b/docs/form-control/TextArea.md
@@ -13,17 +13,16 @@ $textArea = TextArea::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$textArea->generateField('model', 'field');
+$textArea->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -146,18 +145,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `tag` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `tag` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `tokenValues()` | Set the token values for the `HTML` output. |
| `widget()` | Instantiates the `TextArea::class`. |
diff --git a/docs/form-control/input/Button.md b/docs/form-control/input/Button.md
index dc23e51a..125faf3d 100644
--- a/docs/form-control/input/Button.md
+++ b/docs/form-control/input/Button.md
@@ -107,6 +107,11 @@ The following methods are available for setting attributes:
| `dataAttributes()` | Set multiple `data-attributes` at once. |
| `disabled()` | Set the `disabled` attribute. |
| `form()` | Set the `form` attribute. |
+| `formaction()` | Set the `formaction` attribute. |
+| `formenctype()` | Set the `formenctype` attribute. |
+| `formmethod()` | Set the `formmethod` attribute. |
+| `formnovalidate()` | Set the `formnovalidate` attribute. |
+| `formtarget()` | Set the `formtarget` attribute. |
| `hidden()` | Set the `hidden` attribute. |
| `id()` | Set the `id` attribute. |
| `lang()` | Set the `lang` attribute. |
@@ -130,17 +135,17 @@ The following methods are available for customizing the `HTML` output:
| `containerAttributes()` | Set `attributes` for the `container` element. |
| `containerClass()` | Set the `class` attribute for the `container` element. |
| `containerTag()` | Set the `tag` for the `container` element. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Button::class`. |
|
@@ -153,8 +158,8 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ------------------ | ----------------------------------------------------------------------------------------------- |
+| `disableLabel()` | Set disabled for the `label` element. |
| `labelAttributes()`| Set `attributes` for the `label` element. |
| `labelClass()` | Set the `class` attribute for the `label` element. |
| `labelContent()` | Set the `content` within the `label` element. |
| `labelFor()` | Set the `for` attribute for the `label` element. |
-| `notLabel()` | Set disabled for the `label` element. |
diff --git a/docs/form-control/input/Checkbox.md b/docs/form-control/input/Checkbox.md
index 9e8a7470..c9603689 100644
--- a/docs/form-control/input/Checkbox.md
+++ b/docs/form-control/input/Checkbox.md
@@ -12,17 +12,16 @@ $checkbox = Checkbox::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$checkbox->generateField('model', 'field');
+$checkbox->fieldAttributes('formModel', 'field');
```
## Setting Attributes
@@ -184,19 +183,19 @@ The following methods are available for customizing the `HTML` output:
| `containerAttributes()` | Set `attributes` for the `container` element. |
| `containerClass()` | Set the `class` attribute for the `container` element. |
| `containerTag()` | Set the `tag` for the `container` element. |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
| `separator()` | Set the `separator` for the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `uncheckAttributes()` | Set the attributes for the hidden input tag. |
| `uncheckClass()` | Set the `class` attribute for the hidden input tag. |
@@ -212,12 +211,12 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ------------------ | ----------------------------------------------------------------------------------------------- |
+| `disableLabeñ()` | Set disabled for the `label` element. |
| `enclosedByLabel()`| Set enabled or disabled for the `enclosed-by-label` element. |
| `labelAttributes()`| Set `attributes` for the `label` element. |
| `labelClass()` | Set the `class` attribute for the `label` element. |
| `labelContent()` | Set the `content` within the `label` element. |
| `labelFor()` | Set the `for` attribute for the `label` element. |
-| `notLabel()` | Set disabled for the `label` element.
## Validate methods
diff --git a/docs/form-control/input/CheckboxList.md b/docs/form-control/input/CheckboxList.md
index 91d3e1e8..8c9925fd 100644
--- a/docs/form-control/input/CheckboxList.md
+++ b/docs/form-control/input/CheckboxList.md
@@ -15,17 +15,16 @@ $checkboxList = CheckboxList::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$checkboxList->generateField('model', 'field');
+$checkboxList->fieldAttributes('formModel', 'field');
```
## Adding items
@@ -173,7 +172,7 @@ The following methods are available for customizing the `HTML` output:
| `containerAttributes()`| Set `attributes` for the `container` element. |
| `containerClass()` | Set the `class` attribute for the `container` element. |
| `containerTag()` | Set the `tag` for the `container` element. |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
| `items()` | Set the `items` for the `HTML` output. |
| `render()` | Generates the `HTML` output. |
| `separator()` | Set the `separator` for the `HTML` output. |
@@ -192,12 +191,12 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ------------------ | ----------------------------------------------------------------------------------------------- |
+| `disableLabel()` | Set disabled for the `label` element. |
| `enclosedByLabel()`| Set enabled or disabled for the `enclosed-by-label` element. |
| `labelAttributes()`| Set `attributes` for the `label` element. |
| `labelClass()` | Set the `class` attribute for the `label` element. |
| `labelContent()` | Set the `content` within the `label` element. |
| `labelFor()` | Set the `for` attribute for the `label` element. |
-| `notLabel()` | Set disabled for the `label` element.
## Validate methods
diff --git a/docs/form-control/input/Color.md b/docs/form-control/input/Color.md
index 20531ce5..09e37db3 100644
--- a/docs/form-control/input/Color.md
+++ b/docs/form-control/input/Color.md
@@ -13,17 +13,16 @@ $color = Color::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$color->generateField('model', 'field');
+$color->fieldAttributes('formModel', 'field');
```
## Setting Attributes
@@ -118,9 +117,11 @@ The following methods are available for setting attributes:
| `ariaDescribedBy()`| Set the `aria-describedby` attribute. |
| `ariaLabel()` | Set the `aria-label` attribute. |
| `attributes()` | Set multiple `attributes` at once. |
+| `autocomplete()` | Set the `autocomplete` attribute. |
| `autofocus()` | Set the `autofocus` attribute. |
| `class()` | Set the `class` attribute. |
| `dataAttributes()` | Set multiple `data-attributes` at once. |
+| `dirname()` | Set the `dirname` attribute. |
| `disabled()` | Set the `disabled` attribute. |
| `form()` | Set the `form` attribute. |
| `hidden()` | Set the `hidden` attribute. |
@@ -142,18 +143,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Color::class`. |
diff --git a/docs/form-control/input/Date.md b/docs/form-control/input/Date.md
index 1ea5aa9c..6ba24c43 100644
--- a/docs/form-control/input/Date.md
+++ b/docs/form-control/input/Date.md
@@ -13,17 +13,16 @@ $date = Date::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$date->generateField('model', 'field');
+$date->fieldAttributes('formModel', 'field');
```
## Setting Attributes
@@ -142,18 +141,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Date::class`. |
diff --git a/docs/form-control/input/Datetime.md b/docs/form-control/input/Datetime.md
index f6f1611a..9b885359 100644
--- a/docs/form-control/input/Datetime.md
+++ b/docs/form-control/input/Datetime.md
@@ -13,17 +13,16 @@ $datetime = Datetime::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$datetime->generateField('model', 'field');
+$datetime->fieldAttributes('formModel', 'field');
```
## Setting Attributes
@@ -142,18 +141,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Datetime::class`. |
diff --git a/docs/form-control/input/DatetimeLocal.md b/docs/form-control/input/DatetimeLocal.md
index 5a6a3df2..76c2f31e 100644
--- a/docs/form-control/input/DatetimeLocal.md
+++ b/docs/form-control/input/DatetimeLocal.md
@@ -13,17 +13,16 @@ $datetimeLocal = DatetimeLocal::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$datetimeLocal->generateField('model', 'field');
+$datetimeLocal->fieldAttributes('formModel', 'field');
```
## Setting Attributes
@@ -142,18 +141,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `DatetimeLocal::class`. |
diff --git a/docs/form-control/input/Email.md b/docs/form-control/input/Email.md
index dc0610ff..5a5e1265 100644
--- a/docs/form-control/input/Email.md
+++ b/docs/form-control/input/Email.md
@@ -13,17 +13,16 @@ $email = Email::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$email->generateField('model', 'field');
+$email->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -119,9 +118,11 @@ The following methods are available for setting attributes:
| `ariaDescribedBy()`| Set the `aria-describedby` attribute. |
| `ariaLabel()` | Set the `aria-label` attribute. |
| `attributes()` | Set multiple `attributes` at once. |
+| `autocomplete()` | Set the `autocomplete` attribute. |
| `autofocus()` | Set the `autofocus` attribute. |
| `class()` | Set the `class` attribute. |
| `dataAttributes()` | Set multiple `data-attributes` at once. |
+| `dirname()` | Set the `dirname` attribute. |
| `disabled()` | Set the `disabled` attribute. |
| `form()` | Set the `form` attribute. |
| `hidden()` | Set the `hidden` attribute. |
@@ -146,18 +147,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Email::class`. |
diff --git a/docs/form-control/input/File.md b/docs/form-control/input/File.md
index 31e5daf1..00100c6c 100644
--- a/docs/form-control/input/File.md
+++ b/docs/form-control/input/File.md
@@ -13,17 +13,16 @@ $file = File::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$file->generateField('model', 'field');
+$file->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -143,18 +142,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `uncheckAttributes()` | Set the attributes for the hidden input tag. |
| `uncheckClass()` | Set the `class` attribute for the hidden input tag. |
diff --git a/docs/form-control/input/Image.md b/docs/form-control/input/Image.md
index 26d162b5..5c78bcc2 100644
--- a/docs/form-control/input/Image.md
+++ b/docs/form-control/input/Image.md
@@ -14,17 +14,16 @@ $image = Image::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$image->generateField('model', 'field');
+$image->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -154,17 +153,17 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Image::class`. |
diff --git a/docs/form-control/input/Month.md b/docs/form-control/input/Month.md
index 6b9ded91..9b4a1422 100644
--- a/docs/form-control/input/Month.md
+++ b/docs/form-control/input/Month.md
@@ -13,17 +13,16 @@ $month = Month::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$month->generateField('model', 'field');
+$month->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -142,18 +141,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Month::class`. |
diff --git a/docs/form-control/input/Number.md b/docs/form-control/input/Number.md
index 87d17696..5906eb2c 100644
--- a/docs/form-control/input/Number.md
+++ b/docs/form-control/input/Number.md
@@ -13,17 +13,16 @@ $number = Number::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$number->generateField('model', 'field');
+$number->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -143,18 +142,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Number::class`. |
diff --git a/docs/form-control/input/Password.md b/docs/form-control/input/Password.md
index fcaefe93..3f4fd938 100644
--- a/docs/form-control/input/Password.md
+++ b/docs/form-control/input/Password.md
@@ -13,17 +13,16 @@ $password = Password::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$password->generateField('model', 'field');
+$password->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -118,9 +117,11 @@ The following methods are available for setting attributes:
| `ariaDescribedBy()`| Set the `aria-describedby` attribute. |
| `ariaLabel()` | Set the `aria-label` attribute. |
| `attributes()` | Set multiple `attributes` at once. |
+| `autocomplete()` | Set the `autocomplete` attribute. |
| `autofocus()` | Set the `autofocus` attribute. |
| `class()` | Set the `class` attribute. |
| `dataAttributes()` | Set multiple `data-attributes` at once. |
+| `dirname()` | Set the `dirname` attribute. |
| `disabled()` | Set the `disabled` attribute. |
| `form()` | Set the `form` attribute. |
| `hidden()` | Set the `hidden` attribute. |
@@ -144,18 +145,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Password::class`. |
diff --git a/docs/form-control/input/Radio.md b/docs/form-control/input/Radio.md
index b34a9893..d1382aa3 100644
--- a/docs/form-control/input/Radio.md
+++ b/docs/form-control/input/Radio.md
@@ -13,17 +13,16 @@ $radio = Radio::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$radio->generateField('model', 'field');
+$radio->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -185,19 +184,19 @@ The following methods are available for customizing the `HTML` output:
| `containerAttributes()` | Set `attributes` for the `container` element. |
| `containerClass()` | Set the `class` attribute for the `container` element. |
| `containerTag()` | Set the `tag` for the `container` element. |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `separator()` | Set the `separator` for the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
| `template()` | Set the template for the `HTML` output. |
| `uncheckAttributes()` | Set the attributes for the hidden input tag. |
| `uncheckClass()` | Set the `class` attribute for the hidden input tag. |
@@ -213,12 +212,12 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ------------------ | ----------------------------------------------------------------------------------------------- |
+| `disableLabel()` | Set disabled for the `label` element. |
| `enclosedByLabel()`| Set enabled or disabled for the `enclosed-by-label` element. |
| `labelAttributes()`| Set `attributes` for the `label` element. |
| `labelClass()` | Set the `class` attribute for the `label` element. |
| `labelContent()` | Set the `content` within the `label` element. |
| `labelFor()` | Set the `for` attribute for the `label` element. |
-| `notLabel()` | Set disabled for the `label` element.
## Validate methods
diff --git a/docs/form-control/input/RadioList.md b/docs/form-control/input/RadioList.md
index 06e2abc5..76ccca6a 100644
--- a/docs/form-control/input/RadioList.md
+++ b/docs/form-control/input/RadioList.md
@@ -15,17 +15,16 @@ $radioList = RadioList::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$radioList->generateField('model', 'field');
+$radioList->fieldAttributes('model', 'field');
```
## Adding items
@@ -166,7 +165,7 @@ The following methods are available for customizing the `HTML` output:
| `containerAttributes()`| Set `attributes` for the `container` element. |
| `containerClass()` | Set the `class` attribute for the `container` element. |
| `containerTag()` | Set the `tag` for the `container` element. |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
| `items()` | Set the `items` for the `HTML` output. |
| `render()` | Generates the `HTML` output. |
| `separator()` | Set the `separator` for the `HTML` output. |
@@ -185,12 +184,12 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ------------------ | ----------------------------------------------------------------------------------------------- |
+| `disableLabel()` | Set disabled for the `label` element. |
| `enclosedByLabel()`| Set enabled or disabled for the `enclosed-by-label` element. |
| `labelAttributes()`| Set `attributes` for the `label` element. |
| `labelClass()` | Set the `class` attribute for the `label` element. |
| `labelContent()` | Set the `content` within the `label` element. |
| `labelFor()` | Set the `for` attribute for the `label` element. |
-| `notLabel()` | Set disabled for the `label` element.
## Validate methods
diff --git a/docs/form-control/input/Range.md b/docs/form-control/input/Range.md
index b74cb02c..ddc83335 100644
--- a/docs/form-control/input/Range.md
+++ b/docs/form-control/input/Range.md
@@ -13,17 +13,16 @@ $range = Range::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$range->generateField('model', 'field');
+$range->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -118,9 +117,11 @@ The following methods are available for setting attributes:
| `ariaDescribedBy()`| Set the `aria-describedby` attribute. |
| `ariaLabel()` | Set the `aria-label` attribute. |
| `attributes()` | Set multiple `attributes` at once. |
+| `autocomplete()` | Set the `autocomplete` attribute. |
| `autofocus()` | Set the `autofocus` attribute. |
| `class()` | Set the `class` attribute. |
| `dataAttributes()` | Set multiple `data-attributes` at once. |
+| `dirname()` | Set the `dirname` attribute. |
| `disabled()` | Set the `disabled` attribute. |
| `form()` | Set the `form` attribute. |
| `hidden()` | Set the `hidden` attribute. |
@@ -142,18 +143,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Range::class`. |
diff --git a/docs/form-control/input/Reset.md b/docs/form-control/input/Reset.md
index 05f55a06..255d05cf 100644
--- a/docs/form-control/input/Reset.md
+++ b/docs/form-control/input/Reset.md
@@ -107,6 +107,11 @@ The following methods are available for setting attributes:
| `dataAttributes()` | Set multiple `data-attributes` at once. |
| `disabled()` | Set the `disabled` attribute. |
| `form()` | Set the `form` attribute. |
+| `formaction()` | Set the `formaction` attribute. |
+| `formenctype()` | Set the `formenctype` attribute. |
+| `formmethod()` | Set the `formmethod` attribute. |
+| `formnovalidate()` | Set the `formnovalidate` attribute. |
+| `formtarget()` | Set the `formtarget` attribute. |
| `hidden()` | Set the `hidden` attribute. |
| `id()` | Set the `id` attribute. |
| `lang()` | Set the `lang` attribute. |
@@ -130,17 +135,17 @@ The following methods are available for customizing the `HTML` output:
| `containerAttributes()` | Set `attributes` for the `container` element. |
| `containerClass()` | Set the `class` attribute for the `container` element. |
| `containerTag()` | Set the `tag` for the `container` element. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Reset::class`. |
|
@@ -153,8 +158,8 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ------------------ | ----------------------------------------------------------------------------------------------- |
+| `disableLabel()` | Set disabled for the `label` element. |
| `labelAttributes()`| Set `attributes` for the `label` element. |
| `labelClass()` | Set the `class` attribute for the `label` element. |
| `labelContent()` | Set the `content` within the `label` element. |
| `labelFor()` | Set the `for` attribute for the `label` element. |
-| `notLabel()` | Set disabled for the `label` element. |
diff --git a/docs/form-control/input/Search.md b/docs/form-control/input/Search.md
index da411b2d..5643d182 100644
--- a/docs/form-control/input/Search.md
+++ b/docs/form-control/input/Search.md
@@ -13,17 +13,16 @@ $search = Search::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$search->generateField('model', 'field');
+$search->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -118,6 +117,7 @@ The following methods are available for setting attributes:
| `ariaDescribedBy()`| Set the `aria-describedby` attribute. |
| `ariaLabel()` | Set the `aria-label` attribute. |
| `attributes()` | Set multiple `attributes` at once. |
+| `autocomplete()` | Set the `autocomplete` attribute. |
| `autofocus()` | Set the `autofocus` attribute. |
| `class()` | Set the `class` attribute. |
| `dataAttributes()` | Set multiple `data-attributes` at once. |
@@ -145,18 +145,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Search::class`. |
diff --git a/docs/form-control/input/Submit.md b/docs/form-control/input/Submit.md
index 379c799f..bdac1631 100644
--- a/docs/form-control/input/Submit.md
+++ b/docs/form-control/input/Submit.md
@@ -107,6 +107,11 @@ The following methods are available for setting attributes:
| `dataAttributes()` | Set multiple `data-attributes` at once. |
| `disabled()` | Set the `disabled` attribute. |
| `form()` | Set the `form` attribute. |
+| `formaction()` | Set the `formaction` attribute. |
+| `formenctype()` | Set the `formenctype` attribute. |
+| `formmethod()` | Set the `formmethod` attribute. |
+| `formnovalidate()` | Set the `formnovalidate` attribute. |
+| `formtarget()` | Set the `formtarget` attribute. |
| `hidden()` | Set the `hidden` attribute. |
| `id()` | Set the `id` attribute. |
| `lang()` | Set the `lang` attribute. |
@@ -130,17 +135,17 @@ The following methods are available for customizing the `HTML` output:
| `containerAttributes()` | Set `attributes` for the `container` element. |
| `containerClass()` | Set the `class` attribute for the `container` element. |
| `containerTag()` | Set the `tag` for the `container` element. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Submit::class`. |
|
@@ -153,8 +158,8 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ------------------ | ----------------------------------------------------------------------------------------------- |
+| `disableLabel()` | Set disabled for the `label` element. |
| `labelAttributes()`| Set `attributes` for the `label` element. |
| `labelClass()` | Set the `class` attribute for the `label` element. |
| `labelContent()` | Set the `content` within the `label` element. |
| `labelFor()` | Set the `for` attribute for the `label` element. |
-| `notLabel()` | Set disabled for the `label` element. |
diff --git a/docs/form-control/input/Text.md b/docs/form-control/input/Text.md
index c3473395..e2b7342c 100644
--- a/docs/form-control/input/Text.md
+++ b/docs/form-control/input/Text.md
@@ -13,17 +13,16 @@ $text = Text::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$text->generateField('model', 'field');
+$text->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -118,6 +117,7 @@ The following methods are available for setting attributes:
| `ariaDescribedBy()`| Set the `aria-describedby` attribute. |
| `ariaLabel()` | Set the `aria-label` attribute. |
| `attributes()` | Set multiple `attributes` at once. |
+| `autocomplete()` | Set the `autocomplete` attribute. |
| `autofocus()` | Set the `autofocus` attribute. |
| `class()` | Set the `class` attribute. |
| `dataAttributes()` | Set multiple `data-attributes` at once. |
@@ -145,18 +145,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Text::class`. |
diff --git a/docs/form-control/input/Time.md b/docs/form-control/input/Time.md
index dc47046b..4c0840f5 100644
--- a/docs/form-control/input/Time.md
+++ b/docs/form-control/input/Time.md
@@ -13,17 +13,16 @@ $time = Time::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$time->generateField('model', 'field');
+$time->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -142,18 +141,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Time::class`. |
diff --git a/docs/form-control/input/Url.md b/docs/form-control/input/Url.md
index 6c7574c9..a0542f57 100644
--- a/docs/form-control/input/Url.md
+++ b/docs/form-control/input/Url.md
@@ -13,17 +13,16 @@ $url = Url::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$url->generateField('model', 'field');
+$url->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -118,9 +117,11 @@ The following methods are available for setting attributes:
| `ariaDescribedBy()`| Set the `aria-describedby` attribute. |
| `ariaLabel()` | Set the `aria-label` attribute. |
| `attributes()` | Set multiple `attributes` at once. |
+| `autocomplete()` | Set the `autocomplete` attribute. |
| `autofocus()` | Set the `autofocus` attribute. |
| `class()` | Set the `class` attribute. |
| `dataAttributes()` | Set multiple `data-attributes` at once. |
+| `dirname()` | Set the `dirname` attribute. |
| `disabled()` | Set the `disabled` attribute. |
| `form()` | Set the `form` attribute. |
| `hidden()` | Set the `hidden` attribute. |
@@ -144,18 +145,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Url::class`. |
diff --git a/docs/form-control/input/Week.md b/docs/form-control/input/Week.md
index dcdae5e7..4164fd61 100644
--- a/docs/form-control/input/Week.md
+++ b/docs/form-control/input/Week.md
@@ -13,17 +13,16 @@ $week = Week::widget();
## Generate field id and name
-The `generateField` method is used to generate the field id and name for the `HTML` output.
+The `fieldAttributes` method is used to generate the field id and name for the `HTML` output.
Allowed arguments are:
-- `modelName` - The name of the model.
-- `fieldName` - The name of the field.
-- `arrayable` - Whether the field is an array. For default, it is `false`.
+- `formModel` - The name of the model.
+- `property` - The name of the field.
```php
// generate field id and name
-$week->generateField('model', 'field');
+$week->fieldAttributes('model', 'field');
```
## Setting Attributes
@@ -143,18 +142,18 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `generateField()` | Generate the field id and name for the `HTML` output. |
-| `prefix()` | Add text before the `textarea` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `fieldAttributes()` | Generate the field id and name for the `HTML` output. |
+| `prefix()` | Add text before the `input` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `label` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `input` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Week::class`. |
diff --git a/docs/multimedia/Img.md b/docs/multimedia/Img.md
index ace41fe1..38b6bda7 100644
--- a/docs/multimedia/Img.md
+++ b/docs/multimedia/Img.md
@@ -126,16 +126,16 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `prefix()` | Add text before the `img` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `prefix()` | Add text before the `tag` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `img` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `tag` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the `template` for the `img` element. |
| `widget()` | Instantiates the `Img::class`. |
diff --git a/docs/textual/A.md b/docs/textual/A.md
index 42957930..cfa5e108 100644
--- a/docs/textual/A.md
+++ b/docs/textual/A.md
@@ -141,16 +141,16 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `prefix()` | Add text before the `a` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `prefix()` | Add text before the `tag` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `a` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `tag` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the `template` for the `a` element. |
| `widget()` | Instantiates the `A::class`. |
diff --git a/docs/textual/I.md b/docs/textual/I.md
index ad186e02..fa674d58 100644
--- a/docs/textual/I.md
+++ b/docs/textual/I.md
@@ -119,16 +119,16 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `prefix()` | Add text before the `i` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `prefix()` | Add text before the `tag` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `i` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `tag` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the `template` for the `i` element. |
| `widget()` | Instantiates the `I::class`. |
diff --git a/docs/textual/Span.md b/docs/textual/Span.md
index 65798410..3e6f1467 100644
--- a/docs/textual/Span.md
+++ b/docs/textual/Span.md
@@ -95,16 +95,16 @@ The following methods are available for customizing the `HTML` output:
| Method | Description |
| ---------------------------- | ------------------------------------------------------------------------------------- |
-| `prefix()` | Add text before the `a` element. |
-| `prefixContainer()` | Set enabled or disabled for the `prefix-container` element. |
-| `prefixContainerAttributes()`| Set `attributes` for the `prefix-container` element. |
-| `prefixContainerClass()` | Set the `class` attribute for the `prefix-container` element. |
-| `prefixContainerTag()` | Set the `tag` for the `prefix-container` element. |
+| `prefix()` | Add text before the `tag` element. If empty, the `prefix` tag will be disabled. |
+| `prefixAttributes()` | Set `attributes` for the `prefix` element. |
+| `prefixClass()` | Set the `class` attribute for the `prefix` element. |
+| `prefixTag()` | Set the `tag` for the `prefix` element. |
+| | If `false` the prefix tag will be disabled. |
| `render()` | Generates the `HTML` output. |
-| `suffix()` | Add text after the `a` element. |
-| `suffixContainer()` | Set enabled or disabled for the `suffix-container` element. |
-| `suffixContainerAttributes()`| Set `attributes` for the `suffix-container` element. |
-| `suffixContainerClass()` | Set the `class` attribute for the `suffix-container` element. |
-| `suffixContainerTag()` | Set the `tag` for the `suffix-container` element. |
+| `suffix()` | Add text after the `tag` element. If empty, the `suffix` tag will be disabled. |
+| `suffixAttributes()` | Set `attributes` for the `suffix` element. |
+| `suffixClass()` | Set the `class` attribute for the `suffix` element. |
+| `suffixTag()` | Set the `tag` for the `suffix-container` element. |
+| | If `false` the suffix tag will be disabled. |
| `template()` | Set the template for the `HTML` output. |
| `widget()` | Instantiates the `Span::class`. |
diff --git a/src/Attribute/Aria/HasAriaControls.php b/src/Attribute/Aria/HasAriaControls.php
deleted file mode 100644
index b688d493..00000000
--- a/src/Attribute/Aria/HasAriaControls.php
+++ /dev/null
@@ -1,41 +0,0 @@
-ariaControls = true;
- } else {
- $new->ariaControls = false;
- $new->attributes['aria-controls'] = $value;
- }
-
- return $new;
- }
-}
diff --git a/src/Attribute/Aria/HasAriaDescribedBy.php b/src/Attribute/Aria/HasAriaDescribedBy.php
deleted file mode 100644
index d461fd48..00000000
--- a/src/Attribute/Aria/HasAriaDescribedBy.php
+++ /dev/null
@@ -1,39 +0,0 @@
-ariaDescribedBy = true;
- } else {
- $new->attributes['aria-describedby'] = $value;
- }
-
- return $new;
- }
-}
diff --git a/src/Attribute/Aria/HasAriaDisabled.php b/src/Attribute/Aria/HasAriaDisabled.php
deleted file mode 100644
index 16a75729..00000000
--- a/src/Attribute/Aria/HasAriaDisabled.php
+++ /dev/null
@@ -1,31 +0,0 @@
-attributes['aria-disabled'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Aria/HasAriaExpanded.php b/src/Attribute/Aria/HasAriaExpanded.php
deleted file mode 100644
index a6cd7fed..00000000
--- a/src/Attribute/Aria/HasAriaExpanded.php
+++ /dev/null
@@ -1,31 +0,0 @@
-attributes['aria-expanded'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Aria/HasAriaLabel.php b/src/Attribute/Aria/HasAriaLabel.php
deleted file mode 100644
index b72b220a..00000000
--- a/src/Attribute/Aria/HasAriaLabel.php
+++ /dev/null
@@ -1,28 +0,0 @@
-attributes['aria-label'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Aria/HasRole.php b/src/Attribute/Aria/HasRole.php
deleted file mode 100644
index 6b0bc6a6..00000000
--- a/src/Attribute/Aria/HasRole.php
+++ /dev/null
@@ -1,40 +0,0 @@
-role = true;
- } elseif (is_string($value)) {
- $new->attributes['role'] = $value;
- }
-
- return $new;
- }
-}
diff --git a/src/Attribute/CanBeAutofocus.php b/src/Attribute/CanBeAutofocus.php
deleted file mode 100644
index fcaaea5a..00000000
--- a/src/Attribute/CanBeAutofocus.php
+++ /dev/null
@@ -1,28 +0,0 @@
-attributes['autofocus'] = true;
-
- return $new;
- }
-}
diff --git a/src/Attribute/CanBeHidden.php b/src/Attribute/CanBeHidden.php
deleted file mode 100644
index 5117d173..00000000
--- a/src/Attribute/CanBeHidden.php
+++ /dev/null
@@ -1,27 +0,0 @@
-attributes['hidden'] = true;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Component/HasListCollection.php b/src/Attribute/Component/HasListCollection.php
index 757a7fd8..97ae1d5c 100644
--- a/src/Attribute/Component/HasListCollection.php
+++ b/src/Attribute/Component/HasListCollection.php
@@ -5,15 +5,13 @@
namespace PHPForge\Html\Attribute\Component;
use InvalidArgumentException;
-use PHPForge\Html\{Attribute\Custom\HasValidateInList, Helper\CssClass};
+use PHPForge\Html\Helper\{CssClass, Validator};
/**
* Is used by widgets that implement list collection.
*/
trait HasListCollection
{
- use HasValidateInList;
-
protected array $listAttributes = [];
protected bool $listContainer = false;
protected array $listContainerAttributes = [];
@@ -110,7 +108,7 @@ public function listContainerClass(string $value, bool $override = false): stati
public function listType(string|false $value): static
{
if ($value !== false) {
- $this->validateInList(
+ Validator::inList(
$value,
'Invalid value "%s" for the list type method. Allowed values are: "%s".',
'ol',
diff --git a/src/Attribute/Component/HasToggleCollection.php b/src/Attribute/Component/HasToggleCollection.php
index b19ef37f..46e279a1 100644
--- a/src/Attribute/Component/HasToggleCollection.php
+++ b/src/Attribute/Component/HasToggleCollection.php
@@ -5,7 +5,7 @@
namespace PHPForge\Html\Attribute\Component;
use InvalidArgumentException;
-use PHPForge\Html\{Attribute\Custom\HasValidateInList, Helper\Sanitize, Interop\RenderInterface, Tag};
+use PHPForge\Html\{Helper\Sanitize, Helper\Validator, Interop\RenderInterface, Tag};
use function array_merge;
@@ -14,8 +14,6 @@
*/
trait HasToggleCollection
{
- use HasValidateInList;
-
protected bool $isToggle = true;
protected array $toggleAttributes = [];
protected string $toggleClass = '';
@@ -98,7 +96,7 @@ public function toggleContent(string|RenderInterface ...$values): static
*/
public function toggleDataAttribute(string $name, string $value): static
{
- $this->validateInList(
+ Validator::inList(
$name,
'Invalid value "%s" for the data attribute. Allowed values are: "%s".',
'bs-toggle',
diff --git a/src/Attribute/Custom/HasAttributes.php b/src/Attribute/Custom/HasAttributes.php
deleted file mode 100644
index c30d223c..00000000
--- a/src/Attribute/Custom/HasAttributes.php
+++ /dev/null
@@ -1,31 +0,0 @@
-attributes = array_merge($this->attributes, $values);
-
- return $new;
- }
-}
diff --git a/src/Attribute/Custom/HasContent.php b/src/Attribute/Custom/HasContent.php
deleted file mode 100644
index 678f49c0..00000000
--- a/src/Attribute/Custom/HasContent.php
+++ /dev/null
@@ -1,40 +0,0 @@
-content = Sanitize::html(...$values);
-
- return $new;
- }
-
- /**
- * Get the `HTML` content value.
- *
- * @return string The `HTML` content value.
- */
- public function getContent(): string
- {
- return $this->content;
- }
-}
diff --git a/src/Attribute/Custom/HasDataBsAutoClose.php b/src/Attribute/Custom/HasDataBsAutoClose.php
deleted file mode 100644
index 2dac8341..00000000
--- a/src/Attribute/Custom/HasDataBsAutoClose.php
+++ /dev/null
@@ -1,27 +0,0 @@
-dataAttributes([
- DataAttributes::BS_AUTO_CLOSE => $value,
- ]);
- }
-}
diff --git a/src/Attribute/Custom/HasDataBsDismiss.php b/src/Attribute/Custom/HasDataBsDismiss.php
deleted file mode 100644
index f9d44e93..00000000
--- a/src/Attribute/Custom/HasDataBsDismiss.php
+++ /dev/null
@@ -1,27 +0,0 @@
-dataAttributes([
- DataAttributes::BS_DISMISS => $value,
- ]);
- }
-}
diff --git a/src/Attribute/Custom/HasDataBsTarget.php b/src/Attribute/Custom/HasDataBsTarget.php
deleted file mode 100644
index 54eeaf67..00000000
--- a/src/Attribute/Custom/HasDataBsTarget.php
+++ /dev/null
@@ -1,37 +0,0 @@
-dataAttributes([
- DataAttributes::BS_TARGET => $value,
- ]);
- }
-
- $new = clone $this;
- $new->dataBsTarget = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Custom/HasDataBsToggle.php b/src/Attribute/Custom/HasDataBsToggle.php
deleted file mode 100644
index f4ae3964..00000000
--- a/src/Attribute/Custom/HasDataBsToggle.php
+++ /dev/null
@@ -1,27 +0,0 @@
-dataAttributes([
- DataAttributes::BS_TOGGLE => $value,
- ]);
- }
-}
diff --git a/src/Attribute/Custom/HasDataCollapseToggle.php b/src/Attribute/Custom/HasDataCollapseToggle.php
deleted file mode 100644
index dcd2bed6..00000000
--- a/src/Attribute/Custom/HasDataCollapseToggle.php
+++ /dev/null
@@ -1,27 +0,0 @@
-dataAttributes([
- DataAttributes::COLLAPSE_TOGGLE => $value,
- ]);
- }
-}
diff --git a/src/Attribute/Custom/HasDataDismissTarget.php b/src/Attribute/Custom/HasDataDismissTarget.php
deleted file mode 100644
index ba4f500e..00000000
--- a/src/Attribute/Custom/HasDataDismissTarget.php
+++ /dev/null
@@ -1,35 +0,0 @@
-dataAttributes([
- DataAttributes::DISMISS_TARGET => $value,
- ]);
- }
-
- $new = clone $this;
- $new->dataDismissTarget = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Custom/HasDataDrawerTarget.php b/src/Attribute/Custom/HasDataDrawerTarget.php
deleted file mode 100644
index 9bf328e0..00000000
--- a/src/Attribute/Custom/HasDataDrawerTarget.php
+++ /dev/null
@@ -1,37 +0,0 @@
-dataAttributes([
- DataAttributes::DRAWER_TARGET => $value,
- ]);
- }
-
- $new = clone $this;
- $new->dataDrawerTarget = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Custom/HasDataDropdownToggle.php b/src/Attribute/Custom/HasDataDropdownToggle.php
deleted file mode 100644
index c9a4a106..00000000
--- a/src/Attribute/Custom/HasDataDropdownToggle.php
+++ /dev/null
@@ -1,37 +0,0 @@
-dataAttributes([
- DataAttributes::DROPDOWN_TOGGLE => $value,
- ]);
- }
-
- $new = clone $this;
- $new->dataDropdownToggle = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Custom/HasDataToggle.php b/src/Attribute/Custom/HasDataToggle.php
deleted file mode 100644
index dea19322..00000000
--- a/src/Attribute/Custom/HasDataToggle.php
+++ /dev/null
@@ -1,37 +0,0 @@
-dataAttributes([
- DataAttributes::TOGGLE => $value,
- ]);
- }
-
- $new = clone $this;
- $new->dataToggle = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Custom/HasDataValue.php b/src/Attribute/Custom/HasDataValue.php
deleted file mode 100644
index 96adad86..00000000
--- a/src/Attribute/Custom/HasDataValue.php
+++ /dev/null
@@ -1,27 +0,0 @@
-dataValue = $value;
- return $new;
- }
-}
diff --git a/src/Attribute/Custom/HasLabelCollection.php b/src/Attribute/Custom/HasLabelCollection.php
deleted file mode 100644
index 048294cb..00000000
--- a/src/Attribute/Custom/HasLabelCollection.php
+++ /dev/null
@@ -1,109 +0,0 @@
-label = Sanitize::html(...$values);
-
- return $new;
- }
-
- /**
- * Set the `HTML` attributes for the label.
- *
- * @param array $values Attribute values indexed by attribute names.
- *
- * @return static A new instance of the current class with the specified label attributes.
- */
- public function labelAttributes(array $values): static
- {
- $new = clone $this;
- $new->labelAttributes = $values;
-
- return $new;
- }
-
- /**
- * Set the `CSS` class for the label.
- *
- * @param string $value The value of the class attribute.
- * @param bool $override If `true` the value will be overridden.
- *
- * @return static A new instance of the current class with the specified label class.
- */
- public function labelClass(string $value, bool $override = false): static
- {
- $new = clone $this;
- CssClass::add($new->labelAttributes, $value, $override);
-
- return $new;
- }
-
- /**
- * Set the `for` attribute for the label.
- *
- * @param string|null $value The value for the `for` attribute.
- *
- * @return static A new instance of the current class with the specified label `for` attribute.
- */
- public function labelFor(string|null $value): static
- {
- $new = clone $this;
- $new->labelFor = $value;
-
- return $new;
- }
-
- /**
- * Disable the label rendering.
- *
- * @return static A new instance of the current class with the label disabled.
- */
- public function notLabel(): static
- {
- $new = clone $this;
- $new->isLabel = false;
-
- return $new;
- }
-
- /**
- * Render the label tag.
- *
- * @param string|null $labelFor The `for` attribute value.
- *
- * @return string The rendered label tag.
- */
- protected function renderLabelTag(string $labelFor = null): string
- {
- if ($this->isLabel === false || $this->label === '') {
- return '';
- }
-
- return Label::widget()->attributes($this->labelAttributes)->content($this->label)->for($labelFor)->render();
- }
-}
diff --git a/src/Attribute/Custom/HasPrefixCollection.php b/src/Attribute/Custom/HasPrefixCollection.php
deleted file mode 100644
index 7210aa13..00000000
--- a/src/Attribute/Custom/HasPrefixCollection.php
+++ /dev/null
@@ -1,118 +0,0 @@
-prefix = Sanitize::html(...$values);
-
- return $new;
- }
-
- /**
- * Enable or disable the prefix container.
- *
- * @param bool $value The prefix container value.
- *
- * @return static A new instance of the current class with the specified prefix container value.
- */
- public function prefixContainer(bool $value): static
- {
- $new = clone $this;
- $new->prefixContainer = $value;
-
- return $new;
- }
-
- /**
- * Set the `HTML` attributes for the prefix container.
- *
- * @param array $values Attribute values indexed by attribute names.
- *
- * @return static A new instance of the current class with the specified prefix container attributes.
- */
- public function prefixContainerAttributes(array $values): static
- {
- $new = clone $this;
- $new->prefixContainerAttributes = $values;
-
- return $new;
- }
-
- /**
- * Set the `CSS` class for the prefix container.
- *
- * @param string $value The CSS class name.
- * @param bool $override If `true` the value will be overridden.
- *
- * @return static A new instance of the current class with the specified prefix container class.
- */
- public function prefixContainerClass(string $value, bool $override = false): static
- {
- $new = clone $this;
- CssClass::add($new->prefixContainerAttributes, $value, $override);
-
- return $new;
- }
-
- /**
- * Set the prefix container tag name.
- *
- * @param string $value The tag name for the prefix container element.
- *
- * @throws InvalidArgumentException If the prefix container tag is an empty string.
- *
- * @return static A new instance of the current class with the specified prefix container tag.
- */
- public function prefixContainerTag(string $value): static
- {
- if ($value === '') {
- throw new InvalidArgumentException('The prefix container tag must be a non-empty string.');
- }
-
- $new = clone $this;
- $new->prefixContainerTag = $value;
-
- return $new;
- }
-
- /**
- * Render the prefix container.
- *
- * @return string The prefix container.
- */
- private function renderPrefixTag(): string
- {
- return match ($this->prefixContainer) {
- true => Tag::widget()
- ->attributes($this->prefixContainerAttributes)
- ->content($this->prefix)
- ->tagName($this->prefixContainerTag)
- ->render(),
- false => $this->prefix,
- };
- }
-}
diff --git a/src/Attribute/Custom/HasSuffixCollection.php b/src/Attribute/Custom/HasSuffixCollection.php
deleted file mode 100644
index c9905112..00000000
--- a/src/Attribute/Custom/HasSuffixCollection.php
+++ /dev/null
@@ -1,118 +0,0 @@
-suffix = Sanitize::html(...$values);
-
- return $new;
- }
-
- /**
- * Enable or disable the suffix container.
- *
- * @param bool $value The suffix container value.
- *
- * @return static A new instance of the current class with the specified suffix container value.
- */
- public function suffixContainer(bool $value): static
- {
- $new = clone $this;
- $new->suffixContainer = $value;
-
- return $new;
- }
-
- /**
- * Set the `HTML` attributes for the suffix container.
- *
- * @param array $values Attribute values indexed by attribute names.
- *
- * @return static A new instance of the current class with the specified suffix container attributes.
- */
- public function suffixContainerAttributes(array $values): static
- {
- $new = clone $this;
- $new->suffixContainerAttributes = $values;
-
- return $new;
- }
-
- /**
- * Set the `CSS` class for the suffix container.
- *
- * @param string $value The CSS class name.
- * @param bool $override If `true` the value will be overridden.
- *
- * @return static A new instance of the current class with the specified suffix container class.
- */
- public function suffixContainerClass(string $value, bool $override = false): static
- {
- $new = clone $this;
- CssClass::add($new->suffixContainerAttributes, $value, $override);
-
- return $new;
- }
-
- /**
- * Set the suffix container tag name.
- *
- * @param string $value The tag name for the suffix container element.
- *
- * @throws InvalidArgumentException If the suffix container tag is an empty string.
- *
- * @return static A new instance of the current class with the specified suffix container tag.
- */
- public function suffixContainerTag(string $value): static
- {
- if ($value === '') {
- throw new InvalidArgumentException('The suffix container tag must be a non-empty string.');
- }
-
- $new = clone $this;
- $new->suffixContainerTag = $value;
-
- return $new;
- }
-
- /**
- * Render the suffix container.
- *
- * @return string The suffix container.
- */
- private function renderSuffixTag(): string
- {
- return match ($this->suffixContainer) {
- true => Tag::widget()
- ->attributes($this->suffixContainerAttributes)
- ->content($this->suffix)
- ->tagName($this->suffixContainerTag)
- ->render(),
- default => $this->suffix,
- };
- }
-}
diff --git a/src/Attribute/Custom/HasTemplate.php b/src/Attribute/Custom/HasTemplate.php
deleted file mode 100644
index 2498f8cc..00000000
--- a/src/Attribute/Custom/HasTemplate.php
+++ /dev/null
@@ -1,52 +0,0 @@
-template = $value;
-
- return $new;
- }
-
- private function renderTemplate(string $template, array $tokenValues): string
- {
- $result = '';
- $tokens = explode('\n', $template);
-
- foreach ($tokens as $key => $token) {
- $tokenValue = strtr($token, $tokenValues);
-
- if ($tokenValue !== '') {
- $result .= $tokenValue;
- }
-
- if ($result !== '' && $key < count($tokens) - 1) {
- $result = strtr($tokens[$key + 1], $tokenValues) !== '' ? $result . PHP_EOL : $result;
- }
- }
-
- return $result;
- }
-}
diff --git a/src/Attribute/Custom/HasValidateInList.php b/src/Attribute/Custom/HasValidateInList.php
deleted file mode 100644
index b0f79adf..00000000
--- a/src/Attribute/Custom/HasValidateInList.php
+++ /dev/null
@@ -1,39 +0,0 @@
-attributes['id'] = Utils::generateInputId($modelName, $fieldName);
- $new->attributes['name'] = Utils::generateInputName($modelName, $fieldName, $arrayable);
-
- return $new;
- }
-}
diff --git a/src/Attribute/HasClass.php b/src/Attribute/HasClass.php
deleted file mode 100644
index 6c00cf6e..00000000
--- a/src/Attribute/HasClass.php
+++ /dev/null
@@ -1,31 +0,0 @@
-attributes, $value, $override);
-
- return $new;
- }
-}
diff --git a/src/Attribute/HasData.php b/src/Attribute/HasData.php
deleted file mode 100644
index 229efd96..00000000
--- a/src/Attribute/HasData.php
+++ /dev/null
@@ -1,41 +0,0 @@
- $value) {
- if (!is_string($key) || (!is_string($value) && !$value instanceof Closure)) {
- throw new InvalidArgumentException(
- 'The data attribute key must be a string and the value must be a string or a Closure.',
- );
- }
-
-
- $new->attributes["data-$key"] = $value;
- }
-
- return $new;
- }
-}
diff --git a/src/Attribute/HasId.php b/src/Attribute/HasId.php
deleted file mode 100644
index a805bf8c..00000000
--- a/src/Attribute/HasId.php
+++ /dev/null
@@ -1,44 +0,0 @@
-id = $value;
-
- return $new;
- }
-
- /**
- * Generate a unique ID for the widget.
- *
- * @param string $value The value to use for the ID.
- *
- * @return string|null A unique ID for the widget.
- */
- protected function generateId(string $value = 'id_'): string|null
- {
- return $this->id === '' ? uniqid($value) : $this->id;
- }
-}
diff --git a/src/Attribute/HasLang.php b/src/Attribute/HasLang.php
deleted file mode 100644
index f4599160..00000000
--- a/src/Attribute/HasLang.php
+++ /dev/null
@@ -1,32 +0,0 @@
-attributes['lang'] = Encode::content($value);
-
- return $new;
- }
-}
diff --git a/src/Attribute/HasStyle.php b/src/Attribute/HasStyle.php
deleted file mode 100644
index afa5353b..00000000
--- a/src/Attribute/HasStyle.php
+++ /dev/null
@@ -1,28 +0,0 @@
-attributes['style'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/HasTabindex.php b/src/Attribute/HasTabindex.php
deleted file mode 100644
index 61781071..00000000
--- a/src/Attribute/HasTabindex.php
+++ /dev/null
@@ -1,41 +0,0 @@
-attributes['tabindex'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/HasTitle.php b/src/Attribute/HasTitle.php
deleted file mode 100644
index 8a3bb9d6..00000000
--- a/src/Attribute/HasTitle.php
+++ /dev/null
@@ -1,28 +0,0 @@
-attributes['title'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/CanBeChecked.php b/src/Attribute/Input/CanBeChecked.php
deleted file mode 100644
index 4d073b31..00000000
--- a/src/Attribute/Input/CanBeChecked.php
+++ /dev/null
@@ -1,36 +0,0 @@
-checked = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/CanBeDisabled.php b/src/Attribute/Input/CanBeDisabled.php
deleted file mode 100644
index 86b5b7a7..00000000
--- a/src/Attribute/Input/CanBeDisabled.php
+++ /dev/null
@@ -1,35 +0,0 @@
-attributes['disabled'] = true;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/CanBeMultiple.php b/src/Attribute/Input/CanBeMultiple.php
deleted file mode 100644
index cb582862..00000000
--- a/src/Attribute/Input/CanBeMultiple.php
+++ /dev/null
@@ -1,27 +0,0 @@
-attributes['multiple'] = true;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/CanBeReadonly.php b/src/Attribute/Input/CanBeReadonly.php
deleted file mode 100644
index 8beff4d7..00000000
--- a/src/Attribute/Input/CanBeReadonly.php
+++ /dev/null
@@ -1,29 +0,0 @@
-attributes['readonly'] = true;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/CanBeRequired.php b/src/Attribute/Input/CanBeRequired.php
deleted file mode 100644
index 28be40b8..00000000
--- a/src/Attribute/Input/CanBeRequired.php
+++ /dev/null
@@ -1,30 +0,0 @@
-attributes['required'] = true;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasAccept.php b/src/Attribute/Input/HasAccept.php
deleted file mode 100644
index e07445e6..00000000
--- a/src/Attribute/Input/HasAccept.php
+++ /dev/null
@@ -1,32 +0,0 @@
-attributes['accept'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasAlt.php b/src/Attribute/Input/HasAlt.php
deleted file mode 100644
index 5549d07d..00000000
--- a/src/Attribute/Input/HasAlt.php
+++ /dev/null
@@ -1,29 +0,0 @@
-attributes['alt'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasAutocomplete.php b/src/Attribute/Input/HasAutocomplete.php
deleted file mode 100644
index 0e8ff93d..00000000
--- a/src/Attribute/Input/HasAutocomplete.php
+++ /dev/null
@@ -1,35 +0,0 @@
-attributes['autocomplete'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasDirname.php b/src/Attribute/Input/HasDirname.php
deleted file mode 100644
index 1469dc8e..00000000
--- a/src/Attribute/Input/HasDirname.php
+++ /dev/null
@@ -1,35 +0,0 @@
-attributes['dirname'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasForm.php b/src/Attribute/Input/HasForm.php
deleted file mode 100644
index 28ed9494..00000000
--- a/src/Attribute/Input/HasForm.php
+++ /dev/null
@@ -1,30 +0,0 @@
-attributes['form'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasFormaction.php b/src/Attribute/Input/HasFormaction.php
deleted file mode 100644
index 701bf269..00000000
--- a/src/Attribute/Input/HasFormaction.php
+++ /dev/null
@@ -1,34 +0,0 @@
-attributes['formaction'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasFormenctype.php b/src/Attribute/Input/HasFormenctype.php
deleted file mode 100644
index 17439005..00000000
--- a/src/Attribute/Input/HasFormenctype.php
+++ /dev/null
@@ -1,42 +0,0 @@
-validateInList(
- $value,
- 'Invalid value "%s" for the formenctype attribute. Allowed values are: "%s".',
- 'application/x-www-form-urlencoded',
- 'multipart/form-data',
- 'text/plain'
- );
-
- $new = clone $this;
- $new->attributes['formenctype'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasFormmethod.php b/src/Attribute/Input/HasFormmethod.php
deleted file mode 100644
index a56abeaa..00000000
--- a/src/Attribute/Input/HasFormmethod.php
+++ /dev/null
@@ -1,43 +0,0 @@
-validateInList(
- strtoupper($value),
- 'Invalid value "%s" for the formmethod attribute. Allowed values are: "%s".',
- 'GET',
- 'POST'
- );
-
- $new = clone $this;
- $new->attributes['formmethod'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasFormnovalidate.php b/src/Attribute/Input/HasFormnovalidate.php
deleted file mode 100644
index b262b966..00000000
--- a/src/Attribute/Input/HasFormnovalidate.php
+++ /dev/null
@@ -1,24 +0,0 @@
-attributes['formnovalidate'] = true;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasFormtarget.php b/src/Attribute/Input/HasFormtarget.php
deleted file mode 100644
index 955ce3a8..00000000
--- a/src/Attribute/Input/HasFormtarget.php
+++ /dev/null
@@ -1,45 +0,0 @@
-validateInList(
- $value,
- 'Invalid value "%s" for the formtarget attribute. Allowed values are: "%s".',
- '_blank',
- '_self',
- '_parent',
- '_top'
- );
-
-
- $new = clone $this;
- $new->attributes['formtarget'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasHeight.php b/src/Attribute/Input/HasHeight.php
deleted file mode 100644
index f6b1beaf..00000000
--- a/src/Attribute/Input/HasHeight.php
+++ /dev/null
@@ -1,31 +0,0 @@
-attributes['height'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Input/HasName.php b/src/Attribute/Input/HasName.php
deleted file mode 100644
index b5a5f1fb..00000000
--- a/src/Attribute/Input/HasName.php
+++ /dev/null
@@ -1,32 +0,0 @@
-attributes['name'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Tag/HasCrossorigin.php b/src/Attribute/Tag/HasCrossorigin.php
index c1128463..31ff3f5c 100644
--- a/src/Attribute/Tag/HasCrossorigin.php
+++ b/src/Attribute/Tag/HasCrossorigin.php
@@ -5,16 +5,13 @@
namespace PHPForge\Html\Attribute\Tag;
use InvalidArgumentException;
-
-use PHPForge\Html\Attribute\Custom\HasValidateInList;
+use PHPForge\Html\Helper\Validator;
/**
* Is used by widgets that implement the crossorigin method.
*/
trait HasCrossorigin
{
- use HasValidateInList;
-
/**
* Set the crossorigin.
*
@@ -31,7 +28,7 @@ trait HasCrossorigin
*/
public function crossorigin(string $value): static
{
- $this->validateInList(
+ Validator::inList(
$value,
'Invalid value "%s" for the crossorigin attribute. Allowed values are: "%s".',
'anonymous',
diff --git a/src/Attribute/Tag/HasEnctype.php b/src/Attribute/Tag/HasEnctype.php
index c4ce8f02..a1997a1d 100644
--- a/src/Attribute/Tag/HasEnctype.php
+++ b/src/Attribute/Tag/HasEnctype.php
@@ -5,15 +5,13 @@
namespace PHPForge\Html\Attribute\Tag;
use InvalidArgumentException;
-use PHPForge\Html\Attribute\Custom\HasValidateInList;
+use PHPForge\Html\Helper\Validator;
/**
* Is used by widgets that implement the enctype method.
*/
trait HasEnctype
{
- use HasValidateInList;
-
/**
* Set the enctype content attribute specifies the content type of the form submission.
*
@@ -28,7 +26,7 @@ trait HasEnctype
*/
public function enctype(string $value): static
{
- $this->validateInList(
+ Validator::inList(
$value,
'Invalid value "%s" for the enctype attribute. Allowed values are: "%s".',
'multipart/form-data',
diff --git a/src/Attribute/Tag/HasFor.php b/src/Attribute/Tag/HasFor.php
deleted file mode 100644
index 687f9a81..00000000
--- a/src/Attribute/Tag/HasFor.php
+++ /dev/null
@@ -1,32 +0,0 @@
-attributes['for'] = $value;
-
- return $new;
- }
-}
diff --git a/src/Attribute/Tag/HasLoading.php b/src/Attribute/Tag/HasLoading.php
index d2fda74c..817bf494 100644
--- a/src/Attribute/Tag/HasLoading.php
+++ b/src/Attribute/Tag/HasLoading.php
@@ -5,16 +5,13 @@
namespace PHPForge\Html\Attribute\Tag;
use InvalidArgumentException;
-
-use PHPForge\Html\Attribute\Custom\HasValidateInList;
+use PHPForge\Html\Helper\Validator;
/**
* Is used by widgets that implement the loading method.
*/
trait HasLoading
{
- use HasValidateInList;
-
/**
* Specifying when the browser should load the image.
*
@@ -26,7 +23,7 @@ trait HasLoading
*/
public function loading(string $value): static
{
- $this->validateInList(
+ Validator::inList(
$value,
'Invalid value "%s" for the loading attribute. Allowed values are: "%s".',
'eager',
diff --git a/src/Attribute/Tag/HasReferrerpolicy.php b/src/Attribute/Tag/HasReferrerpolicy.php
index 778a95e0..b5493a00 100644
--- a/src/Attribute/Tag/HasReferrerpolicy.php
+++ b/src/Attribute/Tag/HasReferrerpolicy.php
@@ -5,15 +5,13 @@
namespace PHPForge\Html\Attribute\Tag;
use InvalidArgumentException;
-use PHPForge\Html\Attribute\Custom\HasValidateInList;
+use PHPForge\Html\Helper\Validator;
/**
* Is used by widgets that implement the referrerpolicy method.
*/
trait HasReferrerpolicy
{
- use HasValidateInList;
-
/**
* Returns a new instance specifying a string indicating which referrer to use when fetching the resource.
*
@@ -29,7 +27,7 @@ trait HasReferrerpolicy
*/
public function referrerpolicy(string $value): static
{
- $this->validateInList(
+ Validator::inList(
$value,
'Invalid value "%s" for the referrerpolicy attribute. Allowed values are: "%s".',
'no-referrer',
diff --git a/src/Attribute/Tag/HasRel.php b/src/Attribute/Tag/HasRel.php
index bdd9fe8e..ef26376e 100644
--- a/src/Attribute/Tag/HasRel.php
+++ b/src/Attribute/Tag/HasRel.php
@@ -5,15 +5,13 @@
namespace PHPForge\Html\Attribute\Tag;
use InvalidArgumentException;
-use PHPForge\Html\Attribute\Custom\HasValidateInList;
+use PHPForge\Html\Helper\Validator;
/**
* Is used by widgets that implement the rel method.
*/
trait HasRel
{
- use HasValidateInList;
-
/**
* Set the rel attribute specifies the relationship between the current document and the linked document.
*
@@ -29,7 +27,7 @@ trait HasRel
*/
public function rel(string $value): static
{
- $this->validateInList(
+ Validator::inList(
$value,
'Invalid value "%s" for the rel attribute. Allowed values are: "%s".',
'alternate',
diff --git a/src/Attribute/Tag/HasTarget.php b/src/Attribute/Tag/HasTarget.php
index b1620e19..dd7cf09b 100644
--- a/src/Attribute/Tag/HasTarget.php
+++ b/src/Attribute/Tag/HasTarget.php
@@ -5,15 +5,13 @@
namespace PHPForge\Html\Attribute\Tag;
use InvalidArgumentException;
-use PHPForge\Html\Attribute\Custom\HasValidateInList;
+use PHPForge\Html\Helper\Validator;
/**
* Is used by widgets that implement the target method.
*/
trait HasTarget
{
- use HasValidateInList;
-
/**
* Set the target attributes, if specified, must have values that are valid browsing context names or keywords.
*
@@ -28,7 +26,7 @@ trait HasTarget
*/
public function target(string $value): static
{
- $this->validateInList(
+ Validator::inList(
$value,
'Invalid value "%s" for the target attribute. Allowed values are: "%s".',
'_blank',
diff --git a/src/Attribute/Tag/HasWrap.php b/src/Attribute/Tag/HasWrap.php
index fe9d3aa6..cb1cb3c1 100644
--- a/src/Attribute/Tag/HasWrap.php
+++ b/src/Attribute/Tag/HasWrap.php
@@ -5,15 +5,13 @@
namespace PHPForge\Html\Attribute\Tag;
use InvalidArgumentException;
-use PHPForge\Html\Attribute\Custom\HasValidateInList;
+use PHPForge\Html\Helper\Validator;
/**
* Is used by widgets that implement the wrap method.
*/
trait HasWrap
{
- use HasValidateInList;
-
/**
* Set the wrap attribute is an enumerated attribute with two keywords and states: the soft keyword, which maps to
* the Soft state, and the hard keyword which maps to the Hard state.
@@ -32,7 +30,7 @@ trait HasWrap
*/
public function wrap(string $value = 'hard'): static
{
- $this->validateInList(
+ Validator::inList(
$value,
'Invalid value "%s" for the wrap attribute. Allowed values are: "%s".',
'hard',
diff --git a/src/Base/AbstractBlockElement.php b/src/Base/AbstractBlockElement.php
index 2a4666a9..cb1e210b 100644
--- a/src/Base/AbstractBlockElement.php
+++ b/src/Base/AbstractBlockElement.php
@@ -5,15 +5,14 @@
namespace PHPForge\Html\Base;
use PHPForge\Html\{
- Attribute\Custom\HasAttributes,
- Attribute\Custom\HasContent,
- Attribute\HasClass,
- Attribute\HasData,
- Attribute\HasId,
- Attribute\HasLang,
- Attribute\HasStyle,
- Attribute\HasTitle,
- Attribute\Input\HasName,
+ Attribute\Global\HasClass,
+ Attribute\Global\HasData,
+ Attribute\Global\HasId,
+ Attribute\Global\HasLang,
+ Attribute\Global\HasStyle,
+ Attribute\Global\HasTitle,
+ Attribute\HasAttributes,
+ Attribute\HasContent,
HtmlBuilder
};
use PHPForge\Widget\Block;
@@ -29,11 +28,9 @@ abstract class AbstractBlockElement extends Block
use HasData;
use HasId;
use HasLang;
- use HasName;
use HasStyle;
use HasTitle;
- protected array $attributes = [];
protected string $tagName = '';
/**
@@ -44,10 +41,8 @@ abstract class AbstractBlockElement extends Block
public function begin(): string
{
parent::begin();
- $attributes = $this->attributes;
- $attributes['id'] = $this->id;
- return HtmlBuilder::begin($this->tagName, $attributes);
+ return HtmlBuilder::begin($this->tagName, $this->attributes);
}
/**
@@ -58,10 +53,7 @@ public function begin(): string
protected function run(): string
{
if ($this->isBeginExecuted() === false) {
- $attributes = $this->attributes;
- $attributes['id'] = $this->id;
-
- return HtmlBuilder::create($this->tagName, $this->content, $attributes);
+ return HtmlBuilder::create($this->tagName, $this->content, $this->attributes);
}
return HtmlBuilder::end($this->tagName);
diff --git a/src/Base/AbstractElement.php b/src/Base/AbstractElement.php
index a3f4883b..d7e6a87b 100644
--- a/src/Base/AbstractElement.php
+++ b/src/Base/AbstractElement.php
@@ -5,21 +5,23 @@
namespace PHPForge\Html\Base;
use PHPForge\{
- Html\Attribute\Custom\HasAttributes,
- Html\Attribute\Custom\HasPrefixCollection,
- Html\Attribute\Custom\HasSuffixCollection,
- Html\Attribute\Custom\HasTemplate,
- Html\Attribute\HasClass,
- Html\Attribute\HasData,
- Html\Attribute\HasId,
- Html\Attribute\HasLang,
- Html\Attribute\HasStyle,
- Html\Attribute\HasTitle,
- Html\Attribute\Input\HasName,
+ Html\Attribute\Global\HasClass,
+ Html\Attribute\Global\HasData,
+ Html\Attribute\Global\HasId,
+ Html\Attribute\Global\HasLang,
+ Html\Attribute\Global\HasStyle,
+ Html\Attribute\Global\HasTitle,
+ Html\Attribute\HasAttributes,
+ Html\Attribute\HasPrefixCollection,
+ Html\Attribute\HasSuffixCollection,
+ Html\Attribute\HasTemplate,
+ Html\Helper\Template,
Html\HtmlBuilder,
Html\Interop\RenderInterface,
+ Html\Tag,
Widget\Element
};
+use PHPForge\Html\Document\Html;
/**
* Provides a foundation for creating HTML elements with various attributes and content.
@@ -31,21 +33,20 @@ abstract class AbstractElement extends Element implements RenderInterface
use HasData;
use HasId;
use HasLang;
- use HasName;
use HasPrefixCollection;
use HasStyle;
use HasSuffixCollection;
use HasTemplate;
use HasTitle;
- protected array $attributes = [];
-
/**
* This method is used to configure the widget with the provided default definitions.
*/
protected function loadDefaultDefinitions(): array
{
return [
+ 'prefixTag()' => [false],
+ 'suffixTag()' => [false],
'template()' => ['{prefix}\n{tag}\n{suffix}'],
];
}
@@ -61,16 +62,22 @@ protected function loadDefaultDefinitions(): array
*/
protected function buildElement(string $tagName, string $content = '', array $tokenValues = []): string
{
- $attributes = $this->attributes;
- $attributes['id'] ??= $this->id;
-
$tokenTemplateValues = [
- '{prefix}' => $this->renderPrefixTag(),
- '{tag}' => HtmlBuilder::create($tagName, $content, $attributes),
- '{suffix}' => $this->renderSuffixTag(),
+ '{prefix}' => $this->renderTag($this->prefixAttributes, $this->prefix, $this->prefixTag),
+ '{tag}' => HtmlBuilder::create($tagName, $content, $this->attributes),
+ '{suffix}' => $this->renderTag($this->suffixAttributes, $this->suffix, $this->suffixTag),
];
$tokenTemplateValues += $tokenValues;
- return $this->renderTemplate($this->template, $tokenTemplateValues);
+ return Template::render($this->template, $tokenTemplateValues);
+ }
+
+ private function renderTag(array $attributes, string $content, false|string $tag): string
+ {
+ if ($content === '' || $tag === false) {
+ return $content;
+ }
+
+ return HtmlBuilder::create($tag, $content, $attributes);
}
}
diff --git a/src/Base/AbstractSvg.php b/src/Base/AbstractSvg.php
index dfde37d0..af2a4100 100644
--- a/src/Base/AbstractSvg.php
+++ b/src/Base/AbstractSvg.php
@@ -8,19 +8,18 @@
use DOMElement;
use enshrined\svgSanitize\Sanitizer;
use InvalidArgumentException;
-use PHPForge\Html\{
- Attribute\Custom\HasAttributes,
- Attribute\Custom\HasContent,
- Attribute\HasClass,
- Attribute\HasId,
- Attribute\HasLang,
- Attribute\HasTitle,
- Attribute\Input\HasHeight,
- Attribute\Input\HasName,
- Attribute\Input\HasWidth,
- Tag
+use PHPForge\{
+ Html\Attribute\FormControl\HasHeight,
+ Html\Attribute\Global\HasClass,
+ Html\Attribute\Global\HasId,
+ Html\Attribute\Global\HasLang,
+ Html\Attribute\Global\HasTitle,
+ Html\Attribute\HasAttributes,
+ Html\Attribute\HasContent,
+ Html\Attribute\Input\HasWidth,
+ Html\Tag,
+ Widget\Element
};
-use PHPForge\Widget\Element;
use RuntimeException;
use function file_get_contents;
@@ -36,11 +35,9 @@ abstract class AbstractSvg extends Element
use HasHeight;
use HasId;
use HasLang;
- use HasName;
use HasTitle;
use HasWidth;
- protected array $attributes = [];
private string $filePath = '';
/**
@@ -136,7 +133,6 @@ protected function run(): string
default => Tag::widget()
->attributes($this->attributes)
->content(PHP_EOL, $this->content, PHP_EOL)
- ->id($this->id)
->tagName('svg')
->render(),
};
@@ -181,7 +177,6 @@ private function renderSvg(): string
{
/** @psalm-var array $attributes */
$attributes = $this->attributes;
- $attributes['id'] = $this->id;
$svg = new DOMDocument();
@@ -189,9 +184,7 @@ private function renderSvg(): string
/** @psalm-var mixed $value */
foreach ($attributes as $name => $value) {
- if ($name !== '' && $value !== '' && $value !== null) {
- $renderedSvg->setAttribute($name, (string) $value);
- }
+ $renderedSvg->setAttribute($name, (string) $value);
}
return $svg->saveXML($renderedSvg);
diff --git a/src/FormControl/Base/AbstractForm.php b/src/FormControl/Base/AbstractForm.php
index 25c1a85a..ec81fd46 100644
--- a/src/FormControl/Base/AbstractForm.php
+++ b/src/FormControl/Base/AbstractForm.php
@@ -5,17 +5,17 @@
namespace PHPForge\Html\FormControl\Base;
use PHPForge\Html\{
- Attribute\Custom\HasAttributes,
- Attribute\Custom\HasContent,
Attribute\Custom\HasCsrf,
- Attribute\HasClass,
- Attribute\HasId,
- Attribute\HasLang,
- Attribute\HasStyle,
- Attribute\HasTitle,
- Attribute\Input\HasAccept,
- Attribute\Input\HasAutocomplete,
- Attribute\Input\HasName,
+ Attribute\FormControl\HasAccept,
+ Attribute\FormControl\HasAutocomplete,
+ Attribute\FormControl\HasName,
+ Attribute\Global\HasClass,
+ Attribute\Global\HasId,
+ Attribute\Global\HasLang,
+ Attribute\Global\HasStyle,
+ Attribute\Global\HasTitle,
+ Attribute\HasAttributes,
+ Attribute\HasContent,
Attribute\Tag\CanBeNoValidate,
Attribute\Tag\HasAction,
Attribute\Tag\HasEnctype,
@@ -54,8 +54,6 @@ abstract class AbstractForm extends Block
use HasStyle;
use HasTitle;
- protected array $attributes = [];
-
/**
* Begin rendering the block element.
*
@@ -67,10 +65,7 @@ public function begin(): string
$hiddenInputs = $this->renderHiddenInput();
- $attributes = $this->attributes;
- $attributes['id'] = $this->id;
-
- $html = HtmlBuilder::begin('form', $attributes);
+ $html = HtmlBuilder::begin('form', $this->attributes);
if ($hiddenInputs !== '') {
$html .= "\n$hiddenInputs";
@@ -89,15 +84,13 @@ protected function run(): string
if ($this->isBeginExecuted() === false) {
$hiddenInputs = $this->renderHiddenInput();
- $attributes = $this->attributes;
- $attributes['id'] = $this->id;
$html = '';
if ($hiddenInputs !== '') {
$html = "$hiddenInputs\n";
}
- return HtmlBuilder::create('form', $html . $this->content, $attributes);
+ return HtmlBuilder::create('form', $html . $this->content, $this->attributes);
}
return HtmlBuilder::end('form');
diff --git a/src/FormControl/Base/AbstractSelect.php b/src/FormControl/Base/AbstractSelect.php
index 1a927df8..16285410 100644
--- a/src/FormControl/Base/AbstractSelect.php
+++ b/src/FormControl/Base/AbstractSelect.php
@@ -7,20 +7,21 @@
use InvalidArgumentException;
use PHPForge\{
Html\Attribute\Aria\HasAriaLabel,
- Html\Attribute\CanBeAutofocus,
- Html\Attribute\Custom\HasAttributes,
- Html\Attribute\Custom\HasLabelCollection,
- Html\Attribute\Custom\HasPrefixCollection,
- Html\Attribute\Custom\HasSuffixCollection,
- Html\Attribute\Field\HasGenerateField,
- Html\Attribute\HasClass,
- Html\Attribute\HasId,
- Html\Attribute\HasStyle,
- Html\Attribute\HasTabindex,
- Html\Attribute\Input\CanBeDisabled,
- Html\Attribute\Input\CanBeMultiple,
- Html\Attribute\Input\CanBeRequired,
- Html\Attribute\Input\HasName,
+ Html\Attribute\FormControl\CanBeDisabled,
+ Html\Attribute\FormControl\CanBeMultiple,
+ Html\Attribute\FormControl\CanBeRequired,
+ Html\Attribute\FormControl\HasAutocomplete,
+ Html\Attribute\FormControl\HasFieldAttributes,
+ Html\Attribute\FormControl\HasName,
+ Html\Attribute\FormControl\Label\HasLabelCollection,
+ Html\Attribute\Global\CanBeAutofocus,
+ Html\Attribute\Global\HasClass,
+ Html\Attribute\Global\HasId,
+ Html\Attribute\Global\HasStyle,
+ Html\Attribute\Global\HasTabindex,
+ Html\Attribute\HasAttributes,
+ Html\Attribute\HasPrefixCollection,
+ Html\Attribute\HasSuffixCollection,
Html\Attribute\Input\HasSize,
Html\Attribute\Input\HasValue,
Html\Attribute\Tag\HasGroup,
@@ -33,7 +34,7 @@
Html\Interop\RequiredInterface,
Html\Interop\ValueInterface,
Html\Tag,
- Widget\Element,
+ Widget\Element
};
use Stringable;
@@ -42,7 +43,6 @@
use function implode;
use function in_array;
use function is_array;
-use function is_bool;
use function is_object;
/**
@@ -60,8 +60,9 @@ abstract class AbstractSelect extends Element implements
use CanBeRequired;
use HasAriaLabel;
use HasAttributes;
+ use HasAutocomplete;
use HasClass;
- use HasGenerateField;
+ use HasFieldAttributes;
use HasGroup;
use HasId;
use HasItems;
@@ -76,12 +77,8 @@ abstract class AbstractSelect extends Element implements
use HasTabindex;
use HasValue;
- protected array $attributes = [];
-
protected function run(): string
{
- $attributes = $this->attributes;
- $multiple = false;
/** @psalm-var array|scalar|object|null $value */
$value = $this->getValue();
@@ -98,11 +95,7 @@ protected function run(): string
throw new InvalidArgumentException('Select::class widget value can not be an object.');
}
- if (array_key_exists('multiple', $attributes) && is_bool($attributes['multiple'])) {
- $multiple = $attributes['multiple'];
- }
-
- if ($multiple === true && is_array($value) === false) {
+ if ($this->isMultiple() === true && is_array($value) === false) {
throw new InvalidArgumentException('Select::class widget value must be an array when multiple is "true".');
}
@@ -110,23 +103,20 @@ protected function run(): string
$items .= PHP_EOL . implode(PHP_EOL, $this->renderItems($value)) . PHP_EOL;
}
- unset($attributes['value']);
+ unset($this->attributes['value']);
$selectTag = Tag::widget()
- ->attributes($attributes)
+ ->attributes($this->attributes)
->content($items)
- ->id($this->id)
->prefix($this->prefix)
- ->prefixContainer($this->prefixContainer)
- ->prefixContainerAttributes($this->prefixContainerAttributes)
- ->prefixContainerTag($this->prefixContainerTag)
+ ->prefixAttributes($this->prefixAttributes)
+ ->prefixTag($this->prefixTag)
->suffix($this->suffix)
- ->suffixContainer($this->suffixContainer)
- ->suffixContainerAttributes($this->suffixContainerAttributes)
- ->suffixContainerTag($this->suffixContainerTag)
+ ->suffixAttributes($this->suffixAttributes)
+ ->suffixTag($this->suffixTag)
->tagName('select');
- if ($this->isLabel === false || $this->label === '') {
+ if ($this->disableLabel === true || $this->label === '') {
return $selectTag->render();
}
diff --git a/src/FormControl/Button.php b/src/FormControl/Button.php
index 36ce6c97..3d42e8f8 100644
--- a/src/FormControl/Button.php
+++ b/src/FormControl/Button.php
@@ -4,32 +4,38 @@
namespace PHPForge\Html\FormControl;
-use PHPForge\Html\{
- Attribute\Aria\HasAriaControls,
- Attribute\Aria\HasAriaDescribedBy,
- Attribute\Aria\HasAriaDisabled,
- Attribute\Aria\HasAriaExpanded,
- Attribute\Aria\HasAriaLabel,
- Attribute\Aria\HasRole,
- Attribute\Custom\HasAttributes,
- Attribute\Custom\HasContainerCollection,
- Attribute\Custom\HasContent,
- Attribute\Custom\HasPrefixCollection,
- Attribute\Custom\HasSuffixCollection,
- Attribute\Custom\HasTagName,
- Attribute\Custom\HasTemplate,
- Attribute\Custom\HasValidateInList,
- Attribute\HasClass,
- Attribute\HasData,
- Attribute\HasId,
- Attribute\HasLang,
- Attribute\HasStyle,
- Attribute\HasTabindex,
- Attribute\HasTitle,
- Attribute\Input\HasName,
- Tag
+use PHPForge\{
+ Html\Attribute\Aria\HasAriaControls,
+ Html\Attribute\Aria\HasAriaDescribedBy,
+ Html\Attribute\Aria\HasAriaDisabled,
+ Html\Attribute\Aria\HasAriaExpanded,
+ Html\Attribute\Aria\HasAriaLabel,
+ Html\Attribute\Aria\HasRole,
+ Html\Attribute\Custom\HasContainerCollection,
+ Html\Attribute\Custom\HasTagName,
+ Html\Attribute\FormControl\HasFormaction,
+ Html\Attribute\FormControl\HasFormenctype,
+ Html\Attribute\FormControl\HasFormmethod,
+ Html\Attribute\FormControl\HasFormnovalidate,
+ Html\Attribute\FormControl\HasFormtarget,
+ Html\Attribute\FormControl\HasName,
+ Html\Attribute\Global\HasClass,
+ Html\Attribute\Global\HasData,
+ Html\Attribute\Global\HasId,
+ Html\Attribute\Global\HasLang,
+ Html\Attribute\Global\HasStyle,
+ Html\Attribute\Global\HasTabindex,
+ Html\Attribute\Global\HasTitle,
+ Html\Attribute\HasAttributes,
+ Html\Attribute\HasContent,
+ Html\Attribute\HasPrefixCollection,
+ Html\Attribute\HasSuffixCollection,
+ Html\Attribute\HasTemplate,
+ Html\Helper\Utils,
+ Html\Helper\Validator,
+ Html\Tag,
+ Widget\Element
};
-use PHPForge\Widget\Element;
/**
* The `
HTML,
- Button::widget()->id('button-658716145f1d9')->render()
+ Button::widget()->id('button-658716145f1d9')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- value
HTML,
- Button::widget()->id('button-658716145f1d9')->suffix('value')->render()
+ Button::widget()->id('button-658716145f1d9')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
value
-
HTML,
- Button::widget()->id('button-658716145f1d9')->suffix('value')->suffixContainer(true)->render()
+ Button::widget()->id('button-658716145f1d9')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<id('button-658716145f1d9')
->suffix('value')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<id('button-658716145f1d9')
->suffix('value')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
value
HTML,
- Button::widget()
- ->id('button-658716145f1d9')
- ->suffix('value')
- ->suffixContainer(true)
- ->suffixContainerTag('span')
- ->render()
+ Button::widget()->id('button-658716145f1d9')->suffix('value')->suffixTag('span')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Button::widget()->id('button-658716145f1d9')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Button/AttributeTest.php b/tests/FormControl/Input/Button/AttributeTest.php
index 20de3240..54a41e9b 100644
--- a/tests/FormControl/Input/Button/AttributeTest.php
+++ b/tests/FormControl/Input/Button/AttributeTest.php
@@ -108,6 +108,66 @@ public function testForm(): void
);
}
+ public function testFormaction(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Button::widget()->formaction('value')->id('button-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormenctype(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Button::widget()->formenctype('text/plain')->id('button-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormmethod(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Button::widget()->formmethod('GET')->id('button-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormnovalidate(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Button::widget()->formnovalidate()->id('button-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormtarget(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Button::widget()->formtarget('_blank')->id('button-6582f2d099e8b')->render()
+ );
+ }
+
public function testGenerateAriaDescribeBy(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/FormControl/Input/Button/CustomMethodTest.php b/tests/FormControl/Input/Button/CustomMethodTest.php
index 2d5912da..6cf1a86c 100644
--- a/tests/FormControl/Input/Button/CustomMethodTest.php
+++ b/tests/FormControl/Input/Button/CustomMethodTest.php
@@ -71,162 +71,168 @@ public function testPrefix(): void
Assert::equalsWithoutLE(
<<
- Prefix
+ value
HTML,
- Button::widget()->id('button-6582f2d099e8b')->prefix('Prefix')->render()
+ Button::widget()->id('button-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- Prefix
+
+ value
HTML,
- Button::widget()->id('button-6582f2d099e8b')->prefix('Prefix')->prefixContainer(true)->render()
+ Button::widget()
+ ->id('button-6582f2d099e8b')
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
+ ->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- Prefix
+ value
HTML,
Button::widget()
->id('button-6582f2d099e8b')
- ->prefix('Prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- Prefix
+ value
HTML,
- Button::widget()
- ->id('button-6582f2d099e8b')
- ->prefix('Prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('span')
- ->render()
+ Button::widget()->id('button-6582f2d099e8b')->prefix('value')->prefixTag('span')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
+ value
HTML,
- Button::widget()->id('button-6582f2d099e8b')->render()
+ Button::widget()->id('button-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- Suffix
HTML,
- Button::widget()->id('button-6582f2d099e8b')->suffix('Suffix')->render()
+ Button::widget()->id('button-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- Suffix
-
+ value
HTML,
- Button::widget()->id('button-6582f2d099e8b')->suffix('Suffix')->suffixContainer(true)->render()
+ Button::widget()->id('button-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- Suffix
+ value
HTML,
Button::widget()
->id('button-6582f2d099e8b')
- ->suffix('Suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- Suffix
+ value
HTML,
Button::widget()
->id('button-6582f2d099e8b')
- ->suffix('Suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- Suffix
+ value
HTML,
- Button::widget()
- ->id('button-6582f2d099e8b')
- ->suffix('Suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('span')
- ->render()
+ Button::widget()->id('button-6582f2d099e8b')->suffix('value')->suffixTag('span')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+ value
+
+ HTML,
+ Button::widget()->id('button-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Button/ExceptionTest.php b/tests/FormControl/Input/Button/ExceptionTest.php
index c3c2f279..9af7f6cf 100644
--- a/tests/FormControl/Input/Button/ExceptionTest.php
+++ b/tests/FormControl/Input/Button/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Button::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Button::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Button/LabelTest.php b/tests/FormControl/Input/Button/LabelTest.php
index 5ccbbb34..eacc8ff7 100644
--- a/tests/FormControl/Input/Button/LabelTest.php
+++ b/tests/FormControl/Input/Button/LabelTest.php
@@ -12,37 +12,32 @@
*/
final class LabelTest extends TestCase
{
- public function testLabel(): void
+ public function testDisableLabel(): void
{
Assert::equalsWithoutLE(
<<
-
HTML,
- Button::widget()->id('button-6582f2d099e8b')->label('Label')->render()
+ Button::widget()->id('button-6582f2d099e8b')->disableLabel()->label('Label')->render()
);
}
- public function testLabelAttributes(): void
+ public function testLabel(): void
{
Assert::equalsWithoutLE(
<<
-
+
HTML,
- Button::widget()
- ->id('button-6582f2d099e8b')
- ->label('Label')
- ->labelAttributes(['class' => 'value'])
- ->render()
+ Button::widget()->id('button-6582f2d099e8b')->label('Label')->render()
);
}
- public function testLabelClass(): void
+ public function testLabelAttributes(): void
{
Assert::equalsWithoutLE(
<<id('button-6582f2d099e8b')
->label('Label')
- ->labelClass('value')
+ ->labelAttributes(['class' => 'value'])
->render()
);
}
- public function testLabelFor(): void
+ public function testLabelClass(): void
{
Assert::equalsWithoutLE(
<<
-
+
HTML,
- Button::widget()
- ->id('button-6582f2d099e8b')
- ->label('Label')
- ->LabelFor('label-for')
- ->render()
+ Button::widget()->id('button-6582f2d099e8b')->label('Label')->labelClass('value')->render()
);
}
- public function testNotLabel(): void
+ public function testLabelFor(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Button::widget()->id('button-6582f2d099e8b')->label('Label')->notLabel()->render()
+ Button::widget()->id('button-6582f2d099e8b')->label('Label')->LabelFor('value')->render()
);
}
}
diff --git a/tests/FormControl/Input/Checkbox/AttributeTest.php b/tests/FormControl/Input/Checkbox/AttributeTest.php
index bc2ff1a3..48ec08a9 100644
--- a/tests/FormControl/Input/Checkbox/AttributeTest.php
+++ b/tests/FormControl/Input/Checkbox/AttributeTest.php
@@ -317,9 +317,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Checkbox::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Checkbox::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -327,9 +327,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Checkbox::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Checkbox::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Checkbox/CustomMethodTest.php b/tests/FormControl/Input/Checkbox/CustomMethodTest.php
index 9384cff1..bdcf0e7c 100644
--- a/tests/FormControl/Input/Checkbox/CustomMethodTest.php
+++ b/tests/FormControl/Input/Checkbox/CustomMethodTest.php
@@ -82,13 +82,13 @@ public function testContainerWithFalseWithDefinitions(): void
);
}
- public function testGenerateFieldId(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Checkbox::widget()->generateField('ModelName', 'fieldName')->render()
+ Checkbox::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -96,75 +96,68 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Checkbox::widget()->id('checkbox-6582f2d099e8b')->prefix('prefix')->render()
+ Checkbox::widget()->id('checkbox-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+
+ value
HTML,
- Checkbox::widget()->id('checkbox-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
+ Checkbox::widget()
+ ->id('checkbox-6582f2d099e8b')
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
+ ->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Checkbox::widget()
->id('checkbox-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
-
+ value
HTML,
- Checkbox::widget()
- ->id('checkbox-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ Checkbox::widget()->id('checkbox-6582f2d099e8b')->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<prefix
+ value
HTML,
- Checkbox::widget()
- ->id('checkbox-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('span')
- ->render()
+ Checkbox::widget()->id('checkbox-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
@@ -183,74 +176,67 @@ public function testSuffix(): void
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Checkbox::widget()->id('checkbox-6582f2d099e8b')->suffix('suffix')->render()
+ Checkbox::widget()->id('checkbox-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
+
+ value
HTML,
- Checkbox::widget()->id('checkbox-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Checkbox::widget()
+ ->id('checkbox-6582f2d099e8b')
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
+ ->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Checkbox::widget()
->id('checkbox-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Checkbox::widget()
- ->id('checkbox-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Checkbox::widget()->id('checkbox-6582f2d099e8b')->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Checkbox::widget()
- ->id('checkbox-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('span')
- ->render()
+ Checkbox::widget()->id('checkbox-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Checkbox/ExceptionTest.php b/tests/FormControl/Input/Checkbox/ExceptionTest.php
index caac6ce6..3743212c 100644
--- a/tests/FormControl/Input/Checkbox/ExceptionTest.php
+++ b/tests/FormControl/Input/Checkbox/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Checkbox::class widget must be a scalar value.');
+ $this->expectExceptionMessage('The value must be a scalar or null value. The value is: array.');
Checkbox::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Checkbox/LabelTest.php b/tests/FormControl/Input/Checkbox/LabelTest.php
index db1d3f55..f152d016 100644
--- a/tests/FormControl/Input/Checkbox/LabelTest.php
+++ b/tests/FormControl/Input/Checkbox/LabelTest.php
@@ -12,6 +12,16 @@
*/
final class LabelTest extends TestCase
{
+ public function testDisableLabel(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Checkbox::widget()->disableLabel()->id('checkbox-6582f2d099e8b')->label('Red')->render()
+ );
+ }
+
public function testEnclosedByLabel(): void
{
Assert::equalsWithoutLE(
@@ -100,14 +110,4 @@ public function testLabelFor(): void
Checkbox::widget()->id('checkbox-6582f2d099e8b')->label('Red')->labelFor('value')->render()
);
}
-
- public function testNotLabel(): void
- {
- Assert::equalsWithoutLE(
- <<
- HTML,
- Checkbox::widget()->id('checkbox-6582f2d099e8b')->label('Red')->notLabel()->render()
- );
- }
}
diff --git a/tests/FormControl/Input/CheckboxList/AttributeTest.php b/tests/FormControl/Input/CheckboxList/AttributeTest.php
deleted file mode 100644
index 93aa0907..00000000
--- a/tests/FormControl/Input/CheckboxList/AttributeTest.php
+++ /dev/null
@@ -1,505 +0,0 @@
-
-
-
-
-
-
-
-
- HTML,
- CheckboxList::widget()
- ->id('checkboxlist-65858c272ea89')
- ->items(
- Checkbox::widget()->id('checkbox-6599b6a33dd96')->label('Apple')->value(1),
- Checkbox::widget()->id('checkbox-6599b6a33dd98')->label('Banana')->value(2),
- Checkbox::widget()->id('checkbox-6599b6a33dd97')->label('Orange')->value(3),
- )
- ->label('Select your fruits?')
- ->labelItemClass('value')
- ->name('CheckboxForm[text]')
- ->render(),
- );
- }
-
- public function testNotLabel(): void
- {
- Assert::equalsWithoutLE(
- <<
-
-
-
-
-
-
-
- HTML,
- CheckboxList::widget()
- ->id('checkboxlist-65858c272ea89')
- ->items(
- Checkbox::widget()->id('checkbox-6599b6a33dd96')->label('Apple')->value(1),
- Checkbox::widget()->id('checkbox-6599b6a33dd98')->label('Banana')->value(2),
- Checkbox::widget()->id('checkbox-6599b6a33dd97')->label('Orange')->value(3),
- )
- ->label('Select your gender?')
- ->name('CheckboxForm[text]')
- ->notLabel()
- ->render(),
- );
- }
-}
diff --git a/tests/FormControl/Input/CheckboxList/ValidateTest.php b/tests/FormControl/Input/CheckboxList/ValidateTest.php
deleted file mode 100644
index 6515a42e..00000000
--- a/tests/FormControl/Input/CheckboxList/ValidateTest.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
- HTML,
- CheckboxList::widget()
- ->required()
- ->id('checkboxlist-65858c272ea89')
- ->items(
- Checkbox::widget()->id('checkbox-6599b6a33dd96')->required()->label('Apple')->value(1),
- Checkbox::widget()->id('checkbox-6599b6a33dd98')->required()->label('Banana')->value(2),
- Checkbox::widget()->id('checkbox-6599b6a33dd97')->required()->label('Orange')->value(3),
- )
- ->name('CheckboxForm[text]')
- ->render(),
- );
- }
-}
diff --git a/tests/FormControl/Input/Color/AttributeTest.php b/tests/FormControl/Input/Color/AttributeTest.php
index 09a6daf5..8cd04828 100644
--- a/tests/FormControl/Input/Color/AttributeTest.php
+++ b/tests/FormControl/Input/Color/AttributeTest.php
@@ -42,6 +42,16 @@ public function testAttributes(): void
);
}
+ public function testAutocomplete(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Color::widget()->autocomplete('on')->id('color-6582f2d099e8b')->render()
+ );
+ }
+
public function testAutofocus(): void
{
Assert::equalsWithoutLE(
@@ -226,9 +236,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Color::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Color::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -236,9 +246,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Color::widget()->generateField('ModelName', 'fieldName')->id('color-6582f2d099e8b')->name(null)->render()
+ Color::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Color/CustomMethodTest.php b/tests/FormControl/Input/Color/CustomMethodTest.php
index 56d71201..db65d797 100644
--- a/tests/FormControl/Input/Color/CustomMethodTest.php
+++ b/tests/FormControl/Input/Color/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateFieldId(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Color::widget()->generateField('ModelName', 'fieldName')->render()
+ Color::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,128 +26,108 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Color::widget()->id('color-6582f2d099e8b')->prefix('prefix')->render()
+ Color::widget()->id('color-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Color::widget()->id('color-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Color::widget()
->id('color-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Color::widget()
->id('color-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Color::widget()
- ->id('color-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Color::widget()->id('color-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Color::widget()->id('color-6582f2d099e8b')->render()
+ Color::widget()->id('color-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Color::widget()->id('color-6582f2d099e8b')->suffix('suffix')->render()
+ Color::widget()->id('color-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Color::widget()->id('color-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Color::widget()->id('color-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
HTML,
Color::widget()
->id('color-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Color::widget()
- ->id('color-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Color::widget()->id('color-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Color::widget()->id('color-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Color/ExceptionTest.php b/tests/FormControl/Input/Color/ExceptionTest.php
index ee5e1b04..1a5c0245 100644
--- a/tests/FormControl/Input/Color/ExceptionTest.php
+++ b/tests/FormControl/Input/Color/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Color::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Color::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Date/AttributeTest.php b/tests/FormControl/Input/Date/AttributeTest.php
index 0f2ad3ee..c2b7530e 100644
--- a/tests/FormControl/Input/Date/AttributeTest.php
+++ b/tests/FormControl/Input/Date/AttributeTest.php
@@ -228,9 +228,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Date::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Date::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -238,9 +238,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Date::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Date::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Date/CustomMethodTest.php b/tests/FormControl/Input/Date/CustomMethodTest.php
index c48e089d..6ff50e4a 100644
--- a/tests/FormControl/Input/Date/CustomMethodTest.php
+++ b/tests/FormControl/Input/Date/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateFieldId(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Date::widget()->generateField('ModelName', 'fieldName')->render()
+ Date::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,165 +26,141 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Date::widget()->id('date-6582f2d099e8b')->prefix('prefix')->render()
+ Date::widget()->id('date-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Date::widget()->id('date-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Date::widget()
->id('date-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Date::widget()
- ->id('date-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ Date::widget()->id('date-6582f2d099e8b')->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Date::widget()
- ->id('date-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Date::widget()->id('date-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Date::widget()->id('date-6582f2d099e8b')->render()
+ Date::widget()->id('date-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Date::widget()->id('date-6582f2d099e8b')->suffix('suffix')->render()
+ Date::widget()->id('date-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Date::widget()->id('date-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Date::widget()->id('date-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Date::widget()
->id('date-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Date::widget()
- ->id('date-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Date::widget()->id('date-6582f2d099e8b')->suffix('value')->suffixClass('value')->suffixTag('div')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Date::widget()
- ->id('date-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Date::widget()->id('date-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Date::widget()->id('date-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Date/ExceptionTest.php b/tests/FormControl/Input/Date/ExceptionTest.php
index 35c99b51..24e918bc 100644
--- a/tests/FormControl/Input/Date/ExceptionTest.php
+++ b/tests/FormControl/Input/Date/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Date::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Date::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Datetime/AttributeTest.php b/tests/FormControl/Input/Datetime/AttributeTest.php
index fa9fd030..551fc86f 100644
--- a/tests/FormControl/Input/Datetime/AttributeTest.php
+++ b/tests/FormControl/Input/Datetime/AttributeTest.php
@@ -226,9 +226,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Datetime::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Datetime::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -236,9 +236,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Datetime::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Datetime::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Datetime/CustomMethodTest.php b/tests/FormControl/Input/Datetime/CustomMethodTest.php
index 6a054fe3..544e7ce3 100644
--- a/tests/FormControl/Input/Datetime/CustomMethodTest.php
+++ b/tests/FormControl/Input/Datetime/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateFieldId(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- DateTime::widget()->generateField('ModelName', 'fieldName')->render()
+ DateTime::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,165 +26,151 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Datetime::widget()->id('datetime-6582f2d099e8b')->prefix('prefix')->render()
+ Datetime::widget()->id('datetime-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Datetime::widget()->id('datetime-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Datetime::widget()
->id('datetime-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Datetime::widget()
->id('datetime-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Datetime::widget()
- ->id('datetime-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Datetime::widget()->id('datetime-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Datetime::widget()->id('datetime-6582f2d099e8b')->render()
+ Datetime::widget()->id('datetime-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Datetime::widget()->id('datetime-6582f2d099e8b')->suffix('suffix')->render()
+ Datetime::widget()->id('datetime-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Datetime::widget()->id('datetime-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Datetime::widget()->id('datetime-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Datetime::widget()
->id('datetime-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Datetime::widget()
->id('datetime-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Datetime::widget()
- ->id('datetime-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Datetime::widget()->id('datetime-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Datetime::widget()->id('datetime-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Datetime/ExceptionTest.php b/tests/FormControl/Input/Datetime/ExceptionTest.php
index 2df1e59f..3f84bf9f 100644
--- a/tests/FormControl/Input/Datetime/ExceptionTest.php
+++ b/tests/FormControl/Input/Datetime/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Datetime::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Datetime::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/DatetimeLocal/AttributeTest.php b/tests/FormControl/Input/DatetimeLocal/AttributeTest.php
index aae2cb9f..22d9cae6 100644
--- a/tests/FormControl/Input/DatetimeLocal/AttributeTest.php
+++ b/tests/FormControl/Input/DatetimeLocal/AttributeTest.php
@@ -226,9 +226,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- DatetimeLocal::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ DatetimeLocal::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -236,9 +236,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- DatetimeLocal::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ DatetimeLocal::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/DatetimeLocal/CustomMethodTest.php b/tests/FormControl/Input/DatetimeLocal/CustomMethodTest.php
index 78ea0e03..f6f5020b 100644
--- a/tests/FormControl/Input/DatetimeLocal/CustomMethodTest.php
+++ b/tests/FormControl/Input/DatetimeLocal/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- DateTimeLocal::widget()->generateField('ModelName', 'fieldName')->render()
+ DateTimeLocal::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,83 +26,70 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- DatetimeLocal::widget()->id('datetime-local-6582f2d099e8b')->prefix('prefix')->render()
+ DatetimeLocal::widget()->id('datetime-local-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+
+ value
HTML,
DatetimeLocal::widget()
->id('datetime-local-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
DatetimeLocal::widget()
->id('datetime-local-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes([
- 'class' => 'value',
- ])
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
-
+
+ value
+
HTML,
- DatetimeLocal::widget()
- ->id('datetime-local-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ DatetimeLocal::widget()->id('datetime-local-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- prefix
-
+ value
HTML,
- DatetimeLocal::widget()
- ->id('datetime-local-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ DatetimeLocal::widget()->id('datetime-local-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
@@ -121,82 +108,69 @@ public function testSuffix(): void
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- DatetimeLocal::widget()->id('datetime-local-6582f2d099e8b')->suffix('suffix')->render()
+ DatetimeLocal::widget()->id('datetime-local-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
+
+ value
HTML,
DatetimeLocal::widget()
->id('datetime-local-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
DatetimeLocal::widget()
->id('datetime-local-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes([
- 'class' => 'value',
- ])
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+
+ value
+
HTML,
- DatetimeLocal::widget()
- ->id('datetime-local-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ DatetimeLocal::widget()->id('datetime-local-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- DatetimeLocal::widget()
- ->id('datetime-local-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ DatetimeLocal::widget()->id('datetime-local-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/DatetimeLocal/ExceptionTest.php b/tests/FormControl/Input/DatetimeLocal/ExceptionTest.php
index 207dd3c8..221da6f6 100644
--- a/tests/FormControl/Input/DatetimeLocal/ExceptionTest.php
+++ b/tests/FormControl/Input/DatetimeLocal/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('DatetimeLocal::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
DatetimeLocal::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Email/AttributeTest.php b/tests/FormControl/Input/Email/AttributeTest.php
index d93e5c7b..95b9d38d 100644
--- a/tests/FormControl/Input/Email/AttributeTest.php
+++ b/tests/FormControl/Input/Email/AttributeTest.php
@@ -42,6 +42,16 @@ public function testAttributes(): void
);
}
+ public function testAutocomplete(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Email::widget()->autoComplete('on')->id('email-65a15e0439570')->render()
+ );
+ }
+
public function testAutofocus(): void
{
Assert::equalsWithoutLE(
@@ -72,6 +82,16 @@ public function testDataAttributes(): void
);
}
+ public function testDirname(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Email::widget()->dirName('value')->id('email-65a15e0439570')->render()
+ );
+ }
+
public function testDisabled(): void
{
Assert::equalsWithoutLE(
@@ -256,9 +276,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Email::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Email::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -266,9 +286,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Email::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Email::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Email/CustomMethodTest.php b/tests/FormControl/Input/Email/CustomMethodTest.php
index b3d41552..a0f9527f 100644
--- a/tests/FormControl/Input/Email/CustomMethodTest.php
+++ b/tests/FormControl/Input/Email/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Email::widget()->generateField('ModelName', 'fieldName')->render()
+ Email::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,75 +26,68 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Email::widget()->id('email-65a15e0439570')->prefix('prefix')->render()
+ Email::widget()->id('email-65a15e0439570')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+
+ value
HTML,
- Email::widget()->id('email-65a15e0439570')->prefix('prefix')->prefixContainer(true)->render()
+ Email::widget()
+ ->id('email-65a15e0439570')
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
+ ->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Email::widget()
->id('email-65a15e0439570')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
-
+ value
HTML,
- Email::widget()
- ->id('email-65a15e0439570')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ Email::widget()->id('email-65a15e0439570')->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<prefix
+ value
HTML,
- Email::widget()
- ->id('email-65a15e0439570')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('span')
- ->render()
+ Email::widget()->id('email-65a15e0439570')->prefix('value')->prefixTag(false)->render()
);
}
@@ -113,74 +106,67 @@ public function testSuffix(): void
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Email::widget()->id('email-65a15e0439570')->suffix('suffix')->render()
+ Email::widget()->id('email-65a15e0439570')->suffix('value')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
+
+ value
HTML,
- Email::widget()->id('email-65a15e0439570')->suffix('suffix')->suffixContainer(true)->render()
+ Email::widget()
+ ->id('email-65a15e0439570')
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
+ ->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Email::widget()
->id('email-65a15e0439570')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Email::widget()
- ->id('email-65a15e0439570')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Email::widget()->id('email-65a15e0439570')->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Email::widget()
- ->id('email-65a15e0439570')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('span')
- ->render()
+ Email::widget()->id('email-65a15e0439570')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Email/ExceptionTest.php b/tests/FormControl/Input/Email/ExceptionTest.php
index b6c25e8b..b4f61b22 100644
--- a/tests/FormControl/Input/Email/ExceptionTest.php
+++ b/tests/FormControl/Input/Email/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Email::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: integer.');
Email::widget()->value(1)->render();
}
diff --git a/tests/FormControl/Input/File/AttributeTest.php b/tests/FormControl/Input/File/AttributeTest.php
index 5537782c..e27515de 100644
--- a/tests/FormControl/Input/File/AttributeTest.php
+++ b/tests/FormControl/Input/File/AttributeTest.php
@@ -201,9 +201,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- File::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ File::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -211,9 +211,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- File::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ File::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/File/CustomMethodTest.php b/tests/FormControl/Input/File/CustomMethodTest.php
index 0dc889d8..0f032823 100644
--- a/tests/FormControl/Input/File/CustomMethodTest.php
+++ b/tests/FormControl/Input/File/CustomMethodTest.php
@@ -12,23 +12,23 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- File::widget()->generateField('ModelName', 'fieldName')->render()
+ File::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
- public function testGenerateFieldWithMultiple(): void
+ public function testFieldAttributesWithMultiple(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- File::widget()->generateField('ModelName', 'fieldName')->multiple()->render()
+ File::widget()->fieldAttributes('FormModelName', 'property')->multiple()->render()
);
}
@@ -36,75 +36,63 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- File::widget()->id('file-65a15e0439570')->prefix('prefix')->render()
+ File::widget()->id('file-65a15e0439570')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+
+ value
HTML,
- File::widget()->id('file-65a15e0439570')->prefix('prefix')->prefixContainer(true)->render()
+ File::widget()
+ ->id('file-65a15e0439570')
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
+ ->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- File::widget()
- ->id('file-65a15e0439570')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
- ->render()
+ File::widget()->id('file-65a15e0439570')->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
-
+ value
HTML,
- File::widget()
- ->id('file-65a15e0439570')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ File::widget()->id('file-65a15e0439570')->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<prefix
+ value
HTML,
- File::widget()
- ->id('file-65a15e0439570')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('span')
- ->render()
+ File::widget()->id('file-65a15e0439570')->prefix('value')->prefixTag(false)->render()
);
}
@@ -123,74 +111,62 @@ public function testSuffix(): void
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- File::widget()->id('file-65a15e0439570')->suffix('suffix')->render()
+ File::widget()->id('file-65a15e0439570')->suffix('value')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
+
+ value
HTML,
- File::widget()->id('file-65a15e0439570')->suffix('suffix')->suffixContainer(true)->render()
+ File::widget()
+ ->id('file-65a15e0439570')
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
+ ->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- File::widget()
- ->id('file-65a15e0439570')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
- ->render()
+ File::widget()->id('file-65a15e0439570')->suffix('value')->suffixClass('value')->suffixTag('div')->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- File::widget()
- ->id('file-65a15e0439570')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ File::widget()->id('file-65a15e0439570')->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- File::widget()
- ->id('file-65a15e0439570')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('span')
- ->render()
+ File::widget()->id('file-65a15e0439570')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Hidden/ExceptionTest.php b/tests/FormControl/Input/Hidden/ExceptionTest.php
index 7444c7ef..2919fcc4 100644
--- a/tests/FormControl/Input/Hidden/ExceptionTest.php
+++ b/tests/FormControl/Input/Hidden/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Hidden::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Hidden::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Image/AttributeTest.php b/tests/FormControl/Input/Image/AttributeTest.php
index 9e20b11e..a3999bbc 100644
--- a/tests/FormControl/Input/Image/AttributeTest.php
+++ b/tests/FormControl/Input/Image/AttributeTest.php
@@ -276,9 +276,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Image::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Image::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -286,9 +286,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Image::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Image::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Image/CustomMethodTest.php b/tests/FormControl/Input/Image/CustomMethodTest.php
index fefb097c..c6c4cab9 100644
--- a/tests/FormControl/Input/Image/CustomMethodTest.php
+++ b/tests/FormControl/Input/Image/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Image::widget()->generateField('ModelName', 'fieldName')->render()
+ Image::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,72 +26,68 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Image::widget()->id('image-65a15e0439570')->prefix('prefix')->render()
+ Image::widget()->id('image-65a15e0439570')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+
+ value
HTML,
- Image::widget()->id('image-65a15e0439570')->prefix('prefix')->prefixContainer(true)->render()
+ Image::widget()
+ ->id('image-65a15e0439570')
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
+ ->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Image::widget()->id('image-65a15e0439570')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ Image::widget()
+ ->id('image-65a15e0439570')
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
-
+ value
HTML,
- Image::widget()->id('image-65a15e0439570')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ Image::widget()->id('image-65a15e0439570')->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<prefix
+ value
HTML,
- Image::widget()->id('image-65a15e0439570')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('span')
- ->render()
+ Image::widget()->id('image-65a15e0439570')->prefix('value')->prefixTag(false)->render()
);
}
@@ -110,71 +106,67 @@ public function testSuffix(): void
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Image::widget()->id('image-65a15e0439570')->suffix('suffix')->render()
+ Image::widget()->id('image-65a15e0439570')->suffix('value')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
+
+ value
HTML,
- Image::widget()->id('image-65a15e0439570')->suffix('suffix')->suffixContainer(true)->render()
+ Image::widget()
+ ->id('image-65a15e0439570')
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
+ ->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Image::widget()->id('image-65a15e0439570')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ Image::widget()
+ ->id('image-65a15e0439570')
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Image::widget()->id('image-65a15e0439570')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Image::widget()->id('image-65a15e0439570')->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalsevalue(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Image::widget()->id('image-65a15e0439570')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('span')
- ->render()
+ Image::widget()->id('image-65a15e0439570')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Month/AttributeTest.php b/tests/FormControl/Input/Month/AttributeTest.php
index 8af079b8..43c756f8 100644
--- a/tests/FormControl/Input/Month/AttributeTest.php
+++ b/tests/FormControl/Input/Month/AttributeTest.php
@@ -226,9 +226,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Month::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Month::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -236,9 +236,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Month::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Month::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Month/CustomMethodTest.php b/tests/FormControl/Input/Month/CustomMethodTest.php
index 9bf1c7a4..2d4e0b7a 100644
--- a/tests/FormControl/Input/Month/CustomMethodTest.php
+++ b/tests/FormControl/Input/Month/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Month::widget()->generateField('ModelName', 'fieldName')->render()
+ Month::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,165 +26,151 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Month::widget()->id('month-6582f2d099e8b')->prefix('prefix')->render()
+ Month::widget()->id('month-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Month::widget()->id('month-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Month::widget()
->id('month-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Month::widget()
->id('month-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Month::widget()
- ->id('month-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Month::widget()->id('month-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Month::widget()->id('month-6582f2d099e8b')->render()
+ Month::widget()->id('month-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Month::widget()->id('month-6582f2d099e8b')->suffix('suffix')->render()
+ Month::widget()->id('month-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Month::widget()->id('month-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Month::widget()->id('month-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Month::widget()
->id('month-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Month::widget()
->id('month-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Month::widget()
- ->id('month-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Month::widget()->id('month-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ suffix
+ HTML,
+ Month::widget()->id('month-6582f2d099e8b')->suffix('suffix')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Month/ExceptionTest.php b/tests/FormControl/Input/Month/ExceptionTest.php
index e5fc970e..db1f8421 100644
--- a/tests/FormControl/Input/Month/ExceptionTest.php
+++ b/tests/FormControl/Input/Month/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Month::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Month::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Number/AttributeTest.php b/tests/FormControl/Input/Number/AttributeTest.php
index b6eb82c9..71c801ba 100644
--- a/tests/FormControl/Input/Number/AttributeTest.php
+++ b/tests/FormControl/Input/Number/AttributeTest.php
@@ -236,9 +236,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Number::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Number::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -246,9 +246,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Number::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Number::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Number/CustomMethodTest.php b/tests/FormControl/Input/Number/CustomMethodTest.php
index c1be2ae9..cb84ea4c 100644
--- a/tests/FormControl/Input/Number/CustomMethodTest.php
+++ b/tests/FormControl/Input/Number/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Number::widget()->generateField('ModelName', 'fieldName')->render()
+ Number::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,165 +26,151 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Number::widget()->id('number-6582f2d099e8b')->prefix('prefix')->render()
+ Number::widget()->id('number-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Number::widget()->id('number-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Number::widget()
->id('number-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Number::widget()
->id('number-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Number::widget()
- ->id('number-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Number::widget()->id('number-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Number::widget()->id('number-6582f2d099e8b')->render()
+ Number::widget()->id('number-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Number::widget()->id('number-6582f2d099e8b')->suffix('suffix')->render()
+ Number::widget()->id('number-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Number::widget()->id('number-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Number::widget()->id('number-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Number::widget()
->id('number-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Number::widget()
->id('number-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Number::widget()
- ->id('number-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Number::widget()->id('number-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Number::widget()->id('number-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Number/ExceptionTest.php b/tests/FormControl/Input/Number/ExceptionTest.php
index 8776a18f..96f81468 100644
--- a/tests/FormControl/Input/Number/ExceptionTest.php
+++ b/tests/FormControl/Input/Number/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Number::class widget must be a numeric or null value.');
+ $this->expectExceptionMessage('The value must be a numeric or null value. The value is: array.');
Number::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Password/AttributeTest.php b/tests/FormControl/Input/Password/AttributeTest.php
index 435e0b96..dab387ce 100644
--- a/tests/FormControl/Input/Password/AttributeTest.php
+++ b/tests/FormControl/Input/Password/AttributeTest.php
@@ -42,6 +42,16 @@ public function testAttributes(): void
);
}
+ public function testAutoComplete(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Password::widget()->autoComplete('on')->id('password-6582f2d099e8b')->render()
+ );
+ }
+
public function testAutofocus(): void
{
Assert::equalsWithoutLE(
@@ -72,6 +82,16 @@ public function testDataAttributes(): void
);
}
+ public function testDirname(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Password::widget()->dirname('value')->id('password-6582f2d099e8b')->render()
+ );
+ }
+
public function testDisabled(): void
{
Assert::equalsWithoutLE(
@@ -246,9 +266,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Password::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Password::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -256,9 +276,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Password::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Password::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Password/CustomMethodTest.php b/tests/FormControl/Input/Password/CustomMethodTest.php
index cef9beb9..19a869af 100644
--- a/tests/FormControl/Input/Password/CustomMethodTest.php
+++ b/tests/FormControl/Input/Password/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Password::widget()->generateField('ModelName', 'fieldName')->render()
+ Password::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,165 +26,151 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Password::widget()->id('password-6582f2d099e8b')->prefix('prefix')->render()
+ Password::widget()->id('password-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Password::widget()->id('password-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Password::widget()
->id('password-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Password::widget()
->id('password-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Password::widget()
- ->id('password-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Password::widget()->id('password-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Password::widget()->id('password-6582f2d099e8b')->render()
+ Password::widget()->id('password-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Password::widget()->id('password-6582f2d099e8b')->suffix('suffix')->render()
+ Password::widget()->id('password-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Password::widget()->id('password-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Password::widget()->id('password-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Password::widget()
->id('password-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Password::widget()
->id('password-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Password::widget()
- ->id('password-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Password::widget()->id('password-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Password::widget()->id('password-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Password/ExceptionTest.php b/tests/FormControl/Input/Password/ExceptionTest.php
index c4f602a3..eb62b725 100644
--- a/tests/FormControl/Input/Password/ExceptionTest.php
+++ b/tests/FormControl/Input/Password/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Password::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Password::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Radio/AttributeTest.php b/tests/FormControl/Input/Radio/AttributeTest.php
index b997d70b..3e40c3f6 100644
--- a/tests/FormControl/Input/Radio/AttributeTest.php
+++ b/tests/FormControl/Input/Radio/AttributeTest.php
@@ -314,9 +314,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Radio::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Radio::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -324,9 +324,9 @@ public function testWihoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Radio::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Radio::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Radio/CustomMethodTest.php b/tests/FormControl/Input/Radio/CustomMethodTest.php
index ead1f05d..01a643cd 100644
--- a/tests/FormControl/Input/Radio/CustomMethodTest.php
+++ b/tests/FormControl/Input/Radio/CustomMethodTest.php
@@ -79,13 +79,13 @@ public function testContainerWithFalseWithDefinitions(): void
);
}
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Radio::widget()->generateField('ModelName', 'fieldName')->render()
+ Radio::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -93,75 +93,68 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Radio::widget()->id('radio-6582f2d099e8b')->prefix('prefix')->render()
+ Radio::widget()->id('radio-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+
+ value
HTML,
- Radio::widget()->id('radio-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
+ Radio::widget()
+ ->id('radio-6582f2d099e8b')
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
+ ->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Radio::widget()
->id('radio-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
-
+ value
HTML,
- Radio::widget()
- ->id('radio-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ Radio::widget()->id('radio-6582f2d099e8b')->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<prefix
+ value
HTML,
- Radio::widget()
- ->id('radio-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('span')
- ->render()
+ Radio::widget()->id('radio-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
@@ -180,74 +173,67 @@ public function testSuffix(): void
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Radio::widget()->id('radio-6582f2d099e8b')->suffix('suffix')->render()
+ Radio::widget()->id('radio-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
+
+ value
HTML,
- Radio::widget()->id('radio-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Radio::widget()
+ ->id('radio-6582f2d099e8b')
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
+ ->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Radio::widget()
->id('radio-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Radio::widget()
- ->id('radio-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Radio::widget()->id('radio-6582f2d099e8b')->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Radio::widget()
- ->id('radio-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('span')
- ->render()
+ Radio::widget()->id('radio-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Radio/ExceptionTest.php b/tests/FormControl/Input/Radio/ExceptionTest.php
index b15024da..6b6e24cb 100644
--- a/tests/FormControl/Input/Radio/ExceptionTest.php
+++ b/tests/FormControl/Input/Radio/ExceptionTest.php
@@ -17,7 +17,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Radio::class widget must be a scalar value.');
+ $this->expectExceptionMessage('The value must be a scalar or null value. The value is: array.');
Radio::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Radio/LabelTest.php b/tests/FormControl/Input/Radio/LabelTest.php
index 7b6caed9..cc3b53e8 100644
--- a/tests/FormControl/Input/Radio/LabelTest.php
+++ b/tests/FormControl/Input/Radio/LabelTest.php
@@ -9,6 +9,16 @@
final class LabelTest extends TestCase
{
+ public function testDisableLabel(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Radio::widget()->disableLabel()->id('radio-6582f2d099e8b')->label('Red')->render()
+ );
+ }
+
public function testEnclosedByLabel(): void
{
Assert::equalsWithoutLE(
@@ -97,14 +107,4 @@ public function testLabelFor(): void
Radio::widget()->id('checkbox-6582f2d099e8b')->label('Red')->labelFor('label-for')->render()
);
}
-
- public function testNotLabel(): void
- {
- Assert::equalsWithoutLE(
- <<
- HTML,
- Radio::widget()->id('radio-6582f2d099e8b')->label('Red')->notLabel()->render()
- );
- }
}
diff --git a/tests/FormControl/Input/RadioList/AttributeTest.php b/tests/FormControl/Input/RadioList/AttributeTest.php
deleted file mode 100644
index 1c979ccc..00000000
--- a/tests/FormControl/Input/RadioList/AttributeTest.php
+++ /dev/null
@@ -1,430 +0,0 @@
-
-
-
-
-
-
- HTML,
- RadioList::widget()
- ->id('radiolist-65858c272ea89')
- ->items(
- Radio::widget()->id('radio-6599b6a33dd96')->label('Female')->value(1),
- Radio::widget()->id('radio-6599b6a33dd97')->label('Male')->value(2),
- )
- ->label('Select your gender?')
- ->labelItemClass('value')
- ->name('CheckboxForm[text]')
- ->render(),
- );
- }
-
- public function testNotLabel(): void
- {
- Assert::equalsWithoutLE(
- <<
-
-
-
-
-
- HTML,
- RadioList::widget()
- ->id('radiolist-65858c272ea89')
- ->items(
- Radio::widget()->id('radio-6599b6a33dd96')->label('Female')->value(1),
- Radio::widget()->id('radio-6599b6a33dd97')->label('Male')->value(2),
- )
- ->label('Select your gender?')
- ->name('radioform[text]')
- ->notLabel()
- ->render(),
- );
- }
-}
diff --git a/tests/FormControl/Input/RadioList/ValidateTest.php b/tests/FormControl/Input/RadioList/ValidateTest.php
deleted file mode 100644
index 96281058..00000000
--- a/tests/FormControl/Input/RadioList/ValidateTest.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
- HTML,
- RadioList::widget()
- ->id('radiolist-65858c272ea89')
- ->items(
- Radio::widget()->id('radio-6599b6a33dd96')->label('Red')->value('red'),
- Radio::widget()->id('radio-6599b6a33dd97')->label('Blue')->value('blue'),
- )
- ->name('radioform[text]')
- ->required()
- ->render()
- );
- }
-}
diff --git a/tests/FormControl/Input/Range/AttributeTest.php b/tests/FormControl/Input/Range/AttributeTest.php
index ae0006c2..a6e9938f 100644
--- a/tests/FormControl/Input/Range/AttributeTest.php
+++ b/tests/FormControl/Input/Range/AttributeTest.php
@@ -42,6 +42,16 @@ public function testAttributes(): void
);
}
+ public function testAutocomplete(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Range::widget()->autocomplete('on')->id('range-6582f2d099e8b')->render()
+ );
+ }
+
public function testAutofocus(): void
{
Assert::equalsWithoutLE(
@@ -72,6 +82,16 @@ public function testDataAttributes(): void
);
}
+ public function testDirname(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Range::widget()->dirname('value')->id('range-6582f2d099e8b')->render()
+ );
+ }
+
public function testDisabled(): void
{
Assert::equalsWithoutLE(
@@ -226,9 +246,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Range::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Range::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -236,9 +256,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Range::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Range::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Range/CustomMethodTest.php b/tests/FormControl/Input/Range/CustomMethodTest.php
index 04ba1867..4f2a61bc 100644
--- a/tests/FormControl/Input/Range/CustomMethodTest.php
+++ b/tests/FormControl/Input/Range/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Range::widget()->generateField('ModelName', 'fieldName')->render()
+ Range::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,165 +26,151 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Range::widget()->id('range-6582f2d099e8b')->prefix('prefix')->render()
+ Range::widget()->id('range-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Range::widget()->id('range-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Range::widget()
->id('range-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Range::widget()
->id('range-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Range::widget()
- ->id('range-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Range::widget()->id('range-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Range::widget()->id('range-6582f2d099e8b')->render()
+ Range::widget()->id('range-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Range::widget()->id('range-6582f2d099e8b')->suffix('suffix')->render()
+ Range::widget()->id('range-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Range::widget()->id('range-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Range::widget()->id('range-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Range::widget()
->id('range-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Range::widget()
->id('range-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Range::widget()
- ->id('range-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Range::widget()->id('range-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Range::widget()->id('range-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Range/ExceptionTest.php b/tests/FormControl/Input/Range/ExceptionTest.php
index 4113be54..857507e0 100644
--- a/tests/FormControl/Input/Range/ExceptionTest.php
+++ b/tests/FormControl/Input/Range/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Range::class widget must be a numeric or null value.');
+ $this->expectExceptionMessage('The value must be a numeric or null value. The value is: array.');
Range::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Reset/AttributeTest.php b/tests/FormControl/Input/Reset/AttributeTest.php
index d1345268..8ac94bae 100644
--- a/tests/FormControl/Input/Reset/AttributeTest.php
+++ b/tests/FormControl/Input/Reset/AttributeTest.php
@@ -112,6 +112,66 @@ public function testForm(): void
);
}
+ public function testFormaction(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Reset::widget()->formaction('value')->id('reset-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormenctype(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Reset::widget()->formenctype('text/plain')->id('reset-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormmethod(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Reset::widget()->formmethod('GET')->id('reset-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormnovalidate(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Reset::widget()->formnovalidate()->id('reset-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormtarget(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Reset::widget()->formtarget('_blank')->id('reset-6582f2d099e8b')->render()
+ );
+ }
+
public function testGenerateAriaDescribeBy(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/FormControl/Input/Reset/CustomMethodTest.php b/tests/FormControl/Input/Reset/CustomMethodTest.php
index e28a9a8f..48c78a5d 100644
--- a/tests/FormControl/Input/Reset/CustomMethodTest.php
+++ b/tests/FormControl/Input/Reset/CustomMethodTest.php
@@ -75,166 +75,168 @@ public function testPrefix(): void
Assert::equalsWithoutLE(
<<
- Prefix
+ value
HTML,
- Reset::widget()->id('reset-6582f2d099e8b')->prefix('Prefix')->render()
+ Reset::widget()->id('reset-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- Prefix
+
+ value
HTML,
- Reset::widget()->id('reset-6582f2d099e8b')->prefix('Prefix')->prefixContainer(true)->render()
+ Reset::widget()
+ ->id('reset-6582f2d099e8b')
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
+ ->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- Prefix
+ value
HTML,
Reset::widget()
->id('reset-6582f2d099e8b')
- ->prefix('Prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes([
- 'class' => 'value',
- ])
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- Prefix
+ value
HTML,
- Reset::widget()
- ->id('reset-6582f2d099e8b')
- ->prefix('Prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('span')
- ->render()
+ Reset::widget()->id('reset-6582f2d099e8b')->prefix('value')->prefixTag('span')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
+ value
HTML,
- Reset::widget()->id('reset-6582f2d099e8b')->render()
+ Reset::widget()->id('reset-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- Suffix
HTML,
- Reset::widget()->id('reset-6582f2d099e8b')->suffix('Suffix')->render()
+ Reset::widget()->id('reset-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- Suffix
-
+ value
HTML,
- Reset::widget()->id('reset-6582f2d099e8b')->suffix('Suffix')->suffixContainer(true)->render()
+ Reset::widget()->id('reset-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- Suffix
+ value
HTML,
Reset::widget()
->id('reset-6582f2d099e8b')
- ->suffix('Suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes([
- 'class' => 'value',
- ])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- Suffix
+ value
HTML,
Reset::widget()
->id('reset-6582f2d099e8b')
- ->suffix('Suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- Suffix
+ value
HTML,
- Reset::widget()
- ->id('reset-6582f2d099e8b')
- ->suffix('Suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('span')
- ->render()
+ Reset::widget()->id('reset-6582f2d099e8b')->suffix('value')->suffixTag('span')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+ value
+
+ HTML,
+ Reset::widget()->id('reset-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Reset/ExceptionTest.php b/tests/FormControl/Input/Reset/ExceptionTest.php
index eaa9d119..08445f6a 100644
--- a/tests/FormControl/Input/Reset/ExceptionTest.php
+++ b/tests/FormControl/Input/Reset/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Reset::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Reset::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Reset/LabelTest.php b/tests/FormControl/Input/Reset/LabelTest.php
index de9c8a54..84f0ea93 100644
--- a/tests/FormControl/Input/Reset/LabelTest.php
+++ b/tests/FormControl/Input/Reset/LabelTest.php
@@ -12,6 +12,18 @@
*/
final class LabelTest extends TestCase
{
+ public function testDisableLabel(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Reset::widget()->disableLabel()->id('reset-6582f2d099e8b')->label('Label')->render()
+ );
+ }
+
public function testLabel(): void
{
Assert::equalsWithoutLE(
@@ -64,16 +76,4 @@ public function testLabelFor(): void
->id('reset-6582f2d099e8b')->label('Label')->LabelFor('label-for')->render()
);
}
-
- public function testNotLabel(): void
- {
- Assert::equalsWithoutLE(
- <<
-
-
- HTML,
- Reset::widget()->id('reset-6582f2d099e8b')->label('Label')->notLabel()->render()
- );
- }
}
diff --git a/tests/FormControl/Input/Search/AttributeTest.php b/tests/FormControl/Input/Search/AttributeTest.php
index 3b7d5fe4..bfc178d3 100644
--- a/tests/FormControl/Input/Search/AttributeTest.php
+++ b/tests/FormControl/Input/Search/AttributeTest.php
@@ -5,12 +5,11 @@
namespace PHPForge\Html\Tests\FormControl\Input\Search;
use PHPForge\{Html\FormControl\Input\Search, Support\Assert};
-use PHPUnit\Framework\TestCase;
/**
* @psalm-suppress PropertyNotSetInConstructor
*/
-final class AttributeTest extends TestCase
+final class AttributeTest extends \PHPUnit\Framework\TestCase
{
public function testAriaDescribedBy(): void
{
@@ -38,9 +37,17 @@ public function testAttributes(): void
<<
HTML,
- Search::widget()->attributes([
- 'class' => 'value',
- ])->id('search-6582f2d099e8b')->render()
+ Search::widget()->attributes(['class' => 'value'])->id('search-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testAutoComplete(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Search::widget()->autoComplete('on')->id('search-6582f2d099e8b')->render()
);
}
@@ -70,9 +77,7 @@ public function testDataAttributes(): void
<<
HTML,
- Search::widget()->dataAttributes([
- 'value' => 'value',
- ])->id('search-6582f2d099e8b')->render()
+ Search::widget()->dataAttributes(['value' => 'value'])->id('search-6582f2d099e8b')->render()
);
}
@@ -260,9 +265,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Search::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Search::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -270,9 +275,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Search::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Search::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Search/CustomMethodTest.php b/tests/FormControl/Input/Search/CustomMethodTest.php
index a5be85f7..2b2592e1 100644
--- a/tests/FormControl/Input/Search/CustomMethodTest.php
+++ b/tests/FormControl/Input/Search/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Search::widget()->generateField('ModelName', 'fieldName')->render()
+ Search::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,77 +26,59 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Search::widget()->id('search-6582f2d099e8b')->prefix('prefix')->render()
+ Search::widget()->id('search-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Search::widget()->id('search-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Search::widget()
->id('search-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Search::widget()
->id('search-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Search::widget()
- ->id('search-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Search::widget()->id('search-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
@@ -115,76 +97,69 @@ public function testSuffix(): void
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Search::widget()->id('search-6582f2d099e8b')->suffix('suffix')->render()
+ Search::widget()->id('search-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
+
+ value
HTML,
- Search::widget()->id('search-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Search::widget()
+ ->id('search-6582f2d099e8b')
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
+ ->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Search::widget()
->id('search-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+
+ value
+
HTML,
- Search::widget()
- ->id('search-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Search::widget()->id('search-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Search::widget()
- ->id('search-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Search::widget()->id('search-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Search/ExceptionTest.php b/tests/FormControl/Input/Search/ExceptionTest.php
index 5769ed85..94d575b7 100644
--- a/tests/FormControl/Input/Search/ExceptionTest.php
+++ b/tests/FormControl/Input/Search/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Search::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Search::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Submit/AttributeTest.php b/tests/FormControl/Input/Submit/AttributeTest.php
index 880bc3af..dd2eb130 100644
--- a/tests/FormControl/Input/Submit/AttributeTest.php
+++ b/tests/FormControl/Input/Submit/AttributeTest.php
@@ -112,6 +112,66 @@ public function testForm(): void
);
}
+ public function testFormaction(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Submit::widget()->formaction('value')->id('submit-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormenctype(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Submit::widget()->formenctype('text/plain')->id('submit-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormmethod(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Submit::widget()->formmethod('GET')->id('submit-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormnovalidate(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Submit::widget()->formnovalidate()->id('submit-6582f2d099e8b')->render()
+ );
+ }
+
+ public function testFormtarget(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Submit::widget()->formtarget('_blank')->id('submit-6582f2d099e8b')->render()
+ );
+ }
+
public function testGenerateAriaDescribeBy(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/FormControl/Input/Submit/CustomMethodTest.php b/tests/FormControl/Input/Submit/CustomMethodTest.php
index 03879030..ff160a25 100644
--- a/tests/FormControl/Input/Submit/CustomMethodTest.php
+++ b/tests/FormControl/Input/Submit/CustomMethodTest.php
@@ -75,66 +75,57 @@ public function testPrefix(): void
Assert::equalsWithoutLE(
<<
- Prefix
+ value
HTML,
- Submit::widget()->id('submit-6582f2d099e8b')->prefix('Prefix')->render()
+ Submit::widget()->id('submit-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- Prefix
+
+ value
HTML,
- Submit::widget()->id('submit-6582f2d099e8b')->prefix('Prefix')->prefixContainer(true)->render()
+ Submit::widget()
+ ->id('submit-6582f2d099e8b')
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
+ ->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- Prefix
-
+ value
HTML,
- Submit::widget()
- ->id('submit-6582f2d099e8b')
- ->prefix('Prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes([
- 'class' => 'value',
- ])
- ->render()
+ Submit::widget()->id('submit-6582f2d099e8b')->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- Prefix
+ value
HTML,
- Submit::widget()
- ->id('submit-6582f2d099e8b')
- ->prefix('Prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('span')
- ->render()
+ Submit::widget()->id('submit-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
@@ -156,85 +147,76 @@ public function testSuffix(): void
<<
- Suffix
+ value
HTML,
- Submit::widget()->id('submit-6582f2d099e8b')->suffix('Suffix')->render()
+ Submit::widget()->id('submit-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- Suffix
+
+ value
HTML,
- Submit::widget()->id('submit-6582f2d099e8b')->suffix('Suffix')->suffixContainer(true)->render()
+ Submit::widget()
+ ->id('submit-6582f2d099e8b')
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
+ ->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- Suffix
+ value
HTML,
Submit::widget()
->id('submit-6582f2d099e8b')
- ->suffix('Suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes([
- 'class' => 'value',
- ])
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- Suffix
-
+ value
HTML,
- Submit::widget()
- ->id('submit-6582f2d099e8b')
- ->suffix('Suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Submit::widget()->id('submit-6582f2d099e8b')->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- Suffix
+ value
HTML,
- Submit::widget()
- ->id('submit-6582f2d099e8b')
- ->suffix('Suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('span')
- ->render()
+ Submit::widget()->id('submit-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Submit/ExceptionTest.php b/tests/FormControl/Input/Submit/ExceptionTest.php
index b64161b8..c94d0db1 100644
--- a/tests/FormControl/Input/Submit/ExceptionTest.php
+++ b/tests/FormControl/Input/Submit/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Submit::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Submit::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Submit/LabelTest.php b/tests/FormControl/Input/Submit/LabelTest.php
index 59bb76a5..d8f44982 100644
--- a/tests/FormControl/Input/Submit/LabelTest.php
+++ b/tests/FormControl/Input/Submit/LabelTest.php
@@ -12,6 +12,18 @@
*/
final class LabelTest extends TestCase
{
+ public function testDisableLabel(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+ HTML,
+ Submit::widget()->disableLabel()->id('submit-6582f2d099e8b')->label('Label')->render()
+ );
+ }
+
public function testLabel(): void
{
Assert::equalsWithoutLE(
@@ -67,16 +79,4 @@ public function testLabelFor(): void
Submit::widget()->id('submit-6582f2d099e8b')->label('Label')->LabelFor('label-for')->render()
);
}
-
- public function testNotLabel(): void
- {
- Assert::equalsWithoutLE(
- <<
-
-
- HTML,
- Submit::widget()->id('submit-6582f2d099e8b')->label('Label')->notLabel()->render()
- );
- }
}
diff --git a/tests/FormControl/Input/Text/AttributeTest.php b/tests/FormControl/Input/Text/AttributeTest.php
index ee8ba1dd..a07688f5 100644
--- a/tests/FormControl/Input/Text/AttributeTest.php
+++ b/tests/FormControl/Input/Text/AttributeTest.php
@@ -5,12 +5,11 @@
namespace PHPForge\Html\Tests\FormControl\Input\Text;
use PHPForge\{Html\FormControl\Input\Text, Support\Assert};
-use PHPUnit\Framework\TestCase;
/**
* @psalm-suppress PropertyNotSetInConstructor
*/
-final class AttributeTest extends TestCase
+final class AttributeTest extends \PHPUnit\Framework\TestCase
{
public function testAriaDescribedBy(): void
{
@@ -44,6 +43,16 @@ public function testAttributes(): void
);
}
+ public function testAutocomplete(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Text::widget()->autocomplete('on')->id('text-6582f2d099e8b')->render()
+ );
+ }
+
public function testAutofocus(): void
{
Assert::equalsWithoutLE(
@@ -260,9 +269,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Text::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Text::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -270,9 +279,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Text::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Text::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Text/CustomMethodTest.php b/tests/FormControl/Input/Text/CustomMethodTest.php
index 06a839ee..95350ebc 100644
--- a/tests/FormControl/Input/Text/CustomMethodTest.php
+++ b/tests/FormControl/Input/Text/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Text::widget()->generateField('ModelName', 'fieldName')->render()
+ Text::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,165 +26,141 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Text::widget()->id('text-6582f2d099e8b')->prefix('prefix')->render()
+ Text::widget()->id('text-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Text::widget()->id('text-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Text::widget()
->id('text-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Text::widget()
- ->id('text-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ Text::widget()->id('text-6582f2d099e8b')->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Text::widget()
- ->id('text-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Text::widget()->id('text-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Text::widget()->id('text-6582f2d099e8b')->render()
+ Text::widget()->id('text-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Text::widget()->id('text-6582f2d099e8b')->suffix('suffix')->render()
+ Text::widget()->id('text-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Text::widget()->id('text-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Text::widget()->id('text-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Text::widget()
->id('text-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Text::widget()
- ->id('text-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Text::widget()->id('text-6582f2d099e8b')->suffix('value')->suffixClass('value')->suffixTag('div')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Text::widget()
- ->id('text-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Text::widget()->id('text-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Text::widget()->id('text-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Text/ExceptionTest.php b/tests/FormControl/Input/Text/ExceptionTest.php
index 5ebf837f..b4de7598 100644
--- a/tests/FormControl/Input/Text/ExceptionTest.php
+++ b/tests/FormControl/Input/Text/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Text::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Text::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Time/AttributeTest.php b/tests/FormControl/Input/Time/AttributeTest.php
index 1a6222cd..ec24e11a 100644
--- a/tests/FormControl/Input/Time/AttributeTest.php
+++ b/tests/FormControl/Input/Time/AttributeTest.php
@@ -226,9 +226,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Time::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Time::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -236,9 +236,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Time::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Time::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Time/CustomMethodTest.php b/tests/FormControl/Input/Time/CustomMethodTest.php
index 731ebfc9..99257de2 100644
--- a/tests/FormControl/Input/Time/CustomMethodTest.php
+++ b/tests/FormControl/Input/Time/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Time::widget()->generateField('ModelName', 'fieldName')->render()
+ Time::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,165 +26,141 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Time::widget()->id('time-6582f2d099e8b')->prefix('prefix')->render()
+ Time::widget()->id('time-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Time::widget()->id('time-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Time::widget()
->id('time-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Time::widget()
- ->id('time-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ Time::widget()->id('time-6582f2d099e8b')->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Time::widget()
- ->id('time-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Time::widget()->id('time-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Time::widget()->id('time-6582f2d099e8b')->render()
+ Time::widget()->id('time-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Time::widget()->id('time-6582f2d099e8b')->suffix('suffix')->render()
+ Time::widget()->id('time-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Time::widget()->id('time-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Time::widget()->id('time-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Time::widget()
->id('time-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Time::widget()
- ->id('time-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Time::widget()->id('time-6582f2d099e8b')->suffix('value')->suffixClass('value')->suffixTag('div')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixrTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Time::widget()
- ->id('time-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Time::widget()->id('time-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Time::widget()->id('time-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Time/ExceptionTest.php b/tests/FormControl/Input/Time/ExceptionTest.php
index 0e69a5ed..4899d277 100644
--- a/tests/FormControl/Input/Time/ExceptionTest.php
+++ b/tests/FormControl/Input/Time/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Time::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Time::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Url/AttributeTest.php b/tests/FormControl/Input/Url/AttributeTest.php
index ecc232db..fec8b86d 100644
--- a/tests/FormControl/Input/Url/AttributeTest.php
+++ b/tests/FormControl/Input/Url/AttributeTest.php
@@ -42,6 +42,16 @@ public function testAttributes(): void
);
}
+ public function testAutocomplete(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Url::widget()->autocomplete('on')->id('url-6582f2d099e8b')->render()
+ );
+ }
+
public function testAutofocus(): void
{
Assert::equalsWithoutLE(
@@ -72,6 +82,16 @@ public function testDataAttributes(): void
);
}
+ public function testDirname(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Url::widget()->dirname('value')->id('url-6582f2d099e8b')->render()
+ );
+ }
+
public function testDisabled(): void
{
Assert::equalsWithoutLE(
@@ -246,9 +266,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Url::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Url::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -256,9 +276,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Url::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Url::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Url/CustomMethodTest.php b/tests/FormControl/Input/Url/CustomMethodTest.php
index 33449994..8da40767 100644
--- a/tests/FormControl/Input/Url/CustomMethodTest.php
+++ b/tests/FormControl/Input/Url/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Url::widget()->generateField('ModelName', 'fieldName')->render()
+ Url::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,165 +26,141 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Url::widget()->id('url-6582f2d099e8b')->prefix('prefix')->render()
+ Url::widget()->id('url-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Url::widget()->id('url-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Url::widget()
->id('url-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Url::widget()
- ->id('url-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ Url::widget()->id('url-6582f2d099e8b')->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Url::widget()
- ->id('url-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Url::widget()->id('url-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Url::widget()->id('url-6582f2d099e8b')->render()
+ Url::widget()->id('url-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Url::widget()->id('url-6582f2d099e8b')->suffix('suffix')->render()
+ Url::widget()->id('url-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Url::widget()->id('url-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Url::widget()->id('url-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Url::widget()
->id('url-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Url::widget()
- ->id('url-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Url::widget()->id('url-6582f2d099e8b')->suffix('value')->suffixClass('value')->suffixTag('div')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Url::widget()
- ->id('url-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Url::widget()->id('url-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Url::widget()->id('url-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Url/ExceptionTest.php b/tests/FormControl/Input/Url/ExceptionTest.php
index 2f87381a..3a5f43cb 100644
--- a/tests/FormControl/Input/Url/ExceptionTest.php
+++ b/tests/FormControl/Input/Url/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Url::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Url::widget()->value([])->render();
}
diff --git a/tests/FormControl/Input/Week/AttributeTest.php b/tests/FormControl/Input/Week/AttributeTest.php
index c95ced55..b2fd21ec 100644
--- a/tests/FormControl/Input/Week/AttributeTest.php
+++ b/tests/FormControl/Input/Week/AttributeTest.php
@@ -226,9 +226,9 @@ public function testWithoutId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Week::widget()->generateField('ModelName', 'fieldName')->id(null)->render()
+ Week::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
);
}
@@ -236,9 +236,9 @@ public function testWithoutName(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Week::widget()->generateField('ModelName', 'fieldName')->name(null)->render()
+ Week::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
);
}
}
diff --git a/tests/FormControl/Input/Week/CustomMethodTest.php b/tests/FormControl/Input/Week/CustomMethodTest.php
index 967f120b..68434879 100644
--- a/tests/FormControl/Input/Week/CustomMethodTest.php
+++ b/tests/FormControl/Input/Week/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Week::widget()->generateField('ModelName', 'fieldName')->render()
+ Week::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,165 +26,141 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Week::widget()->id('week-6582f2d099e8b')->prefix('prefix')->render()
+ Week::widget()->id('week-6582f2d099e8b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Week::widget()->id('week-6582f2d099e8b')->prefix('prefix')->prefixContainer(true)->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Week::widget()
->id('week-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Week::widget()
- ->id('week-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->render()
+ Week::widget()->id('week-6582f2d099e8b')->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Week::widget()
- ->id('week-6582f2d099e8b')
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('article')
- ->render()
+ Week::widget()->id('week-6582f2d099e8b')->prefix('value')->prefixTag('article')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Week::widget()->id('week-6582f2d099e8b')->render()
+ Week::widget()->id('week-6582f2d099e8b')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Week::widget()->id('week-6582f2d099e8b')->suffix('suffix')->render()
+ Week::widget()->id('week-6582f2d099e8b')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Week::widget()->id('week-6582f2d099e8b')->suffix('suffix')->suffixContainer(true)->render()
+ Week::widget()->id('week-6582f2d099e8b')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Week::widget()
->id('week-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Week::widget()
- ->id('week-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->render()
+ Week::widget()->id('week-6582f2d099e8b')->suffix('value')->suffixClass('value')->suffixTag('div')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Week::widget()
- ->id('week-6582f2d099e8b')
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('article')
- ->render()
+ Week::widget()->id('week-6582f2d099e8b')->suffix('value')->suffixTag('article')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Week::widget()->id('week-6582f2d099e8b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Input/Week/ExceptionTest.php b/tests/FormControl/Input/Week/ExceptionTest.php
index 1d80197e..0dc84ee3 100644
--- a/tests/FormControl/Input/Week/ExceptionTest.php
+++ b/tests/FormControl/Input/Week/ExceptionTest.php
@@ -16,7 +16,7 @@ final class ExceptionTest extends TestCase
public function testValue(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectExceptionMessage('Week::class widget must be a string or null value.');
+ $this->expectExceptionMessage('The value must be a string or null value. The value is: array.');
Week::widget()->value([])->render();
}
diff --git a/tests/FormControl/Label/AttributeTest.php b/tests/FormControl/Label/AttributeTest.php
index a77273d0..b7789476 100644
--- a/tests/FormControl/Label/AttributeTest.php
+++ b/tests/FormControl/Label/AttributeTest.php
@@ -16,9 +16,9 @@ public function testAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Label::widget()->attributes(['class' => 'value'])->render()
+ Label::widget()->attributes(['class' => 'value'])->content('value')->render()
);
}
@@ -26,9 +26,9 @@ public function testClass(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Label::widget()->class('value')->render()
+ Label::widget()->class('value')->content('value')->render()
);
}
@@ -46,9 +46,9 @@ public function testDataAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Label::widget()->dataAttributes(['value' => 'value'])->render()
+ Label::widget()->content('value')->dataAttributes(['value' => 'value'])->render()
);
}
@@ -56,9 +56,9 @@ public function testLabelFor(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Label::widget()->for('value')->render()
+ Label::widget()->content('value')->for('value')->render()
);
}
@@ -66,9 +66,9 @@ public function testForm(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Label::widget()->form('value')->render()
+ Label::widget()->content('value')->form('value')->render()
);
}
@@ -76,19 +76,9 @@ public function testId(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Label::widget()->id('value')->render()
- );
- }
-
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
- HTML,
- Label::widget()->name('value')->render()
+ Label::widget()->content('value')->id('value')->render()
);
}
@@ -96,9 +86,9 @@ public function testStyle(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Label::widget()->style('value')->render()
+ Label::widget()->content('value')->style('value')->render()
);
}
@@ -106,9 +96,9 @@ public function testTitle(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Label::widget()->title('value')->render()
+ Label::widget()->content('value')->title('value')->render()
);
}
}
diff --git a/tests/FormControl/Label/CustomMethodTest.php b/tests/FormControl/Label/CustomMethodTest.php
index 73a037b7..abae0000 100644
--- a/tests/FormControl/Label/CustomMethodTest.php
+++ b/tests/FormControl/Label/CustomMethodTest.php
@@ -17,138 +17,131 @@ public function testPrefix(): void
Assert::equalsWithoutLE(
<<
- HTML,
- Label::widget()->prefix('value')->render()
- );
- }
-
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- value
-
-
+
HTML,
- Label::widget()->prefixContainer(true)->prefix('value')->render()
+ Label::widget()->content('value')->prefix('value')->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
value
-
+
HTML,
Label::widget()
- ->prefixContainer(true)
+ ->content('value')
->prefix('value')
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
value
-
+
HTML,
- Label::widget()->prefixContainer(true)->prefix('value')->prefixContainerClass('value')->render()
+ Label::widget()->content('value')->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<value
-
+
HTML,
- Label::widget()->prefixContainer(true)->prefix('value')->prefixContainerTag('span')->render()
+ Label::widget()->content('value')->prefix('value')->prefixTag('span')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
+ value
+
HTML,
- Label::widget()->render()
+ Label::widget()->content('value')->prefix('value')->prefixTag(false)->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
- Assert::equalsWithoutLE(
- <<
- value
- HTML,
- Label::widget()->suffix('value')->render()
- );
+ $this->assertEmpty(Label::widget()->render());
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
+
value
-
HTML,
- Label::widget()->suffixContainer(true)->suffix('value')->render()
+ Label::widget()->content('value')->suffix('value')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
value
HTML,
Label::widget()
- ->suffixContainer(true)
+ ->content('value')
->suffix('value')
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
+
value
HTML,
- Label::widget()->suffixContainer(true)->suffix('value')->suffixContainerClass('value')->render()
+ Label::widget()->content('value')->suffix('value')->suffixClass('value')->suffixTag('div')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
+
value
HTML,
- Label::widget()->suffixContainer(true)->suffix('value')->suffixContainerTag('span')->render()
+ Label::widget()->content('value')->suffix('value')->suffixTag('span')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<value
+ value
+ HTML,
+ Label::widget()->content('value')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/FormControl/Label/ImmutableTest.php b/tests/FormControl/Label/ImmutableTest.php
new file mode 100644
index 00000000..903d7ac6
--- /dev/null
+++ b/tests/FormControl/Label/ImmutableTest.php
@@ -0,0 +1,20 @@
+assertNotSame($label, $label->for(''));
+ }
+}
diff --git a/tests/FormControl/Select/AttributeTest.php b/tests/FormControl/Select/AttributeTest.php
index ac264711..0b94d230 100644
--- a/tests/FormControl/Select/AttributeTest.php
+++ b/tests/FormControl/Select/AttributeTest.php
@@ -5,12 +5,11 @@
namespace PHPForge\Html\Tests\FormControl\Select;
use PHPForge\{Html\FormControl\Select, Support\Assert};
-use PHPUnit\Framework\TestCase;
/**
* @psalm-suppress PropertyNotSetInConstructor
*/
-final class AttributeTest extends TestCase
+final class AttributeTest extends \PHPUnit\Framework\TestCase
{
private array $cities = [
1 => 'Moscu',
@@ -45,6 +44,19 @@ public function testAttributes(): void
);
}
+ public function testAutocomplete(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+
+ HTML,
+ Select::widget()->autocomplete('on')->items([1 => 'Moscu'])->render()
+ );
+ }
+
public function testAutofocus(): void
{
Assert::equalsWithoutLE(
@@ -299,4 +311,36 @@ public function testValue(): void
Select::widget()->items($this->cities)->value(null)->render()
);
}
+
+ public function testWithoutId(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+
+
+
+
+ HTML,
+ Select::widget()->fieldAttributes('FormModelName', 'property')->id(null)->items($this->cities)->render()
+ );
+ }
+
+ public function testWithoutName(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+
+
+
+
+ HTML,
+ Select::widget()->items($this->cities)->fieldAttributes('FormModelName', 'property')->name(null)->render()
+ );
+ }
}
diff --git a/tests/FormControl/Select/CustomMethodTest.php b/tests/FormControl/Select/CustomMethodTest.php
index 61cfbdcf..f86a52b9 100644
--- a/tests/FormControl/Select/CustomMethodTest.php
+++ b/tests/FormControl/Select/CustomMethodTest.php
@@ -40,11 +40,11 @@ final class CustomMethodTest extends TestCase
],
];
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- Select::widget()->generateField('ModelName', 'fieldName')->items($this->cities)->render()
+ Select::widget()->fieldAttributes('formModelName', 'fieldName')->items($this->cities)->render()
);
}
@@ -133,86 +133,13 @@ public function testItemsAttributes(): void
);
}
- public function testLabel(): void
- {
- Assert::equalsWithoutLE(
- <<Cities:
-
-
- HTML,
- Select::widget()->items($this->cities)->label('Cities:')->render()
- );
- }
-
- public function testLabelAttributes(): void
- {
- Assert::equalsWithoutLE(
- <<Cities:
-
-
- HTML,
- Select::widget()
- ->items($this->cities)
- ->labelAttributes(['class' => 'value'])
- ->label('Cities:')
- ->render()
- );
- }
-
- public function testLabelClass(): void
- {
- Assert::equalsWithoutLE(
- <<Cities:
-
-
- HTML,
- Select::widget()->items($this->cities)->labelClass('value')->label('Cities:')->render()
- );
- }
-
- public function testLabelFor(): void
- {
- Assert::equalsWithoutLE(
- <<Cities:
-
-
- HTML,
- Select::widget()->id('value')->items($this->cities)->label('Cities:')->labelFor('value')->render()
- );
- }
-
- public function testNotLabel(): void
+ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
+ value
+
HTML,
- Select::widget()->items($this->cities)->label('Cities:')->notLabel()->render()
+ Select::widget()->items($this->cities)->prefix('value')->render()
);
}
- public function testPrefix(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
+ value
+
HTML,
- Select::widget()->items($this->cities)->prefix('prefix')->render()
+ Select::widget()->items($this->cities)->prefix('value')->prefixAttributes(['class' => 'value'])->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+
+ value
HTML,
- Select::widget()->items($this->cities)->prefixContainer(true)->prefix('prefix')->render()
+ Select::widget()->items($this->cities)->prefix('value')->prefixClass('value')->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
-
+ value
HTML,
- Select::widget()
- ->items($this->cities)
- ->prefixContainer(true)
- ->prefix('prefix')
- ->prefixContainerClass('value')
- ->render()
+ Select::widget()->items($this->cities)->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<prefix
+ value
HTML,
- Select::widget()
- ->items($this->cities)
- ->prefixContainer(true)
- ->prefix('prefix')
- ->prefixContainerTag('span')
- ->render()
+ Select::widget()->items($this->cities)->prefix('value')->prefixTag(false)->render()
);
}
@@ -318,32 +235,31 @@ public function testSuffix(): void
+
value
+
HTML,
Select::widget()->items($this->cities)->suffix('value')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
-
-
-
+
value
HTML,
- Select::widget()->items($this->cities)->suffixContainer(true)->suffix('value')->render()
+ Select::widget()->items([1 => 'Moscu'])->suffix('value')->suffixAttributes(['class' => 'value'])->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Select::widget()
- ->items([1 => 'Moscu'])
- ->suffixContainer(true)
- ->suffix('value')
- ->suffixContainerAttributes(['class' => 'value'])
- ->render()
+ Select::widget()->items([1 => 'Moscu'])->suffix('value')->suffixClass('value')->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<Select an option
-
- value
-
+ value
HTML,
- Select::widget()
- ->items([1 => 'Moscu'])
- ->suffixContainer(true)
- ->suffix('value')
- ->suffixContainerClass('value')
- ->render()
+ Select::widget()->items([1 => 'Moscu'])->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<Select an option
- value
+ value
HTML,
- Select::widget()
- ->items([1 => 'Moscu'])
- ->suffixContainer(true)
- ->suffix('value')
- ->suffixContainerTag('span')
- ->render()
+ Select::widget()->items([1 => 'Moscu'])->suffix('value')->suffixTag(false)->render()
);
}
}
diff --git a/tests/FormControl/Select/LabelTest.php b/tests/FormControl/Select/LabelTest.php
new file mode 100644
index 00000000..90804146
--- /dev/null
+++ b/tests/FormControl/Select/LabelTest.php
@@ -0,0 +1,112 @@
+ 'Moscu',
+ 2 => 'San Petersburgo',
+ 3 => 'Novosibirsk',
+ 4 => 'Ekaterinburgo',
+ ];
+
+ public function testDisableLabel(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+
+
+
+
+
+
+ HTML,
+ Select::widget()->disableLabel()->items($this->cities)->label('Cities:')->render()
+ );
+ }
+
+ public function testLabel(): void
+ {
+ Assert::equalsWithoutLE(
+ <<Cities:
+
+
+ HTML,
+ Select::widget()->items($this->cities)->label('Cities:')->render()
+ );
+ }
+
+ public function testLabelAttributes(): void
+ {
+ Assert::equalsWithoutLE(
+ <<Cities:
+
+
+ HTML,
+ Select::widget()
+ ->items($this->cities)
+ ->labelAttributes(['class' => 'value'])
+ ->label('Cities:')
+ ->render()
+ );
+ }
+
+ public function testLabelClass(): void
+ {
+ Assert::equalsWithoutLE(
+ <<Cities:
+
+
+ HTML,
+ Select::widget()->items($this->cities)->labelClass('value')->label('Cities:')->render()
+ );
+ }
+
+ public function testLabelFor(): void
+ {
+ Assert::equalsWithoutLE(
+ <<Cities:
+
+
+ HTML,
+ Select::widget()->id('value')->items($this->cities)->label('Cities:')->labelFor('value')->render()
+ );
+ }
+}
diff --git a/tests/FormControl/TextArea/AttributeTest.php b/tests/FormControl/TextArea/AttributeTest.php
index b62906a0..a8d7f4ff 100644
--- a/tests/FormControl/TextArea/AttributeTest.php
+++ b/tests/FormControl/TextArea/AttributeTest.php
@@ -238,4 +238,24 @@ public function testWrap(): void
TextArea::widget()->id('textarea-659fc6087e75b')->wrap('hard')->render()
);
}
+
+ public function testWithoutId(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ TextArea::widget()->fieldAttributes('FormModelName', 'property')->id(null)->render()
+ );
+ }
+
+ public function testWithoutName(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ TextArea::widget()->fieldAttributes('FormModelName', 'property')->name(null)->render()
+ );
+ }
}
diff --git a/tests/FormControl/TextArea/CustomMethodTest.php b/tests/FormControl/TextArea/CustomMethodTest.php
index 7e3922ab..dba65dd2 100644
--- a/tests/FormControl/TextArea/CustomMethodTest.php
+++ b/tests/FormControl/TextArea/CustomMethodTest.php
@@ -12,13 +12,13 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testGenerateField(): void
+ public function testFieldAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
HTML,
- TextArea::widget()->generateField('ModelName', 'fieldName')->render()
+ TextArea::widget()->fieldAttributes('FormModelName', 'property')->render()
);
}
@@ -26,75 +26,68 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- TextArea::widget()->id('textarea-659fc6087e75b')->prefix('prefix')->render()
+ TextArea::widget()->id('textarea-659fc6087e75b')->prefix('value')->render()
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+
+ value
HTML,
- TextArea::widget()->id('textarea-659fc6087e75b')->prefixContainer(true)->prefix('prefix')->render()
+ TextArea::widget()
+ ->id('textarea-659fc6087e75b')
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
+ ->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
TextArea::widget()
->id('textarea-659fc6087e75b')
- ->prefixContainer(true)
- ->prefix('prefix')
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixClass('value')
+ ->prefixTag('div')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
-
+ value
HTML,
- TextArea::widget()
- ->id('textarea-659fc6087e75b')
- ->prefixContainer(true)
- ->prefix('prefix')
- ->prefixContainerClass('value')
- ->render()
+ TextArea::widget()->id('textarea-659fc6087e75b')->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<prefix
+ value
HTML,
- TextArea::widget()
- ->id('textarea-659fc6087e75b')
- ->prefixContainer(true)
- ->prefix('prefix')
- ->prefixContainerTag('span')
- ->render()
+ TextArea::widget()->id('textarea-659fc6087e75b')->prefix('value')->prefixTag(false)->render()
);
}
@@ -113,74 +106,67 @@ public function testSuffix(): void
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- TextArea::widget()->id('textarea-659fc6087e75b')->suffix('suffix')->render()
+ TextArea::widget()->id('textarea-659fc6087e75b')->suffix('value')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
+
+ value
HTML,
- TextArea::widget()->id('textarea-659fc6087e75b')->suffixContainer(true)->suffix('suffix')->render()
+ TextArea::widget()
+ ->id('textarea-659fc6087e75b')
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
+ ->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
TextArea::widget()
->id('textarea-659fc6087e75b')
- ->suffixContainer(true)
- ->suffix('suffix')
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixClass('value')
+ ->suffixTag('div')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- TextArea::widget()
- ->id('textarea-659fc6087e75b')
- ->suffixContainer(true)
- ->suffix('suffix')
- ->suffixContainerClass('value')
- ->render()
+ TextArea::widget()->id('textarea-659fc6087e75b')->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- TextArea::widget()
- ->id('textarea-659fc6087e75b')
- ->suffixContainer(true)
- ->suffix('suffix')
- ->suffixContainerTag('span')
- ->render()
+ TextArea::widget()->id('textarea-659fc6087e75b')->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/Group/Div/AttributeTest.php b/tests/Group/Div/AttributeTest.php
index 40287dda..f2622dc5 100644
--- a/tests/Group/Div/AttributeTest.php
+++ b/tests/Group/Div/AttributeTest.php
@@ -79,17 +79,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- Div::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Group/Li/AttributeTest.php b/tests/Group/Li/AttributeTest.php
index 1948807c..7fcf5e7d 100644
--- a/tests/Group/Li/AttributeTest.php
+++ b/tests/Group/Li/AttributeTest.php
@@ -68,17 +68,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- Li::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Group/Main/AttributeTest.php b/tests/Group/Main/AttributeTest.php
index adafd334..2c0f37c6 100644
--- a/tests/Group/Main/AttributeTest.php
+++ b/tests/Group/Main/AttributeTest.php
@@ -79,17 +79,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- Main::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Group/Ol/AttributeTest.php b/tests/Group/Ol/AttributeTest.php
index c14c7dd2..851851fe 100644
--- a/tests/Group/Ol/AttributeTest.php
+++ b/tests/Group/Ol/AttributeTest.php
@@ -73,17 +73,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- Ol::widget()->name('value')->render(),
- );
- }
-
public function testReversed(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Group/P/AttributeTest.php b/tests/Group/P/AttributeTest.php
index 80076bdc..c49f1647 100644
--- a/tests/Group/P/AttributeTest.php
+++ b/tests/Group/P/AttributeTest.php
@@ -79,17 +79,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- P::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Group/Ul/AttributeTest.php b/tests/Group/Ul/AttributeTest.php
index 041737cd..343484cb 100644
--- a/tests/Group/Ul/AttributeTest.php
+++ b/tests/Group/Ul/AttributeTest.php
@@ -68,17 +68,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- Ul::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Metadata/Title/AttributeTest.php b/tests/Metadata/Title/AttributeTest.php
index b269ee34..9e6f7d46 100644
--- a/tests/Metadata/Title/AttributeTest.php
+++ b/tests/Metadata/Title/AttributeTest.php
@@ -79,17 +79,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- Title::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Mutlimedia/Img/AttributeTest.php b/tests/Mutlimedia/Img/AttributeTest.php
index ff3a6820..7afb0ff7 100644
--- a/tests/Mutlimedia/Img/AttributeTest.php
+++ b/tests/Mutlimedia/Img/AttributeTest.php
@@ -112,16 +112,6 @@ public function testLoading(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
- HTML,
- Img::widget()->name('value')->render()
- );
- }
-
public function testSizes(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Mutlimedia/Img/CustomMethodTest.php b/tests/Mutlimedia/Img/CustomMethodTest.php
index 3fe7f981..de61a18e 100644
--- a/tests/Mutlimedia/Img/CustomMethodTest.php
+++ b/tests/Mutlimedia/Img/CustomMethodTest.php
@@ -23,20 +23,20 @@ public function testPrefix(): void
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
value
HTML,
- Img::widget()->prefixContainer(true)->prefix('value')->render()
+ Img::widget()->prefix('value')->prefixAttributes(['class' => 'value'])->prefixTag('div')->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Img::widget()
- ->prefixContainer(true)
- ->prefix('value')
- ->prefixContainerAttributes(['class' => 'value'])
- ->render()
+ Img::widget()->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- value
-
+ value
HTML,
- Img::widget()->prefixContainer(true)->prefix('value')->prefixContainerClass('value')->render()
+ Img::widget()->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<value
+ value
HTML,
- Img::widget()->prefixContainer(true)->prefix('value')->prefixContainerTag('span')->render()
+ Img::widget()->prefix('value')->prefixTag(false)->render()
);
}
@@ -98,20 +92,20 @@ public function testSuffix(): void
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
+
value
HTML,
- Img::widget()->suffixContainer(true)->suffix('value')->render()
+ Img::widget()->suffix('value')->suffixAttributes(['class' => 'value'])->suffixTag('div')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Img::widget()
- ->suffixContainer(true)
- ->suffix('value')
- ->suffixContainerAttributes(['class' => 'value'])
- ->render()
+ Img::widget()->suffix('value')->suffixClass('value')->suffixTag('div')->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- value
-
+ value
HTML,
- Img::widget()->suffixContainer(true)->suffix('value')->suffixContainerClass('value')->render()
+ Img::widget()->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- value
+ value
HTML,
- Img::widget()->suffixContainer(true)->suffix('value')->suffixContainerTag('span')->render()
+ Img::widget()->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/Semantic/Footer/AttributeTest.php b/tests/Semantic/Footer/AttributeTest.php
index 7c2fc62a..f2756d4c 100644
--- a/tests/Semantic/Footer/AttributeTest.php
+++ b/tests/Semantic/Footer/AttributeTest.php
@@ -79,17 +79,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- Footer::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Semantic/H/AttributeTest.php b/tests/Semantic/H/AttributeTest.php
index e7f77ffa..acdafc52 100644
--- a/tests/Semantic/H/AttributeTest.php
+++ b/tests/Semantic/H/AttributeTest.php
@@ -79,17 +79,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- H::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Semantic/Header/AttributeTest.php b/tests/Semantic/Header/AttributeTest.php
index 77e7eab5..f5d7fe60 100644
--- a/tests/Semantic/Header/AttributeTest.php
+++ b/tests/Semantic/Header/AttributeTest.php
@@ -79,17 +79,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- Header::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Semantic/Nav/AttributeTest.php b/tests/Semantic/Nav/AttributeTest.php
index 50976d4f..7ab3a863 100644
--- a/tests/Semantic/Nav/AttributeTest.php
+++ b/tests/Semantic/Nav/AttributeTest.php
@@ -79,17 +79,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- Nav::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Semantic/Section/AttributeTest.php b/tests/Semantic/Section/AttributeTest.php
index 65f0603d..3aeccd42 100644
--- a/tests/Semantic/Section/AttributeTest.php
+++ b/tests/Semantic/Section/AttributeTest.php
@@ -79,17 +79,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
-
- HTML,
- Section::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Svg/AttributeTest.php b/tests/Svg/AttributeTest.php
index c2e2021c..7d35b185 100644
--- a/tests/Svg/AttributeTest.php
+++ b/tests/Svg/AttributeTest.php
@@ -84,18 +84,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
- value
-
- HTML,
- Svg::widget()->content('value')->name('value')->render()
- );
- }
-
public function testStroke(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Tag/AttributeTest.php b/tests/Tag/AttributeTest.php
index 5837eeb8..e819f059 100644
--- a/tests/Tag/AttributeTest.php
+++ b/tests/Tag/AttributeTest.php
@@ -72,16 +72,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
- HTML,
- Tag::widget()->name('value')->tagName('span')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Tag/CustomMethodTest.php b/tests/Tag/CustomMethodTest.php
index 8cba7952..187543c2 100644
--- a/tests/Tag/CustomMethodTest.php
+++ b/tests/Tag/CustomMethodTest.php
@@ -16,165 +16,141 @@ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Tag::widget()->prefix('prefix')->tagName('span')->render()
+ Tag::widget()->prefix('value')->tagName('span')->render()
);
}
- public function testPrefixContainer(): void
- {
- Assert::equalsWithoutLE(
- <<
- prefix
-
-
- HTML,
- Tag::widget()->prefix('prefix')->prefixContainer(true)->tagName('span')->render()
- );
- }
-
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
Tag::widget()
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
+ ->prefix('value')
+ ->prefixAttributes(['class' => 'value'])
+ ->prefixTag('div')
->tagName('span')
->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Tag::widget()
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerClass('value')
- ->tagName('span')
- ->render()
+ Tag::widget()->prefix('value')->prefixClass('value')->prefixTag('div')->tagName('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- prefix
+ value
HTML,
- Tag::widget()
- ->prefix('prefix')
- ->prefixContainer(true)
- ->prefixContainerTag('p')
- ->tagName('span')
- ->render()
+ Tag::widget()->prefix('value')->prefixTag('p')->tagName('span')->render()
);
}
- public function testRender(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Tag::widget()->tagName('span')->render()
+ Tag::widget()->prefix('value')->prefixTag(false)->tagName('span')->render()
);
}
- public function testSuffix(): void
+ public function testRender(): void
{
Assert::equalsWithoutLE(
<<
- suffix
HTML,
- Tag::widget()->suffix('suffix')->tagName('span')->render()
+ Tag::widget()->tagName('span')->render()
);
}
- public function testSuffixContainer(): void
+ public function testSuffix(): void
{
Assert::equalsWithoutLE(
<<
-
- suffix
-
+ value
HTML,
- Tag::widget()->suffix('suffix')->suffixContainer(true)->tagName('span')->render()
+ Tag::widget()->suffix('value')->tagName('span')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
Tag::widget()
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerAttributes(['class' => 'value'])
+ ->suffix('value')
+ ->suffixAttributes(['class' => 'value'])
+ ->suffixTag('div')
->tagName('span')
->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Tag::widget()
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerClass('value')
- ->tagName('span')
- ->render()
+ Tag::widget()->suffix('value')->suffixClass('value')->suffixTag('div')->tagName('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
- suffix
+ value
HTML,
- Tag::widget()
- ->suffix('suffix')
- ->suffixContainer(true)
- ->suffixContainerTag('p')
- ->tagName('span')
- ->render()
+ Tag::widget()->suffix('value')->suffixTag('p')->tagName('span')->render()
+ );
+ }
+
+ public function testSuffixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Tag::widget()->suffix('value')->suffixTag(false)->tagName('span')->render()
);
}
diff --git a/tests/Textual/A/AttributeTest.php b/tests/Textual/A/AttributeTest.php
index 6fb27233..8a503584 100644
--- a/tests/Textual/A/AttributeTest.php
+++ b/tests/Textual/A/AttributeTest.php
@@ -161,16 +161,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
- HTML,
- A::widget()->name('value')->render()
- );
- }
-
public function testPing(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Textual/A/CustomMethodTest.php b/tests/Textual/A/CustomMethodTest.php
index 4c415790..fc08670a 100644
--- a/tests/Textual/A/CustomMethodTest.php
+++ b/tests/Textual/A/CustomMethodTest.php
@@ -23,20 +23,20 @@ public function testPrefix(): void
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
value
HTML,
- A::widget()->prefixContainer(true)->prefix('value')->render()
+ A::widget()->prefix('value')->prefixAttributes(['class' => 'value'])->prefixTag('div')->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- A::widget()
- ->prefixContainer(true)
- ->prefix('value')
- ->prefixContainerAttributes(['class' => 'value'])
- ->render()
+ A::widget()->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- value
-
+ value
HTML,
- A::widget()->prefixContainer(true)->prefix('value')->prefixContainerClass('value')->render()
+ A::widget()->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<value
+ value
HTML,
- A::widget()->prefixContainer(true)->prefix('value')->prefixContainerTag('span')->render()
+ A::widget()->prefix('value')->prefixTag(false)->render()
);
}
@@ -98,20 +92,20 @@ public function testSuffix(): void
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
+
value
HTML,
- A::widget()->suffixContainer(true)->suffix('value')->render()
+ A::widget()->suffix('value')->suffixAttributes(['class' => 'value'])->suffixTag('div')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- A::widget()
- ->suffixContainer(true)
- ->suffix('value')
- ->suffixContainerAttributes(['class' => 'value'])
- ->render()
+ A::widget()->suffix('value')->suffixClass('value')->suffixTag('div')->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- value
-
+ value
HTML,
- A::widget()->suffixContainer(true)->suffix('value')->suffixContainerClass('value')->render()
+ A::widget()->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- value
+ value
HTML,
- A::widget()->suffixContainer(true)->suffix('value')->suffixContainerTag('span')->render()
+ A::widget()->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/Textual/I/AttributeTest.php b/tests/Textual/I/AttributeTest.php
index 15e7936c..73736fc3 100644
--- a/tests/Textual/I/AttributeTest.php
+++ b/tests/Textual/I/AttributeTest.php
@@ -72,16 +72,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
- HTML,
- I::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Textual/I/CustomMethodTest.php b/tests/Textual/I/CustomMethodTest.php
index 70e88377..7e6bb6a5 100644
--- a/tests/Textual/I/CustomMethodTest.php
+++ b/tests/Textual/I/CustomMethodTest.php
@@ -23,20 +23,20 @@ public function testPrefix(): void
);
}
- public function testPrefixContainer(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
+
value
HTML,
- I::widget()->prefixContainer(true)->prefix('value')->render()
+ I::widget()->prefix('value')->prefixAttributes(['class' => 'value'])->prefixTag('div')->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- I::widget()
- ->prefixContainer(true)
- ->prefix('value')
- ->prefixContainerAttributes(['class' => 'value'])
- ->render()
+ I::widget()->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
- value
-
+ value
HTML,
- I::widget()->prefixContainer(true)->prefix('value')->prefixContainerClass('value')->render()
+ I::widget()->prefix('value')->prefixTag('span')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<value
+ value
HTML,
- I::widget()->prefixContainer(true)->prefix('value')->prefixContainerTag('span')->render()
+ I::widget()->prefix('value')->prefixTag(false)->render()
);
}
@@ -98,20 +92,20 @@ public function testSuffix(): void
);
}
- public function testSuffixContainer(): void
+ public function testSuffixAttributes(): void
{
Assert::equalsWithoutLE(
<<
-
+
value
HTML,
- I::widget()->suffixContainer(true)->suffix('value')->render()
+ I::widget()->suffix('value')->suffixAttributes(['class' => 'value'])->suffixTag('div')->render()
);
}
- public function testSuffixContainerAttributes(): void
+ public function testSuffixClass(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- I::widget()
- ->suffixContainer(true)
- ->suffix('value')
- ->suffixContainerAttributes(['class' => 'value'])
- ->render()
+ I::widget()->suffix('value')->suffixClass('value')->suffixTag('div')->render()
);
}
- public function testSuffixContainerClass(): void
+ public function testSuffixTag(): void
{
Assert::equalsWithoutLE(
<<
-
- value
-
+ value
HTML,
- I::widget()->suffixContainer(true)->suffix('value')->suffixContainerClass('value')->render()
+ I::widget()->suffix('value')->suffixTag('span')->render()
);
}
- public function testSuffixContainerTag(): void
+ public function testSuffixTagWithFalseValue(): void
{
Assert::equalsWithoutLE(
<<
- value
+ value
HTML,
- I::widget()->suffixContainer(true)->suffix('value')->suffixContainerTag('span')->render()
+ I::widget()->suffix('value')->suffixTag(false)->render()
);
}
diff --git a/tests/Textual/Span/AttributeTest.php b/tests/Textual/Span/AttributeTest.php
index 626f031d..87175d4a 100644
--- a/tests/Textual/Span/AttributeTest.php
+++ b/tests/Textual/Span/AttributeTest.php
@@ -72,16 +72,6 @@ public function testLang(): void
);
}
- public function testName(): void
- {
- Assert::equalsWithoutLE(
- <<
- HTML,
- Span::widget()->name('value')->render()
- );
- }
-
public function testStyle(): void
{
Assert::equalsWithoutLE(
diff --git a/tests/Textual/Span/CustomMethodTest.php b/tests/Textual/Span/CustomMethodTest.php
index 6af6d36b..deb230e7 100644
--- a/tests/Textual/Span/CustomMethodTest.php
+++ b/tests/Textual/Span/CustomMethodTest.php
@@ -12,20 +12,18 @@
*/
final class CustomMethodTest extends TestCase
{
- public function testPrefixContainer(): void
+ public function testPrefix(): void
{
Assert::equalsWithoutLE(
<<
value
-
HTML,
- Span::widget()->prefix('value')->prefixContainer(true)->render()
+ Span::widget()->prefix('value')->render()
);
}
- public function testPrefixContainerAttributes(): void
+ public function testPrefixAttributes(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Span::widget()
- ->prefix('value')
- ->prefixContainer(true)
- ->prefixContainerAttributes(['class' => 'value'])
- ->render()
+ Span::widget()->prefix('value')->prefixAttributes(['class' => 'value'])->prefixTag('div')->render()
);
}
- public function testPrefixContainerClass(): void
+ public function testPrefixClass(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Span::widget()->prefix('value')->prefixContainer(true)->prefixContainerClass('value')->render()
+ Span::widget()->prefix('value')->prefixClass('value')->prefixTag('div')->render()
);
}
- public function testPrefixContainerTag(): void
+ public function testPrefixTag(): void
{
Assert::equalsWithoutLE(
<<
HTML,
- Span::widget()->prefix('value')->prefixContainer(true)->prefixContainerTag('div')->render()
+ Span::widget()->prefix('value')->prefixTag('div')->render()
+ );
+ }
+
+ public function testPrefixTagWithFalseValue(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ HTML,
+ Span::widget()->prefix('value')->prefixTag(false)->render()
);
}
@@ -78,6 +83,67 @@ public function testRender(): void
);
}
+ public function testSuffix(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+ value
+ HTML,
+ Span::widget()->suffix('value')->render()
+ );
+ }
+
+ public function testSuffixAttributes(): void
+ {
+ Assert::equalsWithoutLE(
+ <<
+