mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-03 08:21:07 +00:00
Ignore casing when searching for user name in autocomplete
This commit is contained in:
parent
41763d3b78
commit
78249122f7
2 changed files with 10 additions and 1 deletions
|
|
@ -133,6 +133,11 @@ describe("Autocomplete controller", function() {
|
||||||
expect(scope.filterUser({user: "prefix"})).to.be.eq(true);
|
expect(scope.filterUser({user: "prefix"})).to.be.eq(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('filters with prefix of a different case and element and returns true', function() {
|
||||||
|
scope.query = {text: "pre"}
|
||||||
|
expect(scope.filterUser({user: "Prefix"})).to.be.eq(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('filters with nonprefix element and returns false', function() {
|
it('filters with nonprefix element and returns false', function() {
|
||||||
scope.query = {text: "noprefix"}
|
scope.query = {text: "noprefix"}
|
||||||
expect(scope.filterUser({user: "prefix"})).to.be.eq(false);
|
expect(scope.filterUser({user: "prefix"})).to.be.eq(false);
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,11 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg.user.indexOf($scope.query.text) == 0;
|
// Ignore casing when checking for username
|
||||||
|
var user = msg.user.toLowerCase();
|
||||||
|
var text = $scope.query.text.toLowerCase();
|
||||||
|
|
||||||
|
return user.indexOf(text) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.addNewUser = function(user) {
|
$scope.addNewUser = function(user) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue