Mercurial > hg > isophonics-drupal-site
view core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line source
<?php namespace Drupal\FunctionalJavascriptTests\Dialog; use Drupal\FunctionalJavascriptTests\JavascriptTestBase; /** * Tests the JavaScript functionality of the dialog position. * * @group dialog */ class DialogPositionTest extends JavascriptTestBase { /** * {@inheritdoc} */ public static $modules = ['block']; /** * Tests if the dialog UI works properly with block layout page. */ public function testDialogOpenAndClose() { $admin_user = $this->drupalCreateUser(['administer blocks']); $this->drupalLogin($admin_user); $this->drupalGet('admin/structure/block'); $session = $this->getSession(); $assert_session = $this->assertSession(); $page = $session->getPage(); // Open the dialog using the place block link. $placeBlockLink = $page->findLink('Place block'); $this->assertTrue($placeBlockLink->isVisible(), 'Place block button exists.'); $placeBlockLink->click(); $assert_session->assertWaitOnAjaxRequest(); $dialog = $page->find('css', '.ui-dialog'); $this->assertTrue($dialog->isVisible(), 'Dialog is opened after clicking the Place block button.'); // Close the dialog again. $closeButton = $page->find('css', '.ui-dialog-titlebar-close'); $closeButton->click(); $assert_session->assertWaitOnAjaxRequest(); $dialog = $page->find('css', '.ui-dialog'); $this->assertNull($dialog, 'Dialog is closed after clicking the close button.'); // Resize the window. The test should pass after waiting for Javascript to // finish as no Javascript errors should have been triggered. If there were // javascript errors the test will fail on that. $session->resizeWindow(625, 625); $assert_session->assertWaitOnAjaxRequest(); } }