diff --git a/tests/src/FunctionalJavascript/ModalHeightTest.php b/tests/src/FunctionalJavascript/ModalHeightTest.php index ac55abc5de99c17e02d24dcd54b2c4a572aaeb77..6297acf5b48154bbf0b4d6f64605bede084342af 100644 --- a/tests/src/FunctionalJavascript/ModalHeightTest.php +++ b/tests/src/FunctionalJavascript/ModalHeightTest.php @@ -5,14 +5,12 @@ namespace Drupal\Tests\layout_paragraphs\FunctionalJavascript; /** * Tests that buttons remain reachable even with tall modal heights. * - * @requires module layout_paragraphs_alter_controls_test - * * @group layout_paragraphs */ class ModalHeightTest extends BuilderTestBase { /** - * Tests modal height. + * Tests that buttons remain reachable even with tall modal heights. */ public function testModalHeight() { $this->loginWithPermissions([ @@ -26,15 +24,18 @@ class ModalHeightTest extends BuilderTestBase { $page->find('css', '.lpb-btn--add')->click(); $this->assertSession()->assertWaitOnAjaxRequest(1000, 'Unable to click add a component.'); - // Add a text component. + // Open the "Create text" dialog. $page->clickLink('text'); - $this->assertSession()->assertWaitOnAjaxRequest(1000, 'Unable to select text component.'); + $this->assertSession()->waitForText('Create text'); // Force the dialog height to expand beyond the viewport. + // Since the dialog height is 'auto' by default, increasing the height of + // the dialog's content will automatically increase the dialog's height. $this->getSession()->executeScript('jQuery(\'.layout-paragraphs-component-form\').height(\'2000px\');'); + // Pause for UI to update. + $this->getSession()->wait(1000); - // Save button should be reachable. - $this->assertSession()->waitForElementVisible('css', '.ui-dialog-buttonpane .lpb-btn--save', 1000); + // Save button should still be reachable. $this->assertSession()->assertVisibleInViewport('css', '.ui-dialog-buttonpane .lpb-btn--save'); }