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 #20622 from gittup/bug-917630-v1.4
Browse files Browse the repository at this point in the history
Bug 917630 - Allow unlimited keypresses when on a call r=etienne
  • Loading branch information
Ben Kelly committed Jun 17, 2014
2 parents c6ec00c + 701922c commit 4811223
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/communications/dialer/js/keypad.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,9 @@ var KeypadManager = {
}

// If user input number more 50 digits, app shouldn't accept.
if (key != 'delete' && this._phoneNumber.length >= 50) {
// The limit only applies while not on a call - there is no
// limit while on a call (bug 917630).
if (key != 'delete' && this._phoneNumber.length >= 50 && !this._onCall) {
return;
}

Expand Down
47 changes: 47 additions & 0 deletions apps/communications/dialer/test/unit/keypad_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,29 @@ suite('dialer/keypad', function() {
assert.equal(subject._phoneNumber, recentCall.number);
});

test('Dialer is limited to 50 digits', function() {
var digits = '111111111122222222223333333333444444444455555555556';
var fakeEvent = {
target: {
dataset: {
value: null
}
},
stopPropagation: function() {},
type: null
};

subject._phoneNumber = '';
for (var i = 0, end = digits.length; i < end; i++) {
fakeEvent.target.dataset.value = digits.charAt(i);
fakeEvent.type = 'touchstart';
subject.keyHandler(fakeEvent);
fakeEvent.type = 'touchend';
subject.keyHandler(fakeEvent);
}
assert.equal(subject._phoneNumber, digits.substring(0, 50));
});

suite('Audible and DTMF tones when composing numbers', function() {
suiteSetup(function() {
realMozTelephony = navigator.mozTelephony;
Expand Down Expand Up @@ -333,6 +356,30 @@ suite('dialer/keypad', function() {
assert.ok(true, 'got here');
});
});

test('Dialer is not limited to 50 digits while on a call', function() {
var digits = '11111111112222222222333333333344444444445555555555' +
'6666666666';
var fakeEvent = {
target: {
dataset: {
value: null
}
},
stopPropagation: function() {},
type: null
};

subject._phoneNumber = '';
for (var i = 0, end = digits.length; i < end; i++) {
fakeEvent.target.dataset.value = digits.charAt(i);
fakeEvent.type = 'touchstart';
subject.keyHandler(fakeEvent);
fakeEvent.type = 'touchend';
subject.keyHandler(fakeEvent);
}
assert.equal(subject._phoneNumber, digits);
});
});

suite('voiceMail hotkey', function() {
Expand Down

0 comments on commit 4811223

Please sign in to comment.