Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / entity_browser / tests / src / FunctionalJavascript / EntityBrowserViewsWidgetTest.php
index f6e8d6d31c996d4b87a168d3deb7b0bcee4300a7..5f4c8c1301c350b7278d118cdeeb89cd929ac68e 100644 (file)
@@ -86,6 +86,21 @@ class EntityBrowserViewsWidgetTest extends EntityBrowserJavascriptTestBase {
     $check_new = $this->assertSession()->fieldExists($new_field);
     // Compare value attributes of checkboxes and assert they not equal.
     $this->assertNotEquals($check_old->getAttribute('value'), $check_new->getAttribute('value'));
+
+    $uuid = \Drupal::service('uuid')->generate();
+    \Drupal::service('entity_browser.selection_storage')->setWithExpire(
+      $uuid,
+      ['validators' => ['cardinality' => ['cardinality' => 1]]],
+      21600
+    );
+    $this->drupalGet('/entity-browser/iframe/test_entity_browser_file', ['query' => ['uuid' => $uuid]]);
+    $this->getSession()->getPage()->fillField('entity_browser_select[file:1]', TRUE);
+    $this->getSession()->getPage()->fillField('entity_browser_select[file:2]', TRUE);
+    $this->getSession()->getPage()->pressButton('Select entities');
+
+    $this->assertSession()->pageTextContains('You can not select more than 1 entity.');
+    $this->assertSession()->checkboxNotChecked('entity_browser_select[file:1]');
+    $this->assertSession()->checkboxNotChecked('entity_browser_select[file:2]');
   }
 
 }