Jelajahi Sumber

Tweak the error message styling

JC Brand 12 tahun lalu
induk
melakukan
feb3695ebe
3 mengubah file dengan 13 tambahan dan 8 penghapusan
  1. 6 0
      converse.css
  2. 2 2
      converse.js
  3. 5 6
      spec/ChatRoomSpec.js

+ 6 - 0
converse.css

@@ -402,6 +402,12 @@ a.configure-chatroom-button {
     padding: 0;
 }
 
+.chat-body p {
+    font-size: 14px;
+    color: #666;
+    margin: 5px;
+}
+
 .chatroom-form legend {
     font-size: 14px;
     font-weight: bold;

+ 2 - 2
converse.js

@@ -1317,7 +1317,7 @@
                     if ($error.find('not-allowed').length) {
                         this.renderErrorMessage('You are not allowed to create new rooms');
                     } else if ($error.find('not-acceptable').length) {
-                        this.renderErrorMessage("Your nickname doesn't conform to the room's policies");
+                        this.renderErrorMessage("Your nickname doesn't conform to this room's policies");
                     } else if ($error.find('conflict').length) {
                         this.renderErrorMessage("Your nickname is already taken");
                     } else if ($error.find('item-not-found').length) {
@@ -2314,7 +2314,7 @@
 
         connect: function (jid, password) {
             var connection = new Strophe.Connection(converse.bosh_service_url);
-            connection.connect(jid, password, $.proxy(function (status) {
+            connection.connect(jid, password, $.proxy(function (status, message) {
                 if (status === Strophe.Status.CONNECTED) {
                     console.log('Connected');
                     converse.onConnected(connection);

+ 5 - 6
spec/ChatRoomSpec.js

@@ -26,14 +26,14 @@
             }, converse));
 
             it("shows users currently present in the room", $.proxy(function () {
-                var chatroomview = this.chatboxesview.views['lounge@muc.localhost'];
-                chatroomview.renderChatArea();
-                var $participant_list = chatroomview.$el.find('.participant-list');
+                var chatroomview = this.chatboxesview.views['lounge@muc.localhost'],
+                    $participant_list;
                 var roster = {}, room = {}, i;
 
                 for (i=0; i<chatroom_names.length-1; i++) {
                     roster[chatroom_names[i]] = {};
                     chatroomview.onChatRoomRoster(roster, room);
+                    $participant_list = chatroomview.$el.find('.participant-list');
                     expect($participant_list.find('li').length).toBe(1+i);
                     expect($($participant_list.find('li')[i]).text()).toBe(chatroom_names[i]);
                 }
@@ -43,12 +43,11 @@
 
             it("indicates moderators by means of a special css class and tooltip", $.proxy(function () {
                 var chatroomview = this.chatboxesview.views['lounge@muc.localhost'];
-                var $participant_list = chatroomview.$el.find('.participant-list');
                 var roster = {}, idx = chatroom_names.length-1;
                 roster[chatroom_names[idx]] = {};
                 roster[chatroom_names[idx]].role = 'moderator';
                 chatroomview.onChatRoomRoster(roster, {});
-                occupant = $participant_list.find('li');
+                var occupant = chatroomview.$el.find('.participant-list').find('li');
                 expect(occupant.length).toBe(1);
                 expect($(occupant).text()).toBe(chatroom_names[idx]);
                 expect($(occupant).attr('class')).toBe('moderator');
@@ -209,7 +208,7 @@
                 spyOn(view, 'renderErrorMessage').andCallThrough();
                 view.onChatRoomPresence(presence, {'nick': 'dummy'});
                 expect(converse.connection.muc.removeRoom).toHaveBeenCalled();
-                expect(view.$el.find('.chat-body p').text()).toBe("Your nickname doesn't conform to the room's policies");
+                expect(view.$el.find('.chat-body p').text()).toBe("Your nickname doesn't conform to this room's policies");
             }, converse));
 
             it("will show an error message if the user's nickname is already taken", $.proxy(function () {