Mercurial > hg > cmmr2012-drupal-site
comparison core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children | a9cd425dd02b |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\FunctionalJavascriptTests\Dialog; | |
4 | |
5 use Drupal\FunctionalJavascriptTests\JavascriptTestBase; | |
6 | |
7 /** | |
8 * Tests the JavaScript functionality of the dialog position. | |
9 * | |
10 * @group dialog | |
11 */ | |
12 class DialogPositionTest extends JavascriptTestBase { | |
13 | |
14 /** | |
15 * {@inheritdoc} | |
16 */ | |
17 public static $modules = ['block']; | |
18 | |
19 /** | |
20 * Tests if the dialog UI works properly with block layout page. | |
21 */ | |
22 public function testDialogOpenAndClose() { | |
23 $admin_user = $this->drupalCreateUser(['administer blocks']); | |
24 $this->drupalLogin($admin_user); | |
25 $this->drupalGet('admin/structure/block'); | |
26 $session = $this->getSession(); | |
27 $assert_session = $this->assertSession(); | |
28 $page = $session->getPage(); | |
29 | |
30 // Open the dialog using the place block link. | |
31 $placeBlockLink = $page->findLink('Place block'); | |
32 $this->assertTrue($placeBlockLink->isVisible(), 'Place block button exists.'); | |
33 $placeBlockLink->click(); | |
34 $assert_session->assertWaitOnAjaxRequest(); | |
35 $dialog = $page->find('css', '.ui-dialog'); | |
36 $this->assertTrue($dialog->isVisible(), 'Dialog is opened after clicking the Place block button.'); | |
37 | |
38 // Close the dialog again. | |
39 $closeButton = $page->find('css', '.ui-dialog-titlebar-close'); | |
40 $closeButton->click(); | |
41 $assert_session->assertWaitOnAjaxRequest(); | |
42 $dialog = $page->find('css', '.ui-dialog'); | |
43 $this->assertNull($dialog, 'Dialog is closed after clicking the close button.'); | |
44 | |
45 // Resize the window. The test should pass after waiting for Javascript to | |
46 // finish as no Javascript errors should have been triggered. If there were | |
47 // javascript errors the test will fail on that. | |
48 $session->resizeWindow(625, 625); | |
49 $assert_session->assertWaitOnAjaxRequest(); | |
50 } | |
51 | |
52 } |