Commit 41c3a88e authored by webchick's avatar webchick

Issue #2980864 by chr.fritsch, phenaproxima, marcoscano: Position of...

Issue #2980864 by chr.fritsch, phenaproxima, marcoscano: Position of "published" checkbox varies by media type
parent d4350e2b
...@@ -14,7 +14,7 @@ mode: default ...@@ -14,7 +14,7 @@ mode: default
content: content:
created: created:
type: datetime_timestamp type: datetime_timestamp
weight: 3 weight: 10
region: content region: content
settings: { } settings: { }
third_party_settings: { } third_party_settings: { }
...@@ -35,7 +35,7 @@ content: ...@@ -35,7 +35,7 @@ content:
third_party_settings: { } third_party_settings: { }
path: path:
type: path type: path
weight: 4 weight: 30
region: content region: content
settings: { } settings: { }
third_party_settings: { } third_party_settings: { }
...@@ -43,12 +43,12 @@ content: ...@@ -43,12 +43,12 @@ content:
type: boolean_checkbox type: boolean_checkbox
settings: settings:
display_label: true display_label: true
weight: 5 weight: 100
region: content region: content
third_party_settings: { } third_party_settings: { }
uid: uid:
type: entity_reference_autocomplete type: entity_reference_autocomplete
weight: 2 weight: 5
settings: settings:
match_operator: CONTAINS match_operator: CONTAINS
size: 60 size: 60
......
...@@ -14,7 +14,7 @@ mode: default ...@@ -14,7 +14,7 @@ mode: default
content: content:
created: created:
type: datetime_timestamp type: datetime_timestamp
weight: 3 weight: 10
region: content region: content
settings: { } settings: { }
third_party_settings: { } third_party_settings: { }
...@@ -35,7 +35,7 @@ content: ...@@ -35,7 +35,7 @@ content:
third_party_settings: { } third_party_settings: { }
path: path:
type: path type: path
weight: 4 weight: 30
region: content region: content
settings: { } settings: { }
third_party_settings: { } third_party_settings: { }
...@@ -43,12 +43,12 @@ content: ...@@ -43,12 +43,12 @@ content:
type: boolean_checkbox type: boolean_checkbox
settings: settings:
display_label: true display_label: true
weight: 5 weight: 100
region: content region: content
third_party_settings: { } third_party_settings: { }
uid: uid:
type: entity_reference_autocomplete type: entity_reference_autocomplete
weight: 2 weight: 5
settings: settings:
match_operator: CONTAINS match_operator: CONTAINS
size: 60 size: 60
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace Drupal\Tests\standard\Functional; namespace Drupal\Tests\standard\Functional;
use Drupal\Component\Utility\Html;
use Drupal\media\Entity\MediaType;
use Drupal\Tests\SchemaCheckTestTrait; use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\contact\Entity\ContactForm; use Drupal\contact\Entity\ContactForm;
use Drupal\Core\Url; use Drupal\Core\Url;
...@@ -219,6 +221,38 @@ public function testStandard() { ...@@ -219,6 +221,38 @@ public function testStandard() {
$this->assertText('Archive'); $this->assertText('Archive');
$this->assertText('Restore to Draft'); $this->assertText('Restore to Draft');
$this->assertText('Restore'); $this->assertText('Restore');
\Drupal::service('module_installer')->install(['media']);
$role = Role::create([
'id' => 'admin_media',
'label' => 'Admin media',
]);
$role->grantPermission('administer media');
$role->save();
$this->adminUser->addRole($role->id());
$this->adminUser->save();
$assert_session = $this->assertSession();
/** @var \Drupal\media\Entity\MediaType $media_type */
foreach (MediaType::loadMultiple() as $media_type) {
$media_type_machine_name = $media_type->id();
$this->drupalGet('media/add/' . $media_type_machine_name);
// Get the form element, and its HTML representation.
$form_selector = '#media-' . Html::cleanCssIdentifier($media_type_machine_name) . '-add-form';
$form = $assert_session->elementExists('css', $form_selector);
$form_html = $form->getOuterHtml();
// The name field should come before the source field, which should itself
// come before the vertical tabs.
$name_field = $assert_session->fieldExists('Name', $form)->getOuterHtml();
$test_source_field = $assert_session->fieldExists($media_type->getSource()->getSourceFieldDefinition($media_type)->getLabel(), $form)->getOuterHtml();
$vertical_tabs = $assert_session->elementExists('css', '.form-type-vertical-tabs', $form)->getOuterHtml();
$date_field = $assert_session->fieldExists('Date', $form)->getOuterHtml();
$published_checkbox = $assert_session->fieldExists('Published', $form)->getOuterHtml();
$this->assertTrue(strpos($form_html, $test_source_field) > strpos($form_html, $name_field));
$this->assertTrue(strpos($form_html, $vertical_tabs) > strpos($form_html, $test_source_field));
// The "Published" checkbox should be the last element.
$this->assertTrue(strpos($form_html, $published_checkbox) > strpos($form_html, $date_field));
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment