Merge pull request #9172 from nextcloud/karma-avatar-tests-fix
Fix js tests with placeholder
This commit is contained in:
commit
db8bcfc5f6
|
@ -112,7 +112,7 @@
|
||||||
|
|
||||||
// Convert a string to an integer evenly
|
// Convert a string to an integer evenly
|
||||||
function hashToInt(hash, maximum) {
|
function hashToInt(hash, maximum) {
|
||||||
var final = 0;
|
var finalInt = 0;
|
||||||
var result = Array();
|
var result = Array();
|
||||||
|
|
||||||
// Splitting evenly the string
|
// Splitting evenly the string
|
||||||
|
@ -121,13 +121,13 @@
|
||||||
result.push(parseInt(hash.charAt(i), 16) % 16);
|
result.push(parseInt(hash.charAt(i), 16) % 16);
|
||||||
}
|
}
|
||||||
// Adds up all results
|
// Adds up all results
|
||||||
for (var i in result) {
|
for (var j in result) {
|
||||||
final += result[i];
|
finalInt += result[j];
|
||||||
}
|
}
|
||||||
// chars in md5 goes up to f, hex:16
|
// chars in md5 goes up to f, hex:16
|
||||||
return parseInt(final % maximum);
|
// make sure we're always using int in our operation
|
||||||
|
return parseInt(parseInt(finalInt) % maximum);
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalPalette[hashToInt(hash, steps * 3 )];
|
return finalPalette[hashToInt(hash, steps * 3 )];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue