summaryrefslogtreecommitdiffstats
path: root/apps/files/tests/js/breadcrumbSpec.js
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Fixed breadcrumbs testsJohn Molakvoæ (skjnldsv)2017-12-211-12/+31
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* 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-081-1/+1
| | | | 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>
* Parse backslash as directory separator in breadcrumbLukas Reschke2015-01-241-0/+25
| | | | | | This will parse backslashes as directory separators in breadcrumbs. Thus when accessing something like `/index.php/apps/files?dir=foo\foo` the breadcrumb will properly resolve this instead of showing `foo\foo` Fixes https://github.com/owncloud/core/issues/13643
* Breadcrumb width calculation fixVincent Petry2014-06-271-42/+37
| | | | | | | | | | | | | | Rewrote the breadcrumb calculation to be more readable. Breadcrumb now has a setMaxWidth() method to set the maximum allowed width which is used to fit the breadcrumbs. The breadcrumb width is now based on the container width, passed through setMaxWidth() by the FileList class. Now using fixed widths for the test crumbs to simulate consistent widths across browsers which rendering engines might usually yield different results.
* Namespacing for FileList, FileActions and trashbin appVincent Petry2014-05-151-1/+3
| | | | | | | | | | | | | | | | | - FileList is now an instantiable class - FileActions is now in namespace - added App class for trashbin app - moved trashbin overrides into classes extending FileList - replaced many static calls with "this." or "self." to make the classes reusable/extendable - new URL parameter "view" to specify which view is shown, for example "files" or "trashbin" - added OC.Util.History utility class in core for handling history - moved URL handling/routing to OCA.Files.App - popstate will correctly update the current view and notify the view of the URL change so it can update the current dir - added JS unitt tests for the trashbin app - fixed public app to work with the new namespaces
* Files, trashbin, public apps use ajax/JSON for the file listVincent Petry2014-04-021-0/+248
Files app: - removed file list template, now rendering list from JSON response - FileList.addFile/addDir is now FileList.add() and takes a JS map with all required arguments instead of having a long number of function arguments - added unit tests for many FileList operations - fixed newfile.php, newfolder.php and rename.php to return the file's full JSON on success - removed obsolete/unused undo code - removed download_url / loading options, now using Files.getDownloadUrl() for that - server side now uses Helper::getFileInfo() to prepare file JSON response - previews are now client-side only Breadcrumbs are now JS only: - Added BreadCrumb class to handle breadcrumb rendering and events - Added unit test for BreadCrumb class - Moved all relevant JS functions to the BreadCrumb class Public page now uses ajax to load the file list: - Added Helper class in sharing app to make it easier to authenticate and retrieve the file's real path - Added ajax/list.php to retrieve the file list - Fixed FileActions and FileList to work with the ajax list Core: - Fixed file picker dialog to use the same list format as files app