@@ -8,6 +8,7 @@ import fs from 'fs';
8
8
import IntlTelInput from '../src/components/IntlTelInputApp' ;
9
9
import FlagDropDown from '../src/components/FlagDropDown' ;
10
10
import CountryList from '../src/components/CountryList' ;
11
+ import TelInput from '../src/components/TelInput' ;
11
12
12
13
describe ( 'FlagDropDown' , function ( ) { // eslint-disable-line func-names
13
14
let libphonenumberUtils ;
@@ -440,26 +441,31 @@ describe('FlagDropDown', function () { // eslint-disable-line func-names
440
441
441
442
it ( 'onSelectFlag' , ( ) => {
442
443
let expected = '' ;
443
- const onSelectFlag = ( currentNumber , countryData ) => {
444
- expected = Object . assign ( { } , { currentNumber, ...countryData } ) ;
444
+ const onSelectFlag = ( currentNumber , countryData , fullNumber , isValid ) => {
445
+ expected = Object . assign ( { } , { currentNumber, fullNumber , isValid , ...countryData } ) ;
445
446
} ;
446
447
447
448
this . params . onSelectFlag = onSelectFlag ;
448
449
const subject = this . makeSubject ( ) ;
449
450
const flagComponent = subject . find ( FlagDropDown ) ;
451
+ const inputComponent = subject . find ( TelInput ) ;
450
452
const countryListComponent = subject . find ( CountryList ) ;
451
453
452
454
requests [ 0 ] . respond ( 200 ,
453
455
{ 'Content-Type' : 'text/javascript' } ,
454
456
libphonenumberUtils ) ;
457
+ window . eval ( getScript ( ) . text ) ;
455
458
459
+ inputComponent . simulate ( 'change' , { target : { value : '+8109012345678' } } ) ;
456
460
flagComponent . simulate ( 'click' ) ;
457
461
const japanOption = countryListComponent . find ( '[data-country-code="jp"]' ) ;
458
462
459
463
japanOption . simulate ( 'click' ) ;
460
464
461
465
expect ( expected ) . toEqual ( {
462
- currentNumber : '' ,
466
+ currentNumber : '+8109012345678' ,
467
+ fullNumber : '+81 90-1234-5678' ,
468
+ isValid : true ,
463
469
name : 'Japan (日本)' ,
464
470
iso2 : 'jp' ,
465
471
dialCode : '81' ,
0 commit comments