function FieldTest::testModalDialogTitle
Same name in other branches
- 10 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest::testModalDialogTitle()
Tests custom text field modal title.
File
-
core/
modules/ views/ tests/ src/ FunctionalJavascript/ Plugin/ views/ Handler/ FieldTest.php, line 80
Class
- FieldTest
- Tests the field handler UI.
Namespace
Drupal\Tests\views\FunctionalJavascript\Plugin\views\HandlerCode
public function testModalDialogTitle() : void {
$web_assert = $this->assertSession();
Node::create([
'title' => $this->randomString(),
'type' => 'page',
'body' => 'page',
])
->save();
$base_path = \Drupal::request()->getBasePath();
$url = "{$base_path}/admin/structure/views/view/content";
$this->drupalGet($url);
$page = $this->getSession()
->getPage();
// Open the 'Add fields dialog'.
$page->clickLink('views-add-field');
$web_assert->waitForField('name[views.nothing]');
// Select the custom text field.
$page->checkField('name[views.nothing]');
$page->find('css', '.ui-dialog .ui-dialog-buttonset')
->pressButton('Add and configure fields');
$web_assert->waitForField('options[alter][text]');
$page->fillField('options[alter][text]', "{{ attach_library(\"core/drupal.dialog.ajax\") }}\n<p><a class=\"use-ajax\" data-dialog-type=\"modal\" href=\"{$base_path}/admin/content\">Content link</a></p>");
$page->find('css', '.ui-dialog .ui-dialog-buttonset')
->pressButton('Apply');
$web_assert->waitForText('Content: body (exposed)');
$web_assert->waitForButton('Save');
$page->pressButton('Save');
$web_assert->waitForText('The view Content has been saved.');
$web_assert->waitForButton('Update preview');
$page->pressButton('Update preview');
// Open the custom text link modal.
$this->assertNotNull($web_assert->waitForLink('Content link'));
$page->clickLink('Content link');
// Verify the modal title.
$web_assert->assertWaitOnAjaxRequest();
$this->assertEquals('Content', $web_assert->waitForElement('css', '.ui-dialog-title')
->getText());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.