Browse Source

Merge pull request #659 from googlei18n/fixing_tests

Fixing tests
pull/677/head
hagbard 11 years ago
parent
commit
0bad44a23b
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      javascript/i18n/phonenumbers/asyoutypeformatter_test.js

+ 6
- 4
javascript/i18n/phonenumbers/asyoutypeformatter_test.js View File

@ -1154,17 +1154,19 @@ function testAYTFClearNDDAfterIddExtraction() {
/** @type {i18n.phonenumbers.AsYouTypeFormatter} */
var f = new i18n.phonenumbers.AsYouTypeFormatter(RegionCode.KR);
// Check that when we have successfully extracted an IDD, the previously
// extracted NDD is cleared since it is no longer valid.
assertEquals('0', f.inputDigit('0'));
assertEquals('00', f.inputDigit('0'));
assertEquals('007', f.inputDigit('7'));
assertEquals('0070', f.inputDigit('0'));
assertEquals('00700', f.inputDigit('0'));
assertEquals('0', f.getExtractedNationalPrefix_());
// NDD is '0' at this stage (the first '0' in '00700') because it's not
// clear if the number is a national number or using the IDD to dial out.
assertEquals('00700 1 ', f.inputDigit('1'));
assertEquals('', f.getExtractedNationalPrefix_());
// NDD should be cleared here because IDD '00700' was extracted after the
// country calling code '1' (US) was entered.
assertEquals('00700 1 2', f.inputDigit('2'));
// The remaining long sequence of inputs is because the original bug that
// this test if for only triggered after a lot of subsequent inputs.
assertEquals('00700 1 23', f.inputDigit('3'));
assertEquals('00700 1 234', f.inputDigit('4'));
assertEquals('00700 1 234 5', f.inputDigit('5'));


Loading…
Cancel
Save