summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-17 19:39:01 +0200
committerMorris Jobke <hey@morrisjobke.de>2018-07-20 23:38:04 +0200
commit8d3f58c3917018a859917af377b8954910a3ba6e (patch)
tree002f775f6bd57514dfef4b97d58a638e67eff363 /apps/files
parent43ab2082db0db30fd31e9597ed895e0cf3febe47 (diff)
downloadnextcloud-server-8d3f58c3917018a859917af377b8954910a3ba6e.tar.gz
nextcloud-server-8d3f58c3917018a859917af377b8954910a3ba6e.zip
Jsunit fixes 1
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/detailsview.js7
-rw-r--r--apps/files/tests/js/favoritespluginspec.js2
-rw-r--r--apps/files/tests/js/filelistSpec.js5
3 files changed, 10 insertions, 4 deletions
diff --git a/apps/files/js/detailsview.js b/apps/files/js/detailsview.js
index 1d33987cd59..ac10b8380ef 100644
--- a/apps/files/js/detailsview.js
+++ b/apps/files/js/detailsview.js
@@ -118,8 +118,11 @@
*/
render: function() {
// remove old instances
- $('#app-sidebar').remove();
- this.$el.insertAfter($('#app-content'));
+ if ($('#app-sidebar').length === 0) {
+ this.$el.insertAfter($('#app-content'));
+ } else {
+ $('#app-sidebar').replaceWith(this.$el)
+ }
var templateVars = {
closeLabel: t('files', 'Close')
diff --git a/apps/files/tests/js/favoritespluginspec.js b/apps/files/tests/js/favoritespluginspec.js
index 1b144c28707..bc4ec5b9fca 100644
--- a/apps/files/tests/js/favoritespluginspec.js
+++ b/apps/files/tests/js/favoritespluginspec.js
@@ -14,6 +14,7 @@ describe('OCA.Files.FavoritesPlugin tests', function() {
beforeEach(function() {
$('#testArea').append(
+ '<div id="content">' +
'<div id="app-navigation">' +
'<ul><li data-id="files"><a>Files</a></li>' +
'<li data-id="sharingin"><a></a></li>' +
@@ -25,6 +26,7 @@ describe('OCA.Files.FavoritesPlugin tests', function() {
'<div id="app-content-favorites" class="hidden">' +
'</div>' +
'</div>' +
+ '</div>' +
'</div>'
);
OC.Plugins.attach('OCA.Files.App', Plugin);
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index efaf9968def..1261e468afa 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -2491,7 +2491,8 @@ describe('OCA.Files.FileList tests', function() {
expect($('#app-sidebar').hasClass('disappear')).toEqual(false);
fileList.remove('One.txt');
- expect($('#app-sidebar').hasClass('disappear')).toEqual(true);
+ // sidebar is removed on close before being
+ expect($('#app-sidebar').length).toEqual(0);
jQuery.fx.off = false;
});
it('returns the currently selected model instance when calling getModelForFile', function() {
@@ -2515,7 +2516,7 @@ describe('OCA.Files.FileList tests', function() {
expect($('#app-sidebar').hasClass('disappear')).toEqual(false);
fileList.changeDirectory('/another');
- expect($('#app-sidebar').hasClass('disappear')).toEqual(true);
+ expect($('#app-sidebar').length).toEqual(0);
jQuery.fx.off = false;
});
});