Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

FIX Ensure tab is highlighted for validation error #1751

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/Forms/FormMessageBootstrapAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FormMessageBootstrapExtension extends Extension
'good' => 'alert-success',
'bad' => 'alert-danger',
'required' => 'alert-danger',
'validation' => 'alert-danger validation',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Keeping validation for projects that might be using that css class as a selector for changed styling or for js logic.
  • Need alert-danger for detecting the error in
    const $invalidTabPanes = this.find('.tab-pane .alert-danger, .tab-pane .alert.error').closest('.tab-pane');
    if (!$invalidTabPanes.length) {
    // If we are at this point it's probably a failed DataObject::validate()
    // where there was a general (non-field) error added via ValidationResult::addError()
    return;
    }

'warning' => 'alert-warning',
];

Expand Down
6 changes: 6 additions & 0 deletions tests/behat/features/multitab-validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Feature: Multi-tab page validation icons
When I press the "Save" button
Then I can see the form validation error message
Then I should not see an invalid tab icon on the "Second" tab
Then I should see an invalid tab icon on the "Third" tab
Then I should see an invalid tab icon on the "Fourth" tab
And I fill in "Third tab first field" with "abc@example.com"
When I press the "Save" button
Then I can see the form validation error message
Then I should not see an invalid tab icon on the "Second" tab
Then I should not see an invalid tab icon on the "Third" tab
Then I should see an invalid tab icon on the "Fourth" tab
When I click on the "#tab-Root_Fourth" element
Expand Down
Loading