diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-09-28 11:19:49 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-28 11:19:49 +0200 |
commit | f35b6833ff2f702db75999bfd9343e7bc2fc7f2c (patch) | |
tree | fd2ab1a1f958d4c8208abcbe57405d111de598d9 /apps/files/tests | |
parent | 9a010cc8ce281650038cd1444f63a02245eea523 (diff) | |
download | nextcloud-server-f35b6833ff2f702db75999bfd9343e7bc2fc7f2c.tar.gz nextcloud-server-f35b6833ff2f702db75999bfd9343e7bc2fc7f2c.zip |
Fix order of actions in the files actions menu
Diffstat (limited to 'apps/files/tests')
-rw-r--r-- | apps/files/tests/js/fileactionsmenuSpec.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/apps/files/tests/js/fileactionsmenuSpec.js b/apps/files/tests/js/fileactionsmenuSpec.js index 0cfd12a2d04..dee542458b6 100644 --- a/apps/files/tests/js/fileactionsmenuSpec.js +++ b/apps/files/tests/js/fileactionsmenuSpec.js @@ -152,6 +152,43 @@ describe('OCA.Files.FileActionsMenu tests', function() { expect(menu.$el.find('a[data-action=Match]').length).toEqual(1); expect(menu.$el.find('a[data-action=NoMatch]').length).toEqual(0); }); + it('sorts by order attribute, then name', function() { + fileActions.registerAction({ + name: 'Baction', + displayName: 'Baction', + order: 2, + mime: 'text/plain', + permissions: OC.PERMISSION_ALL + }); + fileActions.registerAction({ + name: 'Zaction', + displayName: 'Zaction', + order: 1, + mime: 'text/plain', + permissions: OC.PERMISSION_ALL + }); + fileActions.registerAction({ + name: 'Yaction', + displayName: 'Yaction', + mime: 'text/plain', + permissions: OC.PERMISSION_ALL + }); + fileActions.registerAction({ + name: 'Waction', + displayName: 'Waction', + mime: 'text/plain', + permissions: OC.PERMISSION_ALL + }); + + menu.render(); + var zactionIndex = menu.$el.find('a[data-action=Zaction]').closest('li').index(); + var bactionIndex = menu.$el.find('a[data-action=Baction]').closest('li').index(); + expect(zactionIndex).toBeLessThan(bactionIndex); + + var wactionIndex = menu.$el.find('a[data-action=Waction]').closest('li').index(); + var yactionIndex = menu.$el.find('a[data-action=Yaction]').closest('li').index(); + expect(wactionIndex).toBeLessThan(yactionIndex); + }); }); describe('action handler', function() { |