mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
Merge branch 'joyclark-autocomplete-click-behavior' into develop
This commit is contained in:
@@ -219,6 +219,20 @@ describe("Autocomplete controller", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("performCompletion", function() {
|
||||||
|
it('triggers autoComplete', function() {
|
||||||
|
scope.autoComplete = sinon.spy();
|
||||||
|
|
||||||
|
var msg = {user: "boo"}; // scope.autoComplete only cares about user
|
||||||
|
scope.query = {text: "b"};
|
||||||
|
scope.performCompletion(msg);
|
||||||
|
|
||||||
|
expect(scope.query).to.be.eq(null);
|
||||||
|
expect(scope.autoComplete.callCount).to.be.eq(1);
|
||||||
|
expect(scope.autoComplete).to.have.been.calledWith(msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("addNewUser", function() {
|
describe("addNewUser", function() {
|
||||||
it('a new message from a new user will modify the usernames', function() {
|
it('a new message from a new user will modify the usernames', function() {
|
||||||
expect(scope.response).to.be.empty;
|
expect(scope.response).to.be.empty;
|
||||||
|
|||||||
@@ -232,6 +232,11 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
|
|||||||
return user.indexOf(text) == 0;
|
return user.indexOf(text) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.performCompletion = function(msg) {
|
||||||
|
$scope.autoComplete(msg);
|
||||||
|
$scope.query = null;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.addNewUser = function(user) {
|
$scope.addNewUser = function(user) {
|
||||||
if($.inArray(user.user,$scope.usernames) == -1) {
|
if($.inArray(user.user,$scope.usernames) == -1) {
|
||||||
user.username = user.user;
|
user.username = user.user;
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ div.chat-form.guidelines-not-accepted(ng-if='!user.flags.communityGuidelinesAcce
|
|||||||
form.chat-form(ng-if='user.flags.communityGuidelinesAccepted' ng-submit='postChat(group,message.content)')
|
form.chat-form(ng-if='user.flags.communityGuidelinesAccepted' ng-submit='postChat(group,message.content)')
|
||||||
div(ng-controller='AutocompleteCtrl')
|
div(ng-controller='AutocompleteCtrl')
|
||||||
textarea.form-control(rows=4, ui-keydown='{"meta-enter":"postChat(group,message.content)"}', ui-keypress='{13:"postChat(group,message.content)"}', ng-model='message.content', updateinterval='250', flag='@', at-user, auto-complete placeholder="{{group._id == 'habitrpg' ? env.t('tavernCommunityGuidelinesPlaceholder') : ''}}")
|
textarea.form-control(rows=4, ui-keydown='{"meta-enter":"postChat(group,message.content)"}', ui-keypress='{13:"postChat(group,message.content)"}', ng-model='message.content', updateinterval='250', flag='@', at-user, auto-complete placeholder="{{group._id == 'habitrpg' ? env.t('tavernCommunityGuidelinesPlaceholder') : ''}}")
|
||||||
span.user-list(ng-show='!isAtListHidden')
|
span.user-list
|
||||||
ul.list-at-user
|
ul.list-at-user(ng-show="query")
|
||||||
li(ng-repeat='msg in response | filter:filterUser | limitTo: 5', ng-click='autoComplete(msg)')
|
li(ng-repeat='msg in response | filter:filterUser | limitTo: 5', ng-click='performCompletion(msg)')
|
||||||
span.username.label.label-default(ng-class=':: userLevelStyle(msg)') {{::msg.user}}
|
span.username.label.label-default(ng-class=':: userLevelStyle(msg)') {{::msg.user}}
|
||||||
.chat-controls
|
.chat-controls
|
||||||
.chat-formatting
|
.chat-formatting
|
||||||
|
|||||||
Reference in New Issue
Block a user