Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #14892 from etiennesegonzac/bug-948975-resume-sing…
Browse files Browse the repository at this point in the history
…le-conference-group

Bug 948975 - Safeguard to make sure we can always resume a single held conference call. r=rik
  • Loading branch information
etiennesegonzac committed Jan 7, 2014
2 parents d6cc675 + 89ebe77 commit 7354e63
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
13 changes: 10 additions & 3 deletions apps/communications/dialer/js/calls_handler.js
Expand Up @@ -615,18 +615,25 @@ var CallsHandler = (function callsHandler() {
}

function holdOrResumeSingleCall() {
if (handledCalls.length !== 1) {
var openLines = telephony.calls.length +
(telephony.conferenceGroup.calls.length ? 1 : 0);

if (openLines !== 1) {
return;
}
if (telephony.calls[0].state === 'incoming') {

if (telephony.calls.length && telephony.calls[0].state === 'incoming') {
return;
}

if (telephony.active) {
telephony.active.hold();
CallScreen.render('connected-hold');
} else {
telephony.calls[0].resume();
var line = telephony.calls.length ?
telephony.calls[0] : telephony.conferenceGroup;

line.resume();
CallScreen.render('connected');
}
}
Expand Down
21 changes: 20 additions & 1 deletion apps/communications/dialer/test/unit/calls_handler_test.js
Expand Up @@ -863,7 +863,7 @@ suite('calls handler', function() {
});

suite('> CallsHandler.toggleCalls()', function() {
suite('> toggling a simple call', function() {
suite('> toggling a single call', function() {
var mockCall;

setup(function() {
Expand Down Expand Up @@ -925,6 +925,25 @@ suite('calls handler', function() {
CallsHandler.toggleCalls();
assert.isFalse(holdSpy.called);
});

suite('when the conference call is holded', function() {
setup(function() {
MockMozTelephony.active = null;
});

test('should resume the conference call', function() {
var resumeSpy = this.sinon.spy(MockMozTelephony.conferenceGroup,
'resume');
CallsHandler.toggleCalls();
assert.isTrue(resumeSpy.calledOnce);
});

test('should render the CallScreen in connected mode', function() {
var renderSpy = this.sinon.spy(MockCallScreen, 'render');
CallsHandler.toggleCalls();
assert.isTrue(renderSpy.calledWith('connected'));
});
});
});

suite('> toggling between 2 calls', function() {
Expand Down

0 comments on commit 7354e63

Please sign in to comment.