diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-02-28 15:53:00 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-03-01 22:33:14 +0300 |
commit | e33a9693f7ae93739fd5cdc65644caa98ad22822 (patch) | |
tree | 8bb946ac3540938a97c20b77dd5be9b17b4c65d9 /apps | |
parent | 83b50690a854a1fac9f9df885008100cb526df6c (diff) |
Fix setup to test the breadcrumbs menu
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>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/tests/js/breadcrumbSpec.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/apps/files/tests/js/breadcrumbSpec.js b/apps/files/tests/js/breadcrumbSpec.js index ea912cc9fa9..3d154f12edd 100644 --- a/apps/files/tests/js/breadcrumbSpec.js +++ b/apps/files/tests/js/breadcrumbSpec.js @@ -175,10 +175,6 @@ describe('OCA.Files.BreadCrumb tests', function() { beforeEach(function() { dummyDir = '/one/two/three/four/five' - $('div.crumb').each(function(index){ - $(this).css('width', 50); - }); - bc = new BreadCrumb(); // append dummy navigation and controls // as they are currently used for measurements @@ -187,11 +183,22 @@ describe('OCA.Files.BreadCrumb tests', function() { ); $('#controls').append(bc.$el); + bc.setDirectory(dummyDir); + + $('div.crumb').each(function(index){ + $(this).css('width', 50); + $(this).css('padding', 0); + $(this).css('margin', 0); + }); + $('div.crumbhome').css('width', 51); + $('div.crumbmenu').css('width', 51); + + $('#controls').width(1000); + bc._resize(); + // Shrink to show popovermenu $('#controls').width(300); - - // triggers resize implicitly - bc.setDirectory(dummyDir); + bc._resize(); $crumbmenuLink = bc.$el.find('.crumbmenu > a'); $popovermenu = $crumbmenuLink.next('.popovermenu'); |