Bug 1107210 - Fixed room name update not correctly reflected in Loop panel. r=Standard8

This commit is contained in:
Nicolas Perriault 2014-12-05 09:39:09 -08:00
parent f435f64942
commit 79e9a5b3bb
4 changed files with 32 additions and 2 deletions

View File

@ -537,6 +537,12 @@ loop.panel = (function(_, mozL10n) {
return {edit: false, text: this.props.text};
},
componentWillReceiveProps: function(nextProps) {
if (nextProps.text !== this.props.text) {
this.setState({text: nextProps.text});
}
},
handleTextClick: function(event) {
event.stopPropagation();
event.preventDefault();

View File

@ -537,6 +537,12 @@ loop.panel = (function(_, mozL10n) {
return {edit: false, text: this.props.text};
},
componentWillReceiveProps: function(nextProps) {
if (nextProps.text !== this.props.text) {
this.setState({text: nextProps.text});
}
},
handleTextClick: function(event) {
event.stopPropagation();
event.preventDefault();

View File

@ -391,8 +391,7 @@ loop.store.ActiveRoomStore = (function() {
this._leaveRoom(ROOM_STATES.CLOSING);
// If we're closing the window, we can stop listening to updates.
this._mozLoop.rooms.off("update:" + this.getStoreState().roomToken,
this._handleRoomUpdate.bind(this));
this._mozLoop.rooms.off("update:" + this.getStoreState().roomToken);
},
/**

View File

@ -857,6 +857,25 @@ describe("loop.panel", function() {
new sharedActions.OpenRoom({roomToken: roomData.roomToken}));
});
});
describe("Room name updated", function() {
it("should update room name", function() {
var roomEntry = mountRoomEntry({
dispatcher: dispatcher,
room: new loop.store.Room(roomData)
});
var updatedRoom = new loop.store.Room(_.extend({}, roomData, {
roomName: "New room name",
ctime: new Date().getTime()
}));
roomEntry.setProps({room: updatedRoom});
expect(
roomEntry.getDOMNode().querySelector(".edit-in-place").textContent)
.eql("New room name");
});
});
});
describe("loop.panel.RoomList", function() {