You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

appsSpec.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * ownCloud
  3. *
  4. * @author Vincent Petry
  5. * @copyright 2015 Vincent Petry <pvince81@owncloud.com>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  9. * License as published by the Free Software Foundation; either
  10. * version 3 of the License, or any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public
  18. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. describe('Apps base tests', function() {
  22. describe('Sidebar utility functions', function() {
  23. beforeEach(function() {
  24. $('#testArea').append('<div id="content"><div id="app-content">Content</div><div id="app-sidebar">The sidebar</div></div>');
  25. jQuery.fx.off = true;
  26. });
  27. afterEach(function() {
  28. jQuery.fx.off = false;
  29. });
  30. it('shows sidebar', function() {
  31. var $el = $('#app-sidebar');
  32. OC.Apps.showAppSidebar();
  33. expect($el.hasClass('disappear')).toEqual(false);
  34. });
  35. it('hides sidebar', function() {
  36. var $el = $('#app-sidebar');
  37. OC.Apps.showAppSidebar();
  38. OC.Apps.hideAppSidebar();
  39. expect($el.hasClass('disappear')).toEqual(true);
  40. });
  41. it('triggers appresize event when visibility changed', function() {
  42. var eventStub = sinon.stub();
  43. $('#content').on('appresized', eventStub);
  44. OC.Apps.showAppSidebar();
  45. expect(eventStub.calledOnce).toEqual(true);
  46. OC.Apps.hideAppSidebar();
  47. expect(eventStub.calledTwice).toEqual(true);
  48. });
  49. });
  50. });