Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Upgraded intl-tel-input library. (#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-SteveBrush authored Jan 3, 2019
1 parent 159fe62 commit 4222c7d
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js/sky/src/phonefield/docs/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ summary: The phone field directive creates a text box to format and validate int
The phone field directive creates a text box for users to enter phone numbers. It wraps up the [intl-tel-input jQuery plugin](http://jackocnr.com/intl-tel-input.html) to format and validate international phone numbers. This plugin adds a dropdown for users to select a country and specifies the desired format and dial code. Users can also enter a dial code to select a country. You use the `bb-phone-field` directive in conjunction with the `ng-model` directive and bind the phone number value to `ng-model`.

### Dependencies ###
- **[intl-tel-input](http://jackocnr.com/intl-tel-input.html) (8.5.2 or higher)** Enhances a text box to format and validate international phone numbers.
- **[intl-tel-input](http://jackocnr.com/intl-tel-input.html) (12.4.0)** Enhances a text box to format and validate international phone numbers.

---

Expand Down
2 changes: 1 addition & 1 deletion js/sky/src/phonefield/phonefield.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// So, its dial code should just be 1 because the area code includes the dial code.
// Example countries: Bahamas, Cayman Islands, Barbados.
if (selectedCountryData.dialCode.toString()[0] === '1') {
selectedCountryData.dialCode = 1;
selectedCountryData.dialCode = '1';
}

return '+' + selectedCountryData.dialCode + ' ' + formattedNumber;
Expand Down
24 changes: 24 additions & 0 deletions js/sky/src/phonefield/test/phonefield.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,4 +423,28 @@ describe('Phone field directive', function () {
el.remove();
});

it('should handle new Brazil phone number format', function () {
// ** arrange **
var el,
$scope = $rootScope.$new();

$scope.phoneFieldConfig = {
countryIso2: nationalCountryData.iso2
};

el = compileDirective($scope);
el.appendTo(document.body);
$scope.$digest();

// ** act **
setCountry(el, 'br'); // 'br' is Brazil
setNumber(el, '5548998386090');

// ** assert **
expect($scope.phoneNumber).toBe('+55 (48) 99838-6090');

// ** clean up **
el.remove();
});

});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@
"angular-ui-router": "0.4.2",
"autonumeric": "1.9.39",
"block-ui": "2.70.1",
"bootstrap": "3.3.5",
"bootstrap": "3.4.0",
"enquire.js": "git+https://github.com/WickyNilliams/enquire.js.git#v2.1.2",
"fastclick": "1.0.6",
"free-jqgrid": "git+https://github.com/blackbaud/jqGrid.git#v4.7.0",
"intl-tel-input": "8.5.2",
"intl-tel-input": "12.4.0",
"jquery": "2.1.3",
"jquery-ui-bundle": "1.11.4",
"jquery-ui-touch-punch": "0.2.3",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion webdrivertest/test/phonefield/phonefield.visual.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Phone Field directive', function () {
selectors = {
flagContainer: '.flag-container',
countryList: '.country-list',
localCountryTextbox: 'input[placeholder="(201) 555-5555"]',
localCountryTextbox: 'input[placeholder="(201) 555-0123"]',
intlCountryTextbox: 'input[placeholder="01812-345678"]',
intlCountrySelect: 'li[data-dial-code="880"]',
wrapper: '#screenshot-phone-field'
Expand Down

0 comments on commit 4222c7d

Please sign in to comment.