fix sorting test on phantomjs
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
5a9c99e6ac
commit
134192d76c
|
@ -327,22 +327,36 @@ describe('OC.Share tests', function() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('display multiple with divergent displaynames', function() {
|
it('display multiple with divergent displaynames', function() {
|
||||||
checkRecipients(
|
var recipients = {
|
||||||
{
|
0: {
|
||||||
0: {
|
shareWith: 'One',
|
||||||
shareWith: 'One',
|
shareWithDisplayName: 'Yoko Ono',
|
||||||
shareWithDisplayName: 'Yoko Ono'
|
_output: 'Shared with Yoko Ono'
|
||||||
},
|
|
||||||
1: {
|
|
||||||
shareWith: 'two@otherserver.com',
|
|
||||||
shareWithDisplayName: 'two@othererver.com'
|
|
||||||
},
|
|
||||||
2: {
|
|
||||||
shareWith: 'Three',
|
|
||||||
shareWithDisplayName: 'Green, Mina'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'Shared with Green, Mina two@… 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']
|
['Shared with two@otherserver.com']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue