Skip to content

Commit

Permalink
Fix class added to input group container in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Nov 30, 2024
1 parent 51e8ff3 commit b935bd9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/View/Helper/FormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ public function control(string $fieldName, array $options = []): string
isset($options['append']) ||
isset($options['prepend'])
) {
$options['injectErrorClass'] = $this->_config['errorClass'];
$options['injectErrorClass'] = 'has-validation';
}

unset(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public function testDefaultAlignFileControlInputGroupWithError()
['label' => ['class' => 'form-label', 'for' => 'file']],
'File',
'/label',
['div' => ['class' => 'input-group is-invalid']],
['div' => ['class' => 'input-group has-validation']],
['input' => [
'type' => 'file',
'name' => 'file',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ public function testHorizontalAlignFileControlInputGroupWithError()
'File',
'/label',
['div' => ['class' => 'col-sm-7']],
['div' => ['class' => 'input-group is-invalid']],
['div' => ['class' => 'input-group has-validation']],
['input' => [
'type' => 'file',
'name' => 'file',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ public function testInlineAlignFileControlInputGroupWithError()
['label' => ['class' => 'form-label visually-hidden', 'for' => 'file']],
'File',
'/label',
['div' => ['class' => 'input-group is-invalid']],
['div' => ['class' => 'input-group has-validation']],
['input' => [
'type' => 'file',
'name' => 'file',
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/View/Helper/FormHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public function testAddOnWithError()
'label' => ['class' => 'form-label', 'for' => 'title'],
'Title',
'/label',
['div' => ['class' => 'input-group is-invalid']],
['div' => ['class' => 'input-group has-validation']],
'span' => ['class' => 'input-group-text'],
'@',
'/span',
Expand All @@ -487,7 +487,7 @@ public function testAddOnWithError()
'label' => ['class' => 'form-label', 'for' => 'title'],
'Title',
'/label',
['div' => ['class' => 'input-group is-invalid']],
['div' => ['class' => 'input-group has-validation']],
'input' => [
'type' => 'text',
'name' => 'title',
Expand Down

0 comments on commit b935bd9

Please sign in to comment.