aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #8588 from nextcloud/fix-breadcrumbs-width-calculationRoeland Jago Douma2018-03-011-21/+381
|\ | | | | Fix breadcrumbs width calculation
| * Update comments in testsDaniel Calviño Sánchez2018-02-281-3/+4
| | | | | | | | | | | | | | Menu and home are not always visible; home is always visible, but menu is shown only when needed. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * Fix menu visibilityDaniel Calviño Sánchez2018-02-281-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The crumb for the menu was shown like any other crumb when calling "_showCrumb", but it was also shown when other crumbs were hidden without taking into account the available width. This caused several related problems, like the breadcrumbs taking too much space when the menu was sometimes shown after the rest of the crumbs were adjusted to the available width, or the menu being shown instead of the last crumb even if there was room for it when the available width was increased. Now the menu is always hidden before starting the resizing of the crumbs to ensure that whether it was previously shown or not does not affect the result. In a similar way, the menu will no longer be shown by "_showCrumb", as it is not a regular crumb that has to be shown simply if there is enough room. The menu is now shown as soon as any other crumb is hidden; this ensures that the menu width will be taken into account in further width checks. As when _updateMenu" is called it no longer needs to take care of showing the menu this fixes the issue revealed when fixing the test setup in the previous commit. Finally, this implicitly fixes the failure in the breadcrumbs tests when run on Firefox, as it was caused by the menu interfering in the calculations of the other crumbs when increasing the width. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * Fix setup to test the breadcrumbs menuDaniel Calviño Sánchez2018-02-281-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "Shows only items not in the breadcrumb" test was failing when run on Firefox, but not on PhantomJS. This was caused by the differences in the starting width between both browsers and an incorrect setup of the test (the width set for the crumbs was overriden when the breadcrumbs were rendered again, and the breadcrumb was resized to 300 from an indeterminate initial width). Now the crumbs are rendered and then its width, padding and margin are set to a known value. Then it is resized to 1000px, which ensures that there will be enough room for all the crumbs and thus the menu will be hidden, and finally it is resized to 300, which causes the middle crumb to be hidden and the menu to be shown. Note, however, that the test now always fails, no matter if it is run on PhantomJS or on Firefox; if the menu crumb is hidden when "_updateMenu" is called it will show it, but it will also wrongly try to add the menu itself to the menu. As the "crumb-id" of the menu crumb is "-1" this causes the last regular crumb to be added to the menu. This will be fixed with other related issues in the next commit. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * Take padding and margins of crumbs into accountDaniel Calviño Sánchez2018-02-281-0/+54
| | | | | | | | | | | | | | | | | | When calculating the total width of the crumbs only its padding was taken into account; now the margin is too. In a similar way, before showing a crumb only its width was taken into account; now its padding and margin are taken into account too. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * Use hard-coded values for paddings and marginsDaniel Calviño Sánchez2018-02-281-1/+7
| | | | | | | | | | | | | | | | | | | | | | This ensures that the resize tests do not depend on the values set in the CSS files. Note that this change causes a test to fail with Firefox, but not with PhantomJS. This is due to a difference in the starting width used by Firefox and by PhantomJS, and it will be fixed in a following commit. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * Compress siblings before calculating the available width for crumbsDaniel Calviño Sánchez2018-02-281-0/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the parent element of the breadcrumbs was resized to a larger width and the siblings of the breadcrumbs expanded to fill all the available width some crumbs could be hidden even if there was enough room for them. The reason was that the width of the siblings being used to calculate the available width for the breadcrumbs was the expanded width of the siblings. Now as many crumbs as possible (that is, fitting in the parent, no matter the siblings) are first shown so the expanding siblings are compressed before calculating the available width. Due to the lack of support for flexboxes in PhantomJS the related unit test is skipped; it has to be run in other browser, like Firefox. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * Take all visible siblings into accountDaniel Calviño Sánchez2018-02-281-4/+50
| | | | | | | | | | | | | | | | | | Other apps could add elements to the controls outside the creatable actions div (for example, the button to switch to the gallery), so the widths of all the visible siblings of the breadcrumbs have to be taken into account in the size calculations. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * Take padding and margin of the creatable actions div into accountDaniel Calviño Sánchez2018-02-281-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are some differences in width handling between the browsers used to run the tests, most likely due to their support (or lack of) of certain CSS features: PhantomJS requires "width" to be set (probably because it does not handle flex displays and treats it like a block, so "min-width" does not matter in this case), while Firefox requires "min-width" to be set (otherwise the children of "#controls" could be compressed due to its use of flex display and the elements would end with a different width than the one needed for the tests). Due to all that the width of the breadcrumb siblings must be specified in the tests using both "width" and "min-width". Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * Do not render the breadcrumbs again in resize testsDaniel Calviño Sánchez2018-02-281-3/+0
| | | | | | | | | | | | | | | | There is no need to call "setDirectory" again in resize tests; it is enough to simply resize them (and isolates them better to just test the resizing behaviour). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
| * Set the width of the parent element in breadcrumb testsDaniel Calviño Sánchez2018-02-281-8/+13
| | | | | | | | | | | | | | | | | | Setting the width of the parent element of the breadcrumbs and then explicitly calling "_resize" is enough to test the resizing behaviour. This makes possible to remove the "setMaxWidth" method and its related code, which was used only for testing purposes. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* | Fix unit testJoas Schilling2018-02-281-0/+6
|/ | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Split move and copy operationsRoland Tapken2018-02-152-1/+11
| | | | | | | | | | | | | | | The new 'Move and copy' operation from #6040 requires UPDATE permissions on the selected files. However, READ would be sufficient to create a copy of a file (if not viewed as a public share). For this reason this patch: - changes the permission of the 'MoveCopy' action to PERMISSION_READ - changes the label of the action depending on the permissions - changes the available buttons in the Move/Copy dialog depending on the permissions. The same changes are done to the filelist view for bulk actions. Signed-off-by: Roland Tapken <roland@bitarbeiter.net>
* 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>