summaryrefslogtreecommitdiffstats
path: root/apps/files/tests/js
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-02-19 20:42:29 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-03-01 20:33:14 +0100
commit61bd3631d94ad1b764fe04a74a8fbc1552e0133b (patch)
tree38b6b442682aee7c7936e76af7b37c6a6c2a66dd /apps/files/tests/js
parenta2672a2ad8335d41c76b10a5f21d21f3b723ecea (diff)
downloadnextcloud-server-61bd3631d94ad1b764fe04a74a8fbc1552e0133b.tar.gz
nextcloud-server-61bd3631d94ad1b764fe04a74a8fbc1552e0133b.zip
Set the width of the parent element in breadcrumb tests
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>
Diffstat (limited to 'apps/files/tests/js')
-rw-r--r--apps/files/tests/js/breadcrumbSpec.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/files/tests/js/breadcrumbSpec.js b/apps/files/tests/js/breadcrumbSpec.js
index 5ec5ad2d6e8..d30d9c48e24 100644
--- a/apps/files/tests/js/breadcrumbSpec.js
+++ b/apps/files/tests/js/breadcrumbSpec.js
@@ -188,7 +188,7 @@ describe('OCA.Files.BreadCrumb tests', function() {
$('#controls').append(bc.$el);
// Shrink to show popovermenu
- bc.setMaxWidth(300);
+ $('#controls').width(300);
// triggers resize implicitly
bc.setDirectory(dummyDir);
@@ -265,10 +265,11 @@ describe('OCA.Files.BreadCrumb tests', function() {
afterEach(function() {
bc = null;
});
- it('Hides breadcrumbs to fit max allowed width', function() {
+ it('Hides breadcrumbs to fit available width', function() {
var $crumbs;
- bc.setMaxWidth(500);
+ $('#controls').width(500);
+ bc._resize();
$crumbs = bc.$el.find('.crumb');
@@ -283,10 +284,11 @@ describe('OCA.Files.BreadCrumb tests', function() {
expect($crumbs.eq(6).hasClass('hidden')).toEqual(true);
expect($crumbs.eq(7).hasClass('hidden')).toEqual(false);
});
- it('Hides breadcrumbs to fit max allowed width', function() {
+ it('Hides breadcrumbs to fit available width', function() {
var $crumbs;
- bc.setMaxWidth(700);
+ $('#controls').width(700);
+ bc._resize();
$crumbs = bc.$el.find('.crumb');
@@ -301,11 +303,13 @@ describe('OCA.Files.BreadCrumb tests', function() {
expect($crumbs.eq(6).hasClass('hidden')).toEqual(false);
expect($crumbs.eq(7).hasClass('hidden')).toEqual(false);
});
- it('Updates the breadcrumbs when reducing max allowed width', function() {
+ it('Updates the breadcrumbs when reducing available width', function() {
var $crumbs;
// enough space
- bc.setMaxWidth(1800);
+ $('#controls').width(1800);
+ bc._resize();
+
$crumbs = bc.$el.find('.crumb');
// Menu is hidden
@@ -315,7 +319,8 @@ describe('OCA.Files.BreadCrumb tests', function() {
bc.setDirectory(dummyDir);
// simulate decrease
- bc.setMaxWidth(950);
+ $('#controls').width(950);
+ bc._resize();
// Menu and home are always visible
expect($crumbs.eq(0).hasClass('hidden')).toEqual(false);