aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-05 10:24:48 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-05 10:24:48 +0200
commit28919faff5204a2f7004ccc4d37d442c56db6555 (patch)
tree89489200d04be66affbef56cf9316bddb177cd6d /apps
parent681ab05e4df38aa0cf60efb5b8bd18973774d975 (diff)
parent6bf6ff9564640190413d255ed28181f3d9880ea3 (diff)
downloadnextcloud-server-28919faff5204a2f7004ccc4d37d442c56db6555.tar.gz
nextcloud-server-28919faff5204a2f7004ccc4d37d442c56db6555.zip
Merge pull request #19552 from owncloud/inline_fileactions_alttext
If an inline files action provides an alt text show it
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/fileactions.js3
-rw-r--r--apps/files/tests/js/fileactionsSpec.js56
2 files changed, 58 insertions, 1 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index bde0b094b87..079c5330ec2 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -144,7 +144,8 @@
order: action.order || 0,
icon: action.icon,
permissions: action.permissions,
- type: action.type || FileActions.TYPE_DROPDOWN
+ type: action.type || FileActions.TYPE_DROPDOWN,
+ altText: action.altText || ''
};
if (_.isUndefined(action.displayName)) {
actionSpec.displayName = t('files', name);
diff --git a/apps/files/tests/js/fileactionsSpec.js b/apps/files/tests/js/fileactionsSpec.js
index 1254843e66a..6a57c56c3af 100644
--- a/apps/files/tests/js/fileactionsSpec.js
+++ b/apps/files/tests/js/fileactionsSpec.js
@@ -151,6 +151,62 @@ describe('OCA.Files.FileActions tests', function() {
expect($tr.find('.action.action-match').length).toEqual(1);
expect($tr.find('.action.action-nomatch').length).toEqual(0);
});
+ it('display inline icon', function() {
+ fileActions.registerAction({
+ name: 'Icon',
+ displayName: 'IconDisplay',
+ type: OCA.Files.FileActions.TYPE_INLINE,
+ mime: 'all',
+ icon: OC.imagePath('core', 'actions/icon'),
+ permissions: OC.PERMISSION_READ
+ });
+ fileActions.registerAction({
+ name: 'NoIcon',
+ displayName: 'NoIconDisplay',
+ type: OCA.Files.FileActions.TYPE_INLINE,
+ mime: 'all',
+ permissions: OC.PERMISSION_READ
+ });
+
+ fileActions.display($tr.find('td.filename'), true, fileList);
+
+ expect($tr.find('.action.action-icon').length).toEqual(1);
+ expect($tr.find('.action.action-icon').find('img').length).toEqual(1);
+ expect($tr.find('.action.action-icon').find('img').eq(0).attr('src')).toEqual(OC.imagePath('core', 'actions/icon'));
+
+ expect($tr.find('.action.action-noicon').length).toEqual(1);
+ expect($tr.find('.action.action-noicon').find('img').length).toEqual(0);
+ });
+ it('display alt text on inline icon', function() {
+ fileActions.registerAction({
+ name: 'IconAltText',
+ displayName: 'IconAltTextDisplay',
+ type: OCA.Files.FileActions.TYPE_INLINE,
+ mime: 'all',
+ icon: OC.imagePath('core', 'actions/iconAltText'),
+ altText: 'alt icon text',
+ permissions: OC.PERMISSION_READ
+ });
+
+ fileActions.registerAction({
+ name: 'IconNoAltText',
+ displayName: 'IconNoAltTextDisplay',
+ type: OCA.Files.FileActions.TYPE_INLINE,
+ mime: 'all',
+ icon: OC.imagePath('core', 'actions/iconNoAltText'),
+ permissions: OC.PERMISSION_READ
+ });
+
+ fileActions.display($tr.find('td.filename'), true, fileList);
+
+ expect($tr.find('.action.action-iconalttext').length).toEqual(1);
+ expect($tr.find('.action.action-iconalttext').find('img').length).toEqual(1);
+ expect($tr.find('.action.action-iconalttext').find('img').eq(0).attr('alt')).toEqual('alt icon text');
+
+ expect($tr.find('.action.action-iconnoalttext').length).toEqual(1);
+ expect($tr.find('.action.action-iconnoalttext').find('img').length).toEqual(1);
+ expect($tr.find('.action.action-iconnoalttext').find('img').eq(0).attr('alt')).toEqual('');
+ });
});
describe('action handler', function() {
var actionStub, $tr, clock;