Skip to content
Snippets Groups Projects

Added the proper class

Closed utkarsh_33 requested to merge issue/drupal-3298580:3298580-claro-detail-component into 11.x
3 unresolved threads
Files
3
@@ -19,7 +19,7 @@ class ElementTest extends BrowserTestBase {
*
* @var array
*/
protected static $modules = ['form_test'];
protected static $modules = ['form_test', 'inline_form_errors'];
/**
* {@inheritdoc}
@@ -189,11 +189,24 @@ public function testFormAutocomplete() {
/**
* Tests form element error messages.
* @dataProvider themeDataProvider
*/
public function testFormElementErrors() {
public function testFormElementErrors(string $theme): void {
if ($theme) {
\Drupal::service('theme_installer')->install([$theme]);
$this->config('system.theme')
->set('default', $theme)
->save();
}
$this->drupalGet('form_test/details-form');
$this->submitForm([], 'Submit');
$this->assertSession()->pageTextContains('I am an error on the details element.');
// Assert that the correct error class is used.
if ($theme) {
$this->assertSession()->elementExists('css', '.form-item__error-message');
}
}
/**
@@ -204,4 +217,17 @@ public function testDetailsSummaryAttributes() {
$this->assertSession()->elementExists('css', 'summary[data-summary-attribute="test"]');
}
/**
* Provide data for testFormElementErrors.
*
* @return array
* An array of themes to test.
*/
public static function themeDataProvider(): array {
return [
[''],
['claro'],
];
}
}
Loading