summaryrefslogtreecommitdiffstats
path: root/apps/files/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix empty details view after renaming a fileDaniel Calviño Sánchez2018-01-111-0/+30
| | | | | | | | | | | "FileList._updateDetailsView" expects either a file name (as a string) or a file model (as an "OCA.File.FileInfoModel"), but when called through "updateInList" an "OC.Files.FileInfo" object was given instead. As the given attribute was not a model "_updateDetailsView" treated it as a file name and tried to get the model for that file, which failed and caused the details view to be emptied. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Move adding test files to "beforeEach()"Daniel Calviño Sánchez2018-01-111-13/+6
| | | | | | | | | | | | All the tests in the "Renaming files" section added the test files, although those calling "doRename()" added them by setting a path for the file too. However, the path is ignored in the other tests, so adding the files can be unified and moved to "beforeEach()". This would be needed, for example, to show the details view for a file before calling "doRename()". Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Add events for favoritesJoas Schilling2018-01-101-1/+7
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Hide favourite icon in details view if favourite action is not availableDaniel Calviño Sánchez2018-01-051-0/+29
| | | | | | | | | | | | When the favourite icon in the details view is clicked the "Favorite" action is triggered. However, if the action name given to "triggerAction" is not found then the "Download" action is triggered instead. As the "Favorite" action is not available in some file lists (like "Recents") the "Download" action was executed instead in those cases, which was a strange behaviour. Now the favourite icon is hidden if its action is not available. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Fix "fileActions.currentFile" not set before using itDaniel Calviño Sánchez2017-12-261-0/+24
| | | | | | | | | | | When an empty area of a file row was clicked and the "Details" action was executed "fileActions.currentFile" was not guaranteed to be set to the appropriate object (it depended on the previous actions of the user), so when it was used by "getCurrentMimeType()" and other FileActions functions they may not work as expected. Now it is explicitly set to the appropriate value before its use. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Merge pull request #7591 from ↵Morris Jobke2017-12-222-3/+89
|\ | | | | | | | | nextcloud/trigger-events-before-and-after-a-file-action-is-executed Trigger events before and after a file action is executed
| * Trigger events before and after a file action is executedDaniel Calviño Sánchez2017-12-192-3/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In the same way that other elements can know when a FileAction is registered or a default action is set this commit makes possible to be notified before and after a FileAction is executed. This is achieved by wrapping the registered action handler in a custom function that notifies the listeners before and after executing the handler itself. Due to this approach only FileActions registered through "registerAction" trigger the events, although that is not a problem as this is how the actions should be added to the FileActions anyway. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* | Fixed breadcrumbs testsJohn Molakvoæ (skjnldsv)2017-12-211-12/+31
|/ | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* show e2e folder icon on encrypted foldersBjoern Schiessle2017-11-201-0/+26
| | | | Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
* Add data attribute to file list rows telling if the file is encryptedDaniel Calviño Sánchez2017-11-201-5/+33
| | | | Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Merge pull request #7047 from ↵Björn Schießle2017-11-201-0/+9
|\ | | | | | | | | nextcloud/add-support-for-files-with-no-permissions Add support for files with no permissions
| * Add proper handling of files without permissionsDaniel Calviño Sánchez2017-11-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | Now a file gets its directory permissions only if it contained no permissions (they were undefined or null), but not if its permissions were set to "NONE". Besides that, now file actions that do not require any permission on the file to be performed can be used on files that have no permissions. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* | Merge pull request #7051 from nextcloud/breadcrumbs-refactorMorris Jobke2017-11-132-105/+148
|\ \ | | | | | | Breadcrumbs refactor
| * | Added more tests and only test jsunit on drone (for testing only)John Molakvoæ (skjnldsv)2017-11-131-0/+13
| | | | | | | | | | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
| * | Add menu testsJohn Molakvoæ (skjnldsv)2017-11-121-0/+54
| | | | | | | | | | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
| * | Fixed tests and width calculationJohn Molakvoæ (skjnldsv)2017-11-081-1/+1
| | | | | | | | | | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
| * | Fixed remaining testsJohn Molakvoæ (skjnldsv)2017-11-082-5/+5
| | | | | | | | | | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
| * | Fixed some more test and loop fixJohn Molakvoæ (skjnldsv)2017-11-081-2/+2
| | | | | | | | | | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
| * | Updated tests according to new systemJohn Molakvoæ (skjnldsv)2017-11-081-99/+75
| | | | | | | | | | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* | | Merge pull request #7046 from ↵Morris Jobke2017-11-091-0/+23
|\ \ \ | |/ / |/| | | | | | | | nextcloud/hide-summary-file-actions-when-selected-file-does-not-match Hide summary file actions when a selected file does not match
| * | Hide summary file actions when a selected file does not matchDaniel Calviño Sánchez2017-11-021-0/+23
| |/ | | | | | | | | | | | | | | | | | | When several files are selected and one of them can not be deleted the "Delete" file action is not shown in the summary. This commit extends that behaviour too to the other file actions in the summary ("Move or copy" and "Download"), so now an action is shown in the summary only if it can be executed on all the currently selected files. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* / Update license headersMorris Jobke2017-11-068-0/+14
|/ | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Merge pull request #6869 from burned42/6307-fix_page_title_not_changedDaniel Calviño Sánchez2017-10-271-1/+3
|\ | | | | #6307 fix page title not changed
| * bugfix: set/change page title when switching to filelistBernd Stellwag2017-10-271-1/+3
| | | | | | | | Signed-off-by: Bernd Stellwag <burned@zerties.org>
* | Use ::class in test mocks of encryption appMorris Jobke2017-10-261-2/+4
| | | | | | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* | Merge pull request #6709 from ↵Morris Jobke2017-10-253-33/+73
|\ \ | | | | | | | | | | | | nextcloud/show-checkbox-where-the-favourite-icon-is-now Show checkbox where the favourite icon is now
| * | Move checkboxes to their own columnDaniel Calviño Sánchez2017-10-191-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The selection column is not only a visual column, but also a real column of the file list table. Unlike other columns whose width is reduced in space constrained screens the selection column must stay the same so the tapping area is large enough to be easily usable The selection column does not appear in the search results table, so its contents have to be explicitly aligned with those of the main table based on whether the main table has a selection column or not (using the "has-selection" CSS class in the same way as the "has-favorite" CSS class was being used when there was a column for favorite actions). In the tests the ":visible" selector can no longer be used. That selector matches elements with a width or height that is greater than zero, but the dimensions calculated in the unit tests are not reliable; the width of the link was zero before these changes, and now moving the checkbox to its own column causes the height of the link to become zero too, so it no longer matches the ":visible" selector even if it is not hidden. As hidding and showing the link is based on its "display" CSS property its value is the one checked now. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * | Remove "has-favorites" class from file list tableDaniel Calviño Sánchez2017-10-191-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | The "has-favorites" CSS class is no longer used after moving the favorite mark to the top right corner of the thumbnail, so there is no need to add it to the table. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * | Move favorite mark to the top right corner of the thumbnailDaniel Calviño Sánchez2017-10-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The favorite icon was shown on its own "column" (not a real column in the table, but a visual column achieved through margins and left positions). Now the icon was moved to the top right corner of the file thumbnail, and the thumbnail and file name were moved to the left to fill the space left by the "column". To keep the markup in line with its visual representation (and to ease the placing through CSS), the favorite mark is no longer prepended to the row, but appended to the thumbnail instead. In the same way, the thumbnail is no longer appended to the checkbox label, but to the link with the name of the file instead (although the checkbox is still shown at the bottom right corner of the thumbnail, and clicking on the thumbnail still selects the file). In order to show the "busy" state on a file the "icon-loading-small" CSS class is set to the parent element of the thumbnail, so the thumbnail is also wrapped now by another div with the same size and position as the label. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * | Replace inline favorite action with just a favorite iconDaniel Calviño Sánchez2017-10-191-62/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a preparatory step for a following commit in which the position of the favorite icon and the checkbox will be swapped; in that new design the favorite icon is no longer expected to be an action but just a simple mark on whether the file is favorited or not (the action is expected to be triggered then only from the file actions menu). The favorite icon is now fully shown or completely hidden depending on whether the file is favorited or not. As the icon is just informative but no longer an action now it does not change when hovered or focus. In the same way, the alternative text when the file is not favorited now it is not "Favorite" (an action) but "Not favorited" instead. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * | Add "Favorite" action to the file actions menuDaniel Calviño Sánchez2017-10-191-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new FileAction for the menu is essentially the same as the old inline FileAction, except for the rendering; in this case the FileAction is shown in the menu in a standard way, so there is no need to provide a custom renderer (although the menu entry text and icon change depending on whether the file is currently a favorite or not, but that can be done just with displayName and iconClass functions). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * | Add support to FileActionsMenu for icon class functionsDaniel Calviño Sánchez2017-10-191-0/+28
| |/ | | | | | | | | | | | | | | | | | | | | | | Icon class function properties make possible to render a different icon class depending on the context of the file action. Inline file actions had support for them already and called them passing the file name and context of the file action as parameters. Due to this the FileActionsMenu passes those parameters too to icon class functions instead of just the context like done for display name functions. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* / Use ::class in test mocksMorris Jobke2017-10-242-17/+19
|/ | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Fixed testsJohn Molakvoæ (skjnldsv)2017-09-251-8/+9
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* Fix testsRoeland Jago Douma2017-09-211-0/+7
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Fix unit testsMorris Jobke2017-09-211-0/+1
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Add tests for FileListThomas Citharel2017-09-151-0/+98
| | | | Signed-off-by: Thomas Citharel <tcit@tcit.fr>
* Correctly format OCS response with favoritesRoeland Jago Douma2017-08-291-0/+31
| | | | | | | | | | The helper funtion did not handle the response correctly and basically only returned the last share with tags. This is a simple rewrite. That is still understandable. Loops maybe more than strictly required. But preformance is not the issue here. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Merge pull request #6252 from nextcloud/only_show1_errorMorris Jobke2017-08-261-0/+2
|\ | | | | Don't try the actual file upload if the checks already error out
| * Don't try the actual file upload if the checks already error outRoeland Jago Douma2017-08-261-0/+2
| | | | | | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* | Fix sorting of entries in Files sidebarJan-Christoph Borchardt2017-08-251-3/+3
|/ | | | Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
* fix testRobin Appelman2017-07-111-9/+11
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* Fix sorting of favorite filesDaniel Calviño Sánchez2017-07-051-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sort comparator checks the "isFavorite" property of the FileInfo objects to compare. That property is set when the file list is loaded and the response from the server is parsed, and thus a freshly loaded file list has the proper sorting for favorite files. However, the property is not set in other cases, like when the FileInfo objects are derived from FileInfoModels due to a file being marked as a favorite or a text editor being closed, which causes the file to be sorted in the wrong position. There is no need to add the property in those situations, though; in all cases the TagsPlugin adds a "tags" array property that contains an OC.TAG_FAVORITE tag, so that tag can be checked instead of "isFavorite". Moreover, although "isFavorite" was added by the main "_parseFileInfo" function it did not really belong there but to the "FileInfoParser" from the TagsPlugin; however, as that property now is not used anywhere it was removed altogether. A cleaner solution would have been to make the sort comparator extensible by plugins like other behaviours of the file list and then add the sorting logic related to favorite files to the TagsPlugin. However, right now only the TagsPlugin would need to alter the main sorting logic, and it seems like a corner case anyway. Even if it is implemented as a plugin, favorite files is a core feature, so for the time being it will be taken into account directly in the main sorting logic; making the sort comparator extensible by plugins is defered until there are other use cases for that. Fixes #5410 Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Adjust the unit testJoas Schilling2017-06-131-0/+8
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Make possible to know the registered detail views in a details viewDaniel Calviño Sánchez2017-06-092-0/+47
| | | | | | | | In some cases, an app may need to act on a detail view registered by another app or the core, for example, to add extra elements to the element of the detail view. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* Do not reload the filelist on first openRoeland Jago Douma2017-05-041-0/+6
| | | | | | | | | | | | | | | | Fixes: #4644 Without this patch the filelist would always reload. However since not all the correct data was set yet it would often: 1. fireoff a propfind to ../webdav/ 2. fireoff a propfind to ../webdav/<PATH> When just opening the file list those are the same so the result is just fine. However if opening a direct link it means that there is a race condition on which finishes first. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Reload file list when leaving hidden stateVincent Petry2017-04-261-0/+6
| | | | | | | | Whenever a file list is already initialized and was hidden when switching to another file list in the navigation bar, if the user comes back to this list it gets redisplayed. At this point the list needs to be refreshed to be able to reflect any potential file changes done from the other lists.
* Merge pull request #4458 from nextcloud/fix/sinon-stub-deprecation-warningsRoeland Jago Douma2017-04-241-1/+1
|\ | | | | Fix sinon.stub deprecation warnings
| * Fix sinon.stub deprecation warningsChristoph Wurst2017-04-241-1/+1
| | | | | | | | | | | | | | | | | | | | Calls to `sinon.stub(obj, 'meth', fn)` are deprecated and therefore replaced by `sinon.stub(obj, 'meth).callsFake(fn)` as instructed by the deprecation warning. This makes the js unit testing output readable again. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* | Remove unused use statementsMorris Jobke2017-04-221-2/+0
|/ | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>