diff --git a/modules/entity_form/tests/src/FunctionalJavascript/EntityFormWidgetTest.php b/modules/entity_form/tests/src/FunctionalJavascript/EntityFormWidgetTest.php index afac303..d653996 100644 --- a/modules/entity_form/tests/src/FunctionalJavascript/EntityFormWidgetTest.php +++ b/modules/entity_form/tests/src/FunctionalJavascript/EntityFormWidgetTest.php @@ -21,7 +21,6 @@ class EntityFormWidgetTest extends JavascriptTestBase { */ public static $modules = [ 'entity_browser_entity_form_test', - 'entity_browser_test', 'ctools', 'views', 'block', @@ -116,48 +115,4 @@ class EntityFormWidgetTest extends JavascriptTestBase { $this->assertSession()->buttonExists('Save node'); } - /** - * Tests entity browser multiple submit button widget. - */ - public function testMultipleSubmitWidget() { - /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */ - $form_display = $this->container->get('entity_type.manager') - ->getStorage('entity_form_display') - ->load('node.foo.default'); - - $form_display->setComponent('field_reference', [ - 'type' => 'entity_browser_entity_reference', - 'settings' => [ - 'entity_browser' => 'multiple_submit_example', - 'field_widget_display' => 'label', - 'open' => TRUE, - ], - ])->save(); - - $account = $this->drupalCreateUser([ - 'access multiple_submit_example entity browser pages', - 'create foo content', - 'access content', - ]); - $this->drupalLogin($account); - - $this->drupalGet('node/add/foo'); - // Open the entity browser widget form. - $this->getSession()->getPage()->clickLink('Select entities'); - $this->getSession()->switchToIFrame('entity_browser_iframe_multiple_submit_example'); - - // Click the second submit button to make sure the widget does not close. - $this->getSession()->getPage()->pressButton('Second submit button'); - - // Check that the entity browser widget is still open. - $this->getSession()->getPage()->hasButton('Second submit button'); - - // Click the primary submit button to close the widget. - $this->getSession()->getPage()->pressButton('Select entities'); - - // Check that the entity browser widget is closed. - $this->assertTrue(!$this->getSession()->getPage()->hasButton('Second submit button')); - - } - } diff --git a/src/Tests/EntityBrowserUITest.php b/src/Tests/EntityBrowserUITest.php index 3e8450a..5e45754 100644 --- a/src/Tests/EntityBrowserUITest.php +++ b/src/Tests/EntityBrowserUITest.php @@ -68,5 +68,4 @@ class EntityBrowserUITest extends WebTestBase { $this->assertEqual($file->getFileUri(), 'public://' . $account->getUsername() . '/' . $file->getFilename(), 'Image has the correct uri.'); } - } diff --git a/tests/src/FunctionalJavascript/EntityBrowserTest.php b/tests/src/FunctionalJavascript/EntityBrowserTest.php index c0a8675..5662e24 100644 --- a/tests/src/FunctionalJavascript/EntityBrowserTest.php +++ b/tests/src/FunctionalJavascript/EntityBrowserTest.php @@ -167,4 +167,47 @@ class EntityBrowserTest extends EntityBrowserJavascriptTestBase { } + /** + * Tests NoDisplay selection display plugin. + */ + public function testNoDisplaySelectionDisplay() { + /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */ + $form_display = $this->container->get('entity_type.manager') + ->getStorage('entity_form_display') + ->load('node.article.default'); + + $form_display->setComponent('field_reference', [ + 'type' => 'entity_browser_entity_reference', + 'settings' => [ + 'entity_browser' => 'multiple_submit_example', + 'field_widget_display' => 'label', + 'open' => TRUE, + ], + ])->save(); + + $account = $this->drupalCreateUser([ + 'access multiple_submit_example entity browser pages', + 'create article content', + 'access content', + ]); + $this->drupalLogin($account); + + $this->drupalGet('node/add/article'); + // Open the entity browser widget form. + $this->getSession()->getPage()->clickLink('Select entities'); + $this->getSession()->switchToIFrame('entity_browser_iframe_multiple_submit_example'); + + // Click the second submit button to make sure the widget does not close. + $this->getSession()->getPage()->pressButton('Second submit button'); + + // Check that the entity browser widget is still open. + $this->getSession()->getPage()->hasButton('Second submit button'); + + // Click the primary submit button to close the widget. + $this->getSession()->getPage()->pressButton('Select entities'); + + // Check that the entity browser widget is closed. + $this->assertSession()->buttonNotExists('Second submit button'); + } + }