intl-tel-input 19.3.0 → 19.5.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/README.md +13 -5
- package/build/css/intlTelInput.css +11 -3
- package/build/css/intlTelInput.min.css +1 -1
- package/build/img/globe.png +0 -0
- package/build/img/globe@2x.png +0 -0
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput-jquery.js +25 -9
- package/build/js/intlTelInput-jquery.min.js +3 -3
- package/build/js/intlTelInput.js +25 -9
- package/build/js/intlTelInput.min.js +3 -3
- package/composer.json +1 -1
- package/demo.html +3 -3
- package/package.json +1 -1
- package/react/build/IntlTelInput.cjs.js +2 -2
- package/react/build/IntlTelInput.cjs.js.map +3 -3
- package/react/build/IntlTelInput.esm.js +2 -2
- package/react/build/IntlTelInput.esm.js.map +3 -3
- package/react/demo/simple-bundle.js +105 -99
- package/react/demo/validation-bundle.js +105 -99
- package/spec.html +2 -0
- package/src/css/intlTelInput.scss +12 -6
- package/src/js/intlTelInput.js +29 -7
- package/src/spec/helpers/helpers.js +5 -0
- package/src/spec/tests/core/initialValues.js +2 -2
- package/src/spec/tests/options/hiddenInput.js +120 -0
|
@@ -112,7 +112,7 @@ describe("initial values:", function() {
|
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
it("does not set the selected flag", function() {
|
|
115
|
-
expect(getSelectedFlagElement().attr("class")).toBe("iti__flag");
|
|
115
|
+
expect(getSelectedFlagElement().attr("class")).toBe("iti__flag iti__globe");
|
|
116
116
|
});
|
|
117
117
|
|
|
118
118
|
});
|
|
@@ -127,7 +127,7 @@ describe("initial values:", function() {
|
|
|
127
127
|
});
|
|
128
128
|
|
|
129
129
|
it("does not set the selected flag", function() {
|
|
130
|
-
expect(getSelectedFlagElement().attr("class")).toBe("iti__flag");
|
|
130
|
+
expect(getSelectedFlagElement().attr("class")).toBe("iti__flag iti__globe");
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
describe("hiddenInput: ", function() {
|
|
4
|
+
|
|
5
|
+
beforeEach(function() {
|
|
6
|
+
intlSetup();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
afterEach(function() {
|
|
10
|
+
intlTeardown();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
describe("init plugin with hiddenInput returning a string", function() {
|
|
14
|
+
|
|
15
|
+
beforeEach(function() {
|
|
16
|
+
input = $("<input>").wrap("div");
|
|
17
|
+
iti = window.intlTelInput(input[0], {
|
|
18
|
+
hiddenInput: () => "phone_full"
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("creates two hidden inputs", function() {
|
|
23
|
+
expect(getHiddenInputs()).toHaveLength(2);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("sets the name of the first hidden input to the returned string", function() {
|
|
27
|
+
expect(getHiddenInputs().eq(0)).toHaveAttr("name", "phone_full");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("sets the name of the second hidden input to the returned string with a '_country' suffix", function() {
|
|
31
|
+
expect(getHiddenInputs().eq(1)).toHaveAttr("name", "phone_full_country");
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe("init plugin with hiddenInput returning an object with correct properties", function() {
|
|
36
|
+
|
|
37
|
+
beforeEach(function() {
|
|
38
|
+
input = $("<input>").wrap("div");
|
|
39
|
+
iti = window.intlTelInput(input[0], {
|
|
40
|
+
hiddenInput: () => ({
|
|
41
|
+
phone: "phone_full",
|
|
42
|
+
country: "phone_country"
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("creates two hidden inputs", function() {
|
|
48
|
+
expect(getHiddenInputs()).toHaveLength(2);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("sets the name of the first hidden input to the returned object's 'phone' property", function() {
|
|
52
|
+
expect(getHiddenInputs().eq(0)).toHaveAttr("name", "phone_full");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("sets the name of the second hidden input to the returned object's 'country' property", function() {
|
|
56
|
+
expect(getHiddenInputs().eq(1)).toHaveAttr("name", "phone_country");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe("init plugin with hiddenInput returning an object with incorrect properties", function() {
|
|
61
|
+
|
|
62
|
+
beforeEach(function() {
|
|
63
|
+
input = $("<input name='phone'>").wrap("div");
|
|
64
|
+
iti = window.intlTelInput(input[0], {
|
|
65
|
+
hiddenInput: () => ({
|
|
66
|
+
test: "test",
|
|
67
|
+
data: "data"
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("creates two hidden inputs", function() {
|
|
73
|
+
expect(getHiddenInputs()).toHaveLength(2);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("sets the name of the hidden input to the name of the input", function() {
|
|
77
|
+
expect(getHiddenInputs().eq(0)).toHaveAttr("name", "phone");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("sets the name of the second hidden input to the name of the input with a '_country' suffix", function() {
|
|
81
|
+
expect(getHiddenInputs().eq(1)).toHaveAttr("name", "phone_country");
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe("init plugin with hiddenInput returning an empty object", function() {
|
|
86
|
+
|
|
87
|
+
beforeEach(function() {
|
|
88
|
+
input = $("<input name='phone'>").wrap("div");
|
|
89
|
+
iti = window.intlTelInput(input[0], {
|
|
90
|
+
hiddenInput: () => ({})
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("creates two hidden inputs", function() {
|
|
95
|
+
expect(getHiddenInputs()).toHaveLength(2);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("sets the name of the hidden input to the name of the input", function() {
|
|
99
|
+
expect(getHiddenInputs().eq(0)).toHaveAttr("name", "phone");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("sets the name of the second hidden input to the name of the input with a '_country' suffix", function() {
|
|
103
|
+
expect(getHiddenInputs().eq(1)).toHaveAttr("name", "phone_country");
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe("init plugin with no name attribute set on input and hiddenInput returning an empty object", function() {
|
|
108
|
+
|
|
109
|
+
beforeEach(function() {
|
|
110
|
+
input = $("<input>").wrap("div");
|
|
111
|
+
iti = window.intlTelInput(input[0], {
|
|
112
|
+
hiddenInput: () => ({})
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("does not create any hidden inputs", function() {
|
|
117
|
+
expect(getHiddenInputs()).toHaveLength(0);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
});
|