Bug 1210513 - Loop's direct calls don't cancel properly if you click the hangup button on the toolbar. r=mikedeboer

This commit is contained in:
Mark Banner 2015-10-02 14:24:09 +01:00
parent 0e5ca790cb
commit 7972825db6
2 changed files with 15 additions and 2 deletions

View File

@ -338,7 +338,10 @@ loop.store = loop.store || {};
}
this._endSession();
this.setStoreState({callState: CALL_STATES.FINISHED});
this.setStoreState({
callState: this._storeState.callState === CALL_STATES.ONGOING ?
CALL_STATES.FINISHED : CALL_STATES.CLOSE
});
},
/**

View File

@ -777,12 +777,22 @@ describe("loop.store.ConversationStore", function () {
sinon.assert.calledOnce(wsHangupSpy);
});
it("should set the callState to finished", function() {
it("should set the callState to finished for ongoing call state", function() {
store.hangupCall(new sharedActions.HangupCall());
expect(store.getStoreState("callState")).eql(CALL_STATES.FINISHED);
});
it("should set the callState to CLOSE for non-ongoing call state", function() {
store.setStoreState({
callState: CALL_STATES.CONNECTING
});
store.hangupCall(new sharedActions.HangupCall());
expect(store.getStoreState("callState")).eql(CALL_STATES.CLOSE);
});
it("should release mozLoop callsData", function() {
store.hangupCall(new sharedActions.HangupCall());