summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-08-30 17:14:57 +0200
committerVincent Petry <pvince81@owncloud.com>2015-08-30 17:14:57 +0200
commita808837ec9143df3c7f000f150c1f1c6420ad535 (patch)
treea206a755d2ac006d17d3c8e8a08be906e48b95c5
parent045f8cc97101521cafd664faf7b8f24ea9e88451 (diff)
downloadnextcloud-server-a808837ec9143df3c7f000f150c1f1c6420ad535.tar.gz
nextcloud-server-a808837ec9143df3c7f000f150c1f1c6420ad535.zip
Add apps unit test
-rw-r--r--core/js/tests/specs/appsSpec.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/core/js/tests/specs/appsSpec.js b/core/js/tests/specs/appsSpec.js
new file mode 100644
index 00000000000..536d41c7f10
--- /dev/null
+++ b/core/js/tests/specs/appsSpec.js
@@ -0,0 +1,48 @@
+/**
+* ownCloud
+*
+* @author Vincent Petry
+* @copyright 2015 Vincent Petry <pvince81@owncloud.com>
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+describe('Apps base tests', function() {
+ describe('Sidebar utility functions', function() {
+ beforeEach(function() {
+ $('#testArea').append('<div id="app-content">Content</div><div id="app-sidebar">The sidebar</div>');
+ });
+ it('shows sidebar', function() {
+ var $el = $('#app-sidebar');
+ OC.Apps.showAppSidebar();
+ expect($el.hasClass('disappear')).toEqual(false);
+ });
+ it('hides sidebar', function() {
+ var $el = $('#app-sidebar');
+ OC.Apps.showAppSidebar();
+ OC.Apps.hideAppSidebar();
+ expect($el.hasClass('disappear')).toEqual(true);
+ });
+ it('triggers appresize event when visibility changed', function() {
+ var eventStub = sinon.stub();
+ $('#app-content').on('appresized', eventStub);
+ OC.Apps.showAppSidebar();
+ expect(eventStub.calledOnce).toEqual(true);
+ OC.Apps.hideAppSidebar();
+ expect(eventStub.calledTwice).toEqual(true);
+ });
+ });
+});
+