Skip to content
Snippets Groups Projects
Commit d0469464 authored by catch's avatar catch
Browse files

Issue #3418781 by sukr_s, Charles Belov, smustgrave: UI refers to "files" when...

Issue #3418781 by sukr_s, Charles Belov, smustgrave: UI refers to "files" when you can only upload one file

(cherry picked from commit f4bf71d6)
parent f77336b5
Branches
Tags
28 merge requests!122353526426-warning-for-missing,!12212Issue #3445525 by alexpott, japerry, catch, mglaman, longwave: Add BC layer...,!11958Issue #3490507 by alexpott, smustgrave: Fix bogus mocking in...,!11769Issue #3517987: Add option to contextual filters to encode slashes in query parameter.,!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9944Issue #3483353: Consider making the createCopy config action optionally fail...,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8738Issue #3424162 by camilledavis, dineshkumarbollu, smustgrave: Claro...,!8704Make greek characters available in ckeditor5,!8597Draft: Issue #3442259 by catch, quietone, dww: Reduce time of Migrate Upgrade tests...,!8533Issue #3446962 by kim.pepper: Remove incorrectly added...,!8517Issue #3443748 by NexusNovaz, smustgrave: Testcase creates false positive,!8325Update file Sort.php,!8095Expose document root on install,!7930Resolve #3427374 "Taxonomytid viewsargumentdefault plugin",!7627Issue #3439440 by nicxvan, Binoli Lalani, longwave: Remove country support from DateFormatter,!7445Issue #3440169: When using drupalGet(), provide an associative array for $headers,!7401#3271894 Fix documented StreamWrapperInterface return types for realpath() and dirname(),!7384Add constraints to system.advisories,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #129431 passed with warnings
Pipeline: drupal

#129449

    Pipeline: drupal

    #129445

      Pipeline: drupal

      #129438

        +1
        ......@@ -165,7 +165,9 @@ protected function buildInputElement(array $form, FormStateInterface $form_state
        // @todo Move validation in https://www.drupal.org/node/2988215
        '#process' => array_merge(['::validateUploadElement'], $process, ['::processUploadElement']),
        '#upload_validators' => $item->getUploadValidators(),
        '#multiple' => TRUE,
        // Set multiple to true only if available slots is not exactly one
        // to ensure correct language (singular or plural) in UI
        '#multiple' => $slots != 1 ? TRUE : FALSE,
        // Do not limit the number uploaded. There is validation based on the
        // number selected in the media library that prevents overages.
        // @see Drupal\media_library\Form\AddFormBase::updateLibrary()
        ......
        ......@@ -208,9 +208,12 @@ public function testWidgetUpload() {
        // Assert we can now only upload one more media item.
        $this->openMediaLibraryForField('field_twin_media');
        $this->switchToMediaType('Four');
        // Despite the 'One file only' text, we don't limit the number of uploads.
        $this->assertTrue($assert_session->fieldExists('Add file')->hasAttribute('multiple'));
        // We set the multiple to FALSE if only one file can be uploaded
        $this->assertFalse($assert_session->fieldExists('Add file')->hasAttribute('multiple'));
        $assert_session->pageTextContains('One file only.');
        $choose_files = $assert_session->elementExists('css', '.form-managed-file');
        $choose_files->hasButton('Choose file');
        $this->assertFalse($choose_files->hasButton('Choose files'));
        // Assert media type four should only allow jpg files by trying a png file
        // first.
        ......@@ -555,9 +558,13 @@ public function testWidgetUploadAdvancedUi() {
        // Assert we can now only upload one more media item.
        $this->openMediaLibraryForField('field_twin_media');
        $this->switchToMediaType('Four');
        // Despite the 'One file only' text, we don't limit the number of uploads.
        $this->assertTrue($assert_session->fieldExists('Add file')->hasAttribute('multiple'));
        // We set the multiple to FALSE if only one file can be uploaded
        $this->assertFalse($assert_session->fieldExists('Add file')->hasAttribute('multiple'));
        $assert_session->pageTextContains('One file only.');
        $choose_files = $assert_session->elementExists('css', '.form-managed-file');
        $choose_files->hasButton('Choose file');
        $this->assertFalse($choose_files->hasButton('Choose files'));
        // Assert media type four should only allow jpg files by trying a png file
        // first.
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment