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.

appSpec.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @copyright 2014 Vincent Petry <pvince81@owncloud.com>
  3. *
  4. * @author Vincent Petry <vincent@nextcloud.com>
  5. *
  6. * @license AGPL-3.0-or-later
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. describe('OCA.Trashbin.App tests', function() {
  23. var App = OCA.Trashbin.App;
  24. beforeEach(function() {
  25. $('#testArea').append(
  26. '<div id="app-navigation">' +
  27. '<ul><li data-id="files"><a>Files</a></li>' +
  28. '<li data-id="trashbin"><a>Trashbin</a></li>' +
  29. '</div>' +
  30. '<div id="app-content">' +
  31. '<div id="app-content-files" class="hidden">' +
  32. '</div>' +
  33. '<div id="app-content-trashbin" class="hidden">' +
  34. '</div>' +
  35. '</div>' +
  36. '</div>'
  37. );
  38. App.initialize($('#app-content-trashbin'));
  39. });
  40. afterEach(function() {
  41. App._initialized = false;
  42. App.fileList = null;
  43. });
  44. describe('initialization', function() {
  45. it('creates a custom filelist instance', function() {
  46. App.initialize();
  47. expect(App.fileList).toBeDefined();
  48. expect(App.fileList.$el.is('#app-content-trashbin')).toEqual(true);
  49. });
  50. it('registers custom file actions', function() {
  51. var fileActions;
  52. App.initialize();
  53. fileActions = App.fileList.fileActions;
  54. expect(fileActions.actions.all).toBeDefined();
  55. expect(fileActions.actions.all.Restore).toBeDefined();
  56. expect(fileActions.actions.all.Delete).toBeDefined();
  57. expect(fileActions.actions.all.Rename).not.toBeDefined();
  58. expect(fileActions.actions.all.Download).not.toBeDefined();
  59. expect(fileActions.defaults.dir).toEqual('Open');
  60. });
  61. });
  62. });