-
Notifications
You must be signed in to change notification settings - Fork 111
/
ng-intl-tel-input.e2e.js
38 lines (34 loc) · 1.18 KB
/
ng-intl-tel-input.e2e.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var page = Object.create({}, {
phone: {
get: function () {
return $('#tel');
},
set: function (number) {
this.phone.sendKeys(number);
}
},
phoneDefaultCountry: {
get: function () {
return $('#tel-dc');
},
set: function (number) {
this.phoneDefaultCountry.sendKeys(number);
}
}
});
describe('ng-intl-tel-input directive', function () {
it('should properly format a phone number', function () {
page.phone = '18002255288';
expect(page.phone.getAttribute('value')).to.eventually.equal('18002255288');
});
it('should set default country to data-initial-country', function () {
page.phoneDefaultCountry = '07400123456';
expect(page.phoneDefaultCountry.getAttribute('value')).to.eventually.equal('07400123456');
});
it('should set the selected country data when a different country is selected', function () {
element.all(by.css('.selected-flag')).get(1).click();
element.all(by.css('.flag-container .country[data-country-code="af"] .flag-box .iti-flag')).get(1).click();
page.phoneDefaultCountry = '1';
expect(element(by.id('selectedCountry')).getText()).to.eventually.contain('Afghanistan');
});
});