Skip to content
Snippets Groups Projects
Commit 8b057724 authored by Julian Pustkuchen's avatar Julian Pustkuchen
Browse files

Issue #3307490 by Anybody, Grevil, thomas.frobieter: Increase classes field...

Issue #3307490 by Anybody, Grevil, thomas.frobieter: Increase classes field length to 255 characters
parent 34ecdbbd
No related branches found
No related tags found
1 merge request!19Issue #3307490: Increase classes field length to 255 characters
......@@ -64,6 +64,8 @@ function fences_field_formatter_third_party_settings_form(FormatterInterface $pl
'#type' => 'textfield',
'#default_value' => $plugin->getThirdPartySetting('fences', 'fences_field_classes'),
'#states' => $invisible_on_none('fences_field_tag'),
// Remove default maxlength of 128:
'#maxlength' => NULL,
];
$settings['fences']['fences_field_items_wrapper_tag'] = [
'#title' => t('Field Items Wrapper Tag'),
......@@ -76,6 +78,8 @@ function fences_field_formatter_third_party_settings_form(FormatterInterface $pl
'#type' => 'textfield',
'#default_value' => $plugin->getThirdPartySetting('fences', 'fences_field_items_wrapper_classes'),
'#states' => $invisible_on_none('fences_field_items_wrapper_tag'),
// Remove default maxlength of 128:
'#maxlength' => NULL,
];
$settings['fences']['fences_field_item_tag'] = [
'#title' => t('Field Item Tag'),
......@@ -88,6 +92,8 @@ function fences_field_formatter_third_party_settings_form(FormatterInterface $pl
'#type' => 'textfield',
'#default_value' => $plugin->getThirdPartySetting('fences', 'fences_field_item_classes'),
'#states' => $invisible_on_none('fences_field_item_tag'),
// Remove default maxlength of 128:
'#maxlength' => NULL,
];
$settings['fences']['fences_label_tag'] = [
'#title' => t('Label Tag'),
......@@ -100,6 +106,8 @@ function fences_field_formatter_third_party_settings_form(FormatterInterface $pl
'#type' => 'textfield',
'#default_value' => $plugin->getThirdPartySetting('fences', 'fences_label_classes'),
'#states' => $invisible_on_none('fences_label_tag'),
// Remove default maxlength of 128:
'#maxlength' => NULL,
];
return $settings['fences'];
}
......
......@@ -88,6 +88,8 @@ class IntegrationTest extends WebDriverTestBase {
'fields[body][label]' => 'above',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_tag]' => 'article',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_classes]' => 'my-field-class',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_items_wrapper_tag]' => 'div',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_items_wrapper_classes]' => 'my-field-items-class',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_item_tag]' => 'code',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_item_classes]' => 'my-field-item-class',
'fields[body][settings_edit_form][third_party_settings][fences][fences_label_tag]' => 'h2',
......@@ -101,7 +103,46 @@ class IntegrationTest extends WebDriverTestBase {
$this->assertTrue($article->hasClass('my-field-class'), 'Custom field class is present.');
$label = $session->elementExists('css', 'h2.my-label-class', $article);
$this->assertSame($label->getText(), 'Body', 'Field label is found in expected HTML element.');
$body = $session->elementExists('css', 'code.my-field-item-class > p', $article);
$body = $session->elementExists('css', 'div.my-field-items-class > code.my-field-item-class > p', $article);
$this->assertSame($body->getText(), 'Body field value.', 'Field text is found in expected HTML element.');
}
/**
* Tests if the max length attribute isn't present in the settings inputs.
*/
public function testMaxLengthRemoved() {
$session = $this->assertSession();
$page = $this->getSession()->getPage();
$this->drupalGet('/admin/structure/types/manage/article/display');
$page->pressButton('edit-fields-body-settings-edit');
$session->waitForElementVisible('css', 'div[id*="edit-fields-body-settings-edit-form"]');
$page->selectFieldOption('Field Items Wrapper Tag', 'div');
$session->elementAttributeNotExists('css', 'input[id*="edit-fields-body-settings-edit-form-third-party-settings-fences-fences-field-classes"]', 'maxlength');
$session->elementAttributeNotExists('css', 'input[id*="edit-fields-body-settings-edit-form-third-party-settings-fences-fences-field-items-wrapper-classes"]', 'maxlength');
$session->elementAttributeNotExists('css', 'input[id*="edit-fields-body-settings-edit-form-third-party-settings-fences-fences-field-item-classes"]', 'maxlength');
$session->elementAttributeNotExists('css', 'input[id*="edit-fields-body-settings-edit-form-third-party-settings-fences-fences-label-classes"]', 'maxlength');
$this->submitForm([
'fields[body][label]' => 'above',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_tag]' => 'article',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_classes]' => 'GBoSTDAZRWAxMHTSwzymJhCAvtUdiKaZYAdSreQdlDIhHjaItLGfzREtNUxcGsUnXqONSUrHaLpwXbdOshbZWhojazHApQYSFCDhPPKPAjJAxxEgIXdEFSejCdIwrWwMym',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_items_wrapper_tag]' => 'div',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_items_wrapper_classes]' => 'GBoSTDAZRWAxMHTSwzymJhCAvtUdiKaZYAdSreQdlDIhHjaItLGfzREtNUxcGsUnXqONSUrHaLpwXbdOshbZWhojazHApQYSFCDhPPKPAjJAxxEgIXdEFSejCdIwrWwMym',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_item_tag]' => 'code',
'fields[body][settings_edit_form][third_party_settings][fences][fences_field_item_classes]' => 'GBoSTDAZRWAxMHTSwzymJhCAvtUdiKaZYAdSreQdlDIhHjaItLGfzREtNUxcGsUnXqONSUrHaLpwXbdOshbZWhojazHApQYSFCDhPPKPAjJAxxEgIXdEFSejCdIwrWwMym',
'fields[body][settings_edit_form][third_party_settings][fences][fences_label_tag]' => 'h2',
'fields[body][settings_edit_form][third_party_settings][fences][fences_label_classes]' => 'GBoSTDAZRWAxMHTSwzymJhCAvtUdiKaZYAdSreQdlDIhHjaItLGfzREtNUxcGsUnXqONSUrHaLpwXbdOshbZWhojazHApQYSFCDhPPKPAjJAxxEgIXdEFSejCdIwrWwMym',
], 'Update');
$session->waitForElementRemoved('css', 'div[id*="edit-fields-body-settings-edit-form"]');
$page->pressButton('edit-submit');
$page = $this->drupalGet('/node/' . $this->node->id());
$article = $session->elementExists('css', '.field--name-body');
$this->assertTrue($article->hasClass('GBoSTDAZRWAxMHTSwzymJhCAvtUdiKaZYAdSreQdlDIhHjaItLGfzREtNUxcGsUnXqONSUrHaLpwXbdOshbZWhojazHApQYSFCDhPPKPAjJAxxEgIXdEFSejCdIwrWwMym'), 'Custom field class is present.');
$label = $session->elementExists('css', 'h2.GBoSTDAZRWAxMHTSwzymJhCAvtUdiKaZYAdSreQdlDIhHjaItLGfzREtNUxcGsUnXqONSUrHaLpwXbdOshbZWhojazHApQYSFCDhPPKPAjJAxxEgIXdEFSejCdIwrWwMym', $article);
$this->assertSame($label->getText(), 'Body', 'Field label is found in expected HTML element.');
$body = $session->elementExists('css', 'div.GBoSTDAZRWAxMHTSwzymJhCAvtUdiKaZYAdSreQdlDIhHjaItLGfzREtNUxcGsUnXqONSUrHaLpwXbdOshbZWhojazHApQYSFCDhPPKPAjJAxxEgIXdEFSejCdIwrWwMym > code.GBoSTDAZRWAxMHTSwzymJhCAvtUdiKaZYAdSreQdlDIhHjaItLGfzREtNUxcGsUnXqONSUrHaLpwXbdOshbZWhojazHApQYSFCDhPPKPAjJAxxEgIXdEFSejCdIwrWwMym > p', $article);
$this->assertSame($body->getText(), 'Body field value.', 'Field text is found in expected HTML element.');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment