public function CKEditorMediaBrowserTest::testUnlimitedCardinality in Lightning Media 8.3
Tests that cardinality is never enforced in the media browser.
File
- tests/
src/ FunctionalJavascript/ CKEditorMediaBrowserTest.php, line 126
Class
- CKEditorMediaBrowserTest
- Tests the media browser's integration with CKEditor.
Namespace
Drupal\Tests\lightning_media\FunctionalJavascriptCode
public function testUnlimitedCardinality() {
$media_type = $this
->createMediaType('test')
->id();
for ($i = 0; $i < 2; $i++) {
$this
->addMedia([
'bundle' => $media_type,
'field_media_test' => $this
->randomString(),
]);
}
$this
->drupalGet('/node/add/page');
$this
->open();
$items = $this
->waitForItems();
$this
->assertCount(2, $items);
$this
->selectItem($items[0]);
$this
->selectItem($items[1]);
// Only one item can be selected at any time, but nothing is ever disabled.
$assert_session = $this
->assertSession();
$assert_session
->elementsCount('css', '[data-selectable].selected', 1);
$assert_session
->elementsCount('css', '[data-selectable].disabled', 0);
}