appSpec.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * ownCloud
  3. *
  4. * @author Vincent Petry
  5. * @copyright 2014 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('OCA.Trashbin.App tests', function() {
  22. var App = OCA.Trashbin.App;
  23. beforeEach(function() {
  24. $('#testArea').append(
  25. '<div id="app-navigation">' +
  26. '<ul><li data-id="files"><a>Files</a></li>' +
  27. '<li data-id="trashbin"><a>Trashbin</a></li>' +
  28. '</div>' +
  29. '<div id="app-content">' +
  30. '<div id="app-content-files" class="hidden">' +
  31. '</div>' +
  32. '<div id="app-content-trashbin" class="hidden">' +
  33. '</div>' +
  34. '</div>' +
  35. '</div>'
  36. );
  37. App.initialize($('#app-content-trashbin'));
  38. });
  39. afterEach(function() {
  40. App._initialized = false;
  41. App.fileList = null;
  42. });
  43. describe('initialization', function() {
  44. it('creates a custom filelist instance', function() {
  45. App.initialize();
  46. expect(App.fileList).toBeDefined();
  47. expect(App.fileList.$el.is('#app-content-trashbin')).toEqual(true);
  48. });
  49. it('registers custom file actions', function() {
  50. var fileActions;
  51. App.initialize();
  52. fileActions = App.fileList.fileActions;
  53. expect(fileActions.actions.all).toBeDefined();
  54. expect(fileActions.actions.all.Restore).toBeDefined();
  55. expect(fileActions.actions.all.Delete).toBeDefined();
  56. expect(fileActions.actions.all.Rename).not.toBeDefined();
  57. expect(fileActions.actions.all.Download).not.toBeDefined();
  58. expect(fileActions.defaults.dir).toEqual('Open');
  59. });
  60. });
  61. });