forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-80689 filepicker: better reporting of incorrect file type
Before this change, file type errors were reported like system errors. Now, they are reported in a plain dialoue, which is more like how it works for drag-drop upload. Also, before this, after an upload errors, you were left with a blank filepicker dialogue. Now, the upload form is redisplayed.
- Loading branch information
Showing
2 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@core @core_filepicker @_file_upload | ||
Feature: File type can be validated on upload | ||
While uploading files | ||
As a user | ||
I want the file type to be validated to save me from errors | ||
|
||
@javascript | ||
Scenario: File-picker does not break if you upload the wrong file type | ||
Given I am on the "filemanager_hideif_disabledif_form" "core_form > Fixture" page logged in as "admin" | ||
When I click on "Add..." "link" | ||
And I select "Upload a file" repository in file picker | ||
And I set the field "Attachment" to "#dirroot#/lib/form/tests/fixtures/filemanager_hideif_disabledif_form.php" | ||
And I click on "Upload this file" "button" in the "File picker" "dialogue" | ||
Then I should see "Text file filetype cannot be accepted." in the "Error" "dialogue" | ||
And I click on "OK" "button" in the "Error" "dialogue" | ||
And I should see "Attachment" in the "File picker" "dialogue" | ||
And "Upload this file" "button" in the "File picker" "dialogue" should be visible |