Fix broken tests which were previously skipped.

This commit is contained in:
Kegan Dougal 2014-11-06 11:14:31 +00:00
parent c5eec32c58
commit a92092340b
2 changed files with 20 additions and 13 deletions

View File

@ -38,7 +38,7 @@ function($rootScope, matrixService, eventHandlerService, modelService) {
if (room.state("m.room.join_rules") && room.state("m.room.join_rules").content) { if (room.state("m.room.join_rules") && room.state("m.room.join_rules").content) {
isPublicRoom = ("public" === room.state("m.room.join_rules").content.join_rule); isPublicRoom = ("public" === room.state("m.room.join_rules").content.join_rule);
} }
if (room_name_event) { if (room_name_event) {
roomName = room_name_event.content.name; roomName = room_name_event.content.name;
} }
@ -56,6 +56,9 @@ function($rootScope, matrixService, eventHandlerService, modelService) {
var member = room.members[i]; var member = room.members[i];
if (member.state_key !== user_id) { if (member.state_key !== user_id) {
roomName = eventHandlerService.getUserDisplayName(room_id, member.state_key); roomName = eventHandlerService.getUserDisplayName(room_id, member.state_key);
if (!roomName) {
roomName = member.state_key;
}
break; break;
} }
} }
@ -70,13 +73,22 @@ function($rootScope, matrixService, eventHandlerService, modelService) {
if (room.members[otherUserId].content.membership === "invite") { if (room.members[otherUserId].content.membership === "invite") {
// someone invited us, use the right ID. // someone invited us, use the right ID.
roomName = eventHandlerService.getUserDisplayName(room_id, room.members[otherUserId].user_id); roomName = eventHandlerService.getUserDisplayName(room_id, room.members[otherUserId].user_id);
if (!roomName) {
roomName = room.members[otherUserId].user_id;
}
} }
else { else {
roomName = eventHandlerService.getUserDisplayName(room_id, otherUserId); roomName = eventHandlerService.getUserDisplayName(room_id, otherUserId);
if (!roomName) {
roomName = user_id;
}
} }
} }
else { // it isn't us, so use their name if we know it. else { // it isn't us, so use their name if we know it.
roomName = eventHandlerService.getUserDisplayName(room_id, otherUserId); roomName = eventHandlerService.getUserDisplayName(room_id, otherUserId);
if (!roomName) {
roomName = otherUserId;
}
} }
} }
else if (Object.keys(room.members).length === 0) { else if (Object.keys(room.members).length === 0) {

View File

@ -121,9 +121,8 @@ describe('mRoomName filter', function() {
/**** ROOM ALIAS ****/ /**** ROOM ALIAS ****/
// FIXME it("should show the room alias if one exists for private (invite join_rules) rooms if a room name doesn't exist.", function() {
xit("should show the room alias if one exists for private (invite join_rules) rooms if a room name doesn't exist.", function() { testAlias = "#thealias:matrix.org";
var testAlias = "#thealias:matrix.org";
testUserId = "@me:matrix.org"; testUserId = "@me:matrix.org";
testRoomState.setJoinRule("invite"); testRoomState.setJoinRule("invite");
testRoomState.setMember(testUserId, "join"); testRoomState.setMember(testUserId, "join");
@ -131,9 +130,8 @@ describe('mRoomName filter', function() {
expect(output).toEqual(testAlias); expect(output).toEqual(testAlias);
}); });
// FIXME it("should show the room alias if one exists for public (public join_rules) rooms if a room name doesn't exist.", function() {
xit("should show the room alias if one exists for public (public join_rules) rooms if a room name doesn't exist.", function() { testAlias = "#thealias:matrix.org";
var testAlias = "#thealias:matrix.org";
testUserId = "@me:matrix.org"; testUserId = "@me:matrix.org";
testRoomState.setJoinRule("public"); testRoomState.setJoinRule("public");
testRoomState.setMember(testUserId, "join"); testRoomState.setMember(testUserId, "join");
@ -172,8 +170,7 @@ describe('mRoomName filter', function() {
expect(output).toEqual(testDisplayName); expect(output).toEqual(testDisplayName);
}); });
// FIXME it("should show your user ID for private (invite join_rules) rooms if a room name and alias don't exist and it is a self-chat and they don't have a display name set.", function() {
xit("should show your user ID for private (invite join_rules) rooms if a room name and alias don't exist and it is a self-chat and they don't have a display name set.", function() {
testUserId = "@me:matrix.org"; testUserId = "@me:matrix.org";
testRoomState.setJoinRule("private"); testRoomState.setJoinRule("private");
testRoomState.setMember(testUserId, "join"); testRoomState.setMember(testUserId, "join");
@ -194,8 +191,7 @@ describe('mRoomName filter', function() {
expect(output).toEqual(testOtherDisplayName); expect(output).toEqual(testOtherDisplayName);
}); });
// FIXME it("should show the other user's ID for private (invite join_rules) rooms if a room name and alias don't exist and it is a 1:1-chat and they don't have a display name set.", function() {
xit("should show the other user's ID for private (invite join_rules) rooms if a room name and alias don't exist and it is a 1:1-chat and they don't have a display name set.", function() {
testUserId = "@me:matrix.org"; testUserId = "@me:matrix.org";
otherUserId = "@alice:matrix.org"; otherUserId = "@alice:matrix.org";
testRoomState.setJoinRule("private"); testRoomState.setJoinRule("private");
@ -220,8 +216,7 @@ describe('mRoomName filter', function() {
expect(output).toEqual(testOtherDisplayName); expect(output).toEqual(testOtherDisplayName);
}); });
// FIXME it("should show the other user's ID for private (invite join_rules) rooms if you are invited to it and the inviter doesn't have a display name.", function() {
xit("should show the other user's ID for private (invite join_rules) rooms if you are invited to it and the inviter doesn't have a display name.", function() {
testUserId = "@me:matrix.org"; testUserId = "@me:matrix.org";
testDisplayName = "Me"; testDisplayName = "Me";
otherUserId = "@alice:matrix.org"; otherUserId = "@alice:matrix.org";