intl-tel-input 17.0.21 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -15
- package/README.md +14 -14
- package/build/css/intlTelInput.css +16 -5
- package/build/css/intlTelInput.min.css +1 -1
- package/build/js/data.js +2 -2
- package/build/js/data.min.js +2 -2
- package/build/js/intlTelInput-jquery.js +97 -49
- package/build/js/intlTelInput-jquery.min.js +3 -3
- package/build/js/intlTelInput.js +97 -49
- package/build/js/intlTelInput.min.js +3 -3
- package/composer.json +1 -1
- package/demo.html +6 -6
- package/demo_rtl.html +47 -0
- package/examples/gen/country-sync.html +6 -6
- package/examples/gen/default-country-ip.html +5 -5
- package/examples/gen/display-number.html +5 -5
- package/examples/gen/hidden-input.html +5 -5
- package/examples/gen/init-promise.html +5 -5
- package/examples/gen/is-valid-number.html +6 -6
- package/examples/gen/js/countrySync.js +1 -1
- package/examples/gen/js/defaultCountryIp.js +1 -1
- package/examples/gen/js/displayNumber.js +1 -1
- package/examples/gen/js/hiddenInput.js +1 -1
- package/examples/gen/js/initPromise.js +1 -1
- package/examples/gen/js/isValidNumber.js +1 -1
- package/examples/gen/js/modifyCountryData.js +1 -1
- package/examples/gen/js/multipleInstances.js +2 -2
- package/examples/gen/js/nationalMode.js +1 -1
- package/examples/gen/js/onlyCountriesEurope.js +1 -1
- package/examples/gen/modify-country-data.html +5 -5
- package/examples/gen/multiple-instances.html +6 -6
- package/examples/gen/national-mode.html +5 -5
- package/examples/gen/only-countries-europe.html +5 -5
- package/package.json +1 -1
- package/spec.html +1 -1
- package/src/css/intlTelInput.scss +23 -6
- package/src/js/data.js +1 -1
- package/src/js/intlTelInput.js +53 -50
- package/src/spec/tests/core/dropdownShortcuts.js +3 -2
- package/src/spec/tests/core/multipleInstances.js +8 -7
- package/src/spec/tests/core/usingDropdown.js +30 -10
- package/src/spec/tests/methods/destroy.js +2 -2
- package/src/spec/tests/options/allowDropdown.js +8 -0
- package/src/spec/tests/options/{autoHideDialCode.js → autoInsertDialCode.js} +18 -28
- package/src/spec/tests/options/separateDialCode.js +42 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
describe("
|
|
3
|
+
describe("autoInsertDialCode option:", function() {
|
|
4
4
|
|
|
5
5
|
var defaultDialCode = "+1";
|
|
6
6
|
|
|
@@ -16,16 +16,21 @@ describe("autoHideDialCode option:", function() {
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
describe("init plugin with
|
|
19
|
+
describe("init plugin with autoInsertDialCode=true and nationalMode=false", function() {
|
|
20
20
|
|
|
21
21
|
beforeEach(function() {
|
|
22
22
|
iti = window.intlTelInput(input[0], {
|
|
23
|
-
|
|
23
|
+
autoInsertDialCode: true,
|
|
24
24
|
nationalMode: false
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
it("
|
|
28
|
+
it("automatically inserts the default dial code", function() {
|
|
29
|
+
expect(getInputVal()).toEqual(defaultDialCode);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("blurring the input removes it", function() {
|
|
33
|
+
triggerInputEvent("blur");
|
|
29
34
|
expect(getInputVal()).toEqual("");
|
|
30
35
|
});
|
|
31
36
|
|
|
@@ -56,9 +61,7 @@ describe("autoHideDialCode option:", function() {
|
|
|
56
61
|
input.val(number);
|
|
57
62
|
});
|
|
58
63
|
|
|
59
|
-
it("
|
|
60
|
-
triggerInputEvent("focus");
|
|
61
|
-
expect(getInputVal()).toEqual(number);
|
|
64
|
+
it("blurring the input doesn't change it", function() {
|
|
62
65
|
triggerInputEvent("blur");
|
|
63
66
|
expect(getInputVal()).toEqual(number);
|
|
64
67
|
});
|
|
@@ -68,40 +71,27 @@ describe("autoHideDialCode option:", function() {
|
|
|
68
71
|
});
|
|
69
72
|
|
|
70
73
|
|
|
71
|
-
describe("init plugin with
|
|
74
|
+
describe("init plugin with autoInsertDialCode=false and nationalMode=false", function() {
|
|
72
75
|
|
|
73
76
|
beforeEach(function() {
|
|
74
77
|
iti = window.intlTelInput(input[0], {
|
|
75
|
-
|
|
78
|
+
autoInsertDialCode: false,
|
|
76
79
|
nationalMode: false
|
|
77
80
|
});
|
|
78
81
|
});
|
|
79
82
|
|
|
80
|
-
it("automatically
|
|
81
|
-
expect(getInputVal()).toEqual(
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("focusing and bluring the input dont change the val", function() {
|
|
85
|
-
triggerInputEvent("focus");
|
|
86
|
-
expect(getInputVal()).toEqual(defaultDialCode);
|
|
87
|
-
triggerInputEvent("blur");
|
|
88
|
-
expect(getInputVal()).toEqual(defaultDialCode);
|
|
83
|
+
it("does not automatically insert the default dial code", function() {
|
|
84
|
+
expect(getInputVal()).toEqual("");
|
|
89
85
|
});
|
|
90
86
|
|
|
91
|
-
|
|
92
|
-
describe("with a phone number", function() {
|
|
93
|
-
|
|
94
|
-
var number = "+1 702 987 2345";
|
|
87
|
+
describe("selecting a country", function() {
|
|
95
88
|
|
|
96
89
|
beforeEach(function() {
|
|
97
|
-
|
|
90
|
+
selectFlag("gb");
|
|
98
91
|
});
|
|
99
92
|
|
|
100
|
-
it("
|
|
101
|
-
|
|
102
|
-
expect(getInputVal()).toEqual(number);
|
|
103
|
-
triggerInputEvent("blur");
|
|
104
|
-
expect(getInputVal()).toEqual(number);
|
|
93
|
+
it("does not add the dial code", function() {
|
|
94
|
+
expect(getInputVal()).toEqual("");
|
|
105
95
|
});
|
|
106
96
|
|
|
107
97
|
});
|
|
@@ -14,11 +14,12 @@ describe("separateDialCode:", function() {
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
// we test with "gb" because the ntl number is different to the intl number (aside from the dial code)
|
|
17
|
-
describe("init plugin with initialCountry=gb", function() {
|
|
17
|
+
describe("init plugin with initialCountry=gb and nationalMode=false", function() {
|
|
18
18
|
|
|
19
19
|
beforeEach(function() {
|
|
20
20
|
iti = window.intlTelInput(input[0], {
|
|
21
21
|
separateDialCode: true,
|
|
22
|
+
nationalMode: false,
|
|
22
23
|
initialCountry: "gb",
|
|
23
24
|
});
|
|
24
25
|
});
|
|
@@ -57,12 +58,49 @@ describe("separateDialCode:", function() {
|
|
|
57
58
|
});
|
|
58
59
|
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
describe("init plugin with initialCountry=gb and nationalMode=true", function() {
|
|
62
|
+
|
|
63
|
+
beforeEach(function() {
|
|
64
|
+
iti = window.intlTelInput(input[0], {
|
|
65
|
+
separateDialCode: true,
|
|
66
|
+
nationalMode: true,
|
|
67
|
+
initialCountry: "gb",
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("formats the placeholder correctly", function() {
|
|
72
|
+
// national format
|
|
73
|
+
expect(input.attr("placeholder")).toEqual("07400 123456");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
describe("calling setNumber to a valid intl number", function() {
|
|
78
|
+
|
|
79
|
+
beforeEach(function() {
|
|
80
|
+
iti.setNumber("+447400123456");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("formats the number correctly", function() {
|
|
84
|
+
// national format
|
|
85
|
+
expect(getInputVal()).toEqual("07400 123456");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("calling getNumber returns the full intl number", function() {
|
|
89
|
+
expect(iti.getNumber()).toEqual("+447400123456");
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
// we test with "ca" (Canada) because we had some bugs with area codes
|
|
61
98
|
describe("init plugin with initialCountry=ca", function() {
|
|
62
99
|
|
|
63
100
|
beforeEach(function() {
|
|
64
101
|
iti = window.intlTelInput(input[0], {
|
|
65
102
|
separateDialCode: true,
|
|
103
|
+
nationalMode: false,
|
|
66
104
|
initialCountry: "ca",
|
|
67
105
|
});
|
|
68
106
|
});
|
|
@@ -88,6 +126,7 @@ describe("separateDialCode:", function() {
|
|
|
88
126
|
beforeEach(function() {
|
|
89
127
|
iti = window.intlTelInput(input[0], {
|
|
90
128
|
separateDialCode: true,
|
|
129
|
+
nationalMode: false,
|
|
91
130
|
initialCountry: "as",
|
|
92
131
|
});
|
|
93
132
|
});
|
|
@@ -112,6 +151,7 @@ describe("separateDialCode:", function() {
|
|
|
112
151
|
input.val("(922) 555-1234");
|
|
113
152
|
iti = window.intlTelInput(input[0], {
|
|
114
153
|
separateDialCode: true,
|
|
154
|
+
nationalMode: false,
|
|
115
155
|
initialCountry: "ru",
|
|
116
156
|
});
|
|
117
157
|
});
|