1 |
www |
1 |
"use strict";
|
|
|
2 |
|
|
|
3 |
describe("getSelectedCountryData: init plugin to test public method getSelectedCountryData", function() {
|
|
|
4 |
|
|
|
5 |
beforeEach(function() {
|
|
|
6 |
intlSetup();
|
|
|
7 |
input = $("<input>").wrap("div");
|
|
|
8 |
iti = window.intlTelInput(input[0]);
|
|
|
9 |
});
|
|
|
10 |
|
|
|
11 |
afterEach(function() {
|
|
|
12 |
intlTeardown();
|
|
|
13 |
});
|
|
|
14 |
|
|
|
15 |
it("gets the right default country data", function() {
|
|
|
16 |
expect(iti.getSelectedCountryData().iso2).toEqual("us");
|
|
|
17 |
});
|
|
|
18 |
|
|
|
19 |
it("change country by number gets the right country data", function() {
|
|
|
20 |
input.val("+44");
|
|
|
21 |
triggerKeyOnInput(" ");
|
|
|
22 |
expect(iti.getSelectedCountryData().iso2).toEqual("gb");
|
|
|
23 |
});
|
|
|
24 |
|
|
|
25 |
it("change country by selecting a flag gets the right country data", function() {
|
|
|
26 |
selectFlag("ch");
|
|
|
27 |
expect(iti.getSelectedCountryData().iso2).toEqual("ch");
|
|
|
28 |
});
|
|
|
29 |
|
|
|
30 |
});
|