public function IntegrationTest::testBasicSettings in Fences 8.2
Test the basic settings.
File
- tests/
src/ FunctionalJavascript/ IntegrationTest.php, line 59
Class
- IntegrationTest
- A fences integration test.
Namespace
Drupal\Tests\fences\FunctionalJavascriptCode
public function testBasicSettings() {
$session = $this
->assertSession();
$manage_display = '/admin/structure/types/manage/article/display';
$this
->drupalGet($manage_display);
$this
->submitForm([], 'body_settings_edit');
$session
->assertWaitOnAjaxRequest();
$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]' => 'my-field-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',
'fields[body][settings_edit_form][third_party_settings][fences][fences_label_classes]' => 'my-label-class',
], 'Update');
$session
->assertWaitOnAjaxRequest();
$this
->drupalPostForm(NULL, [], 'Save');
$page = $this
->drupalGet('/node/' . $this->node
->id());
$article = $session
->elementExists('css', '.field--name-body');
$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);
$this
->assertSame($body
->getText(), 'Body field value.', 'Field text is found in expected HTML element.');
}