summaryrefslogtreecommitdiffstats
path: root/apps/files/tests
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-02-28 15:03:26 +0100
commita9552de089b7d587ffa94b79560436a1f65c2ea8 (patch)
tree627d860f858f15afb2449d23ff65523e6714e4f9 /apps/files/tests
parent0cfdf4748f248e1b55fc459a05e7782a1e585716 (diff)
downloadnextcloud-server-a9552de089b7d587ffa94b79560436a1f65c2ea8.tar.gz
nextcloud-server-a9552de089b7d587ffa94b79560436a1f65c2ea8.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')
-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);