You are here

public function ClipboardSourceTest::testClipboardSourceEnabled in FileField Sources 8

Tests clipboard source enabled.

File

tests/src/Functional/ClipboardSourceTest.php, line 15

Class

ClipboardSourceTest
Tests the clipboard source.

Namespace

Drupal\Tests\filefield_sources\Functional

Code

public function testClipboardSourceEnabled() {
  $this
    ->enableSources([
    'clipboard' => TRUE,
  ]);
  $file = $this
    ->createTemporaryFileEntity();
  $this
    ->uploadFileByClipboardSource($file
    ->getFileUri(), $file
    ->getFilename(), 0);

  // We can only upload one file on single value field.
  $this
    ->assertNoFieldByXPath('//input[@type="submit"]', t('Upload'), t('After uploading a file, "Upload" button is no longer displayed.'));
  $this
    ->removeFile($file
    ->getFilename(), 0);

  // Can upload file again.
  $this
    ->assertFieldByXpath('//input[@type="submit"]', t('Upload'), 'After clicking the "Remove" button, the "Upload" button is displayed.');
}