summaryrefslogtreecommitdiffstats
path: root/core/js/tests
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2017-11-27 16:46:11 +0100
committerGitHub <noreply@github.com>2017-11-27 16:46:11 +0100
commitf700cd14fa4f094b7822edcf2e1a74b7f44ae32b (patch)
treedf62e15e70eee968b6863b441ffa08efdd22636e /core/js/tests
parent4a63727ed989818eaca85dea113e8e0b075b1c07 (diff)
parent134192d76cf27bee9549710a1eac40db3ef1edf1 (diff)
downloadnextcloud-server-f700cd14fa4f094b7822edcf2e1a74b7f44ae32b.tar.gz
nextcloud-server-f700cd14fa4f094b7822edcf2e1a74b7f44ae32b.zip
Merge pull request #7222 from nextcloud/fix-filerow-avatars
Fix filerow avatars
Diffstat (limited to 'core/js/tests')
-rw-r--r--core/js/tests/specs/shareSpec.js147
1 files changed, 135 insertions, 12 deletions
diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js
index 70c698c99a2..05057692e98 100644
--- a/core/js/tests/specs/shareSpec.js
+++ b/core/js/tests/specs/shareSpec.js
@@ -45,6 +45,7 @@ describe('OC.Share tests', function() {
var $action;
$file.attr('data-share-owner', input);
+ $file.attr('data-share-owner-id', input);
OC.Share.markFileAsShared($file);
$action = $file.find('.action-share>span').parent();
@@ -119,6 +120,7 @@ describe('OC.Share tests', function() {
it('shows a shared folder icon for folders shared with the current user', function() {
$file.attr('data-type', 'dir');
$file.attr('data-share-owner', 'someoneelse');
+ $file.attr('data-share-owner-id', 'someoneelse');
OC.Share.markFileAsShared($file);
checkIcon('filetypes/folder-shared');
@@ -155,7 +157,7 @@ describe('OC.Share tests', function() {
function checkRecipients(input, output, title) {
var $action;
- $file.attr('data-share-recipients', input);
+ $file.attr('data-share-recipient-data', JSON.stringify(input));
OC.Share.markFileAsShared($file, true);
$action = $file.find('.action-share>span').parent();
@@ -177,66 +179,187 @@ describe('OC.Share tests', function() {
}
it('displays the local share owner as is', function() {
- checkRecipients('User One', 'Shared with User One', null);
+ var input = {
+ 0: {
+ shareWith: 'User One',
+ shareWithDisplayName: 'User One'
+ }
+ };
+ checkRecipients(input, 'Shared with User One', null);
});
it('displays the user name part of a remote recipient', function() {
+ var input = {
+ 0: {
+ shareWith: 'User One@someserver.com',
+ shareWithDisplayName: 'User One@someserver.com'
+ }
+ };
checkRecipients(
- 'User One@someserver.com',
+ input,
'User One@…',
'Shared with User One@someserver.com'
);
+
+ input = {
+ 0: {
+ shareWith: 'User One@someserver.com/',
+ shareWithDisplayName: 'User One@someserver.com/'
+ }
+ };
checkRecipients(
- 'User One@someserver.com/',
+ input,
'User One@…',
'Shared with User One@someserver.com'
);
+
+ input = {
+ 0: {
+ shareWith: 'User One@someserver.com/root/of/nextcloud',
+ shareWithDisplayName: 'User One@someserver.com/root/of/nextcloud'
+ }
+ };
checkRecipients(
- 'User One@someserver.com/root/of/owncloud',
+ input,
'User One@…',
'Shared with User One@someserver.com'
);
});
it('displays the user name part with domain of a remote share owner', function() {
+ var input = {
+ 0: {
+ shareWith: 'User One@example.com@someserver.com',
+ shareWithDisplayName: 'User One@example.com@someserver.com'
+ }
+ };
checkRecipients(
- 'User One@example.com@someserver.com',
+ input,
'User One@example.com',
'Shared with User One@example.com@someserver.com'
);
+
+ input = {
+ 0: {
+ shareWith: 'User One@example.com@someserver.com/',
+ shareWithDisplayName: 'User One@example.com@someserver.com/'
+ }
+ };
checkRecipients(
- 'User One@example.com@someserver.com/',
+ input,
'User One@example.com',
'Shared with User One@example.com@someserver.com'
);
+
+ input = {
+ 0: {
+ shareWith: 'User One@example.com@someserver.com/root/of/nextcloud',
+ shareWithDisplayName: 'User One@example.com@someserver.com/root/of/nextcloud'
+ }
+ };
checkRecipients(
- 'User One@example.com@someserver.com/root/of/owncloud',
+ input,
'User One@example.com',
'Shared with User One@example.com@someserver.com'
);
});
it('display multiple remote recipients', function() {
+ var input = {
+ 0: {
+ shareWith: 'One@someserver.com',
+ shareWithDisplayName: 'One@someserver.com'
+ },
+ 1: {
+ shareWith: 'two@otherserver.com',
+ shareWithDisplayName: 'two@otherserver.com'
+ }
+ };
checkRecipients(
- 'One@someserver.com, two@otherserver.com',
+ input,
'One@… two@…',
['Shared with One@someserver.com', 'Shared with two@otherserver.com']
);
+
+ input = {
+ 0: {
+ shareWith: 'One@someserver.com/',
+ shareWithDisplayName: 'One@someserver.com/'
+ },
+ 1: {
+ shareWith: 'two@someserver.com',
+ shareWithDisplayName: 'two@someserver.com'
+ }
+ };
checkRecipients(
- 'One@someserver.com/, two@otherserver.com',
+ input,
'One@… two@…',
['Shared with One@someserver.com', 'Shared with two@otherserver.com']
);
+
+ input = {
+ 0: {
+ shareWith: 'One@someserver.com/root/of/nextcloud',
+ shareWithDisplayName: 'One@someserver.com/root/of/nextcloud'
+ },
+ 1: {
+ shareWith: 'two@someserver.com',
+ shareWithDisplayName: 'two@someserver.com'
+ }
+ };
checkRecipients(
- 'One@someserver.com/root/of/owncloud, two@otherserver.com',
+ input,
'One@… two@…',
['Shared with One@someserver.com', 'Shared with two@otherserver.com']
);
});
it('display mixed recipients', function() {
checkRecipients(
- 'One, two@otherserver.com',
+ {
+ 0: {
+ shareWith: 'One',
+ shareWithDisplayName: 'One'
+ },
+ 1: {
+ shareWith: 'two@otherserver.com',
+ shareWithDisplayName: 'two@otherserver.com'
+ }
+ },
'Shared with One two@…',
['Shared with two@otherserver.com']
);
});
+ it('display multiple with divergent displaynames', function() {
+ var recipients = {
+ 0: {
+ shareWith: 'One',
+ shareWithDisplayName: 'Yoko Ono',
+ _output: 'Shared with Yoko Ono'
+ },
+ 1: {
+ shareWith: 'two@otherserver.com',
+ shareWithDisplayName: 'two@othererver.com',
+ _output: 'two@…'
+ },
+ 2: {
+ shareWith: 'Three',
+ shareWithDisplayName: 'Green, Mina',
+ _output: 'Shared with Green, Mina'
+ }
+ };
+
+ // we cannot assume the locale, also because PhantomJS has a bug.
+ var sortArray = _.toArray(recipients)
+ .sort(function(a, b) {
+ return a.shareWithDisplayName.localeCompare(b.shareWithDisplayName);
+ });
+ var sortedOutput = _.map(sortArray, function(recipient) {
+ return recipient._output;
+ }).join(' ');
+
+ checkRecipients(
+ recipients,
+ sortedOutput,
+ ['Shared with two@otherserver.com']
+ );
+ });
});
});
});