@skyux/phone-field 5.0.0-beta.0 → 5.0.2
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/LICENSE +21 -0
- package/bundles/skyux-phone-field-testing.umd.js +630 -495
- package/bundles/skyux-phone-field.umd.js +669 -442
- package/documentation.json +2159 -0
- package/esm2015/modules/phone-field/phone-field-adapter.service.js +15 -15
- package/esm2015/modules/phone-field/phone-field-input.directive.js +57 -53
- package/esm2015/modules/phone-field/phone-field.component.js +174 -128
- package/esm2015/modules/phone-field/phone-field.module.js +34 -21
- package/esm2015/modules/phone-field/types/country.js +2 -1
- package/esm2015/modules/phone-field/types/number-return-format.js +2 -1
- package/esm2015/modules/shared/sky-phone-field-resources.module.js +60 -0
- package/esm2015/public-api.js +8 -0
- package/esm2015/skyux-phone-field.js +2 -7
- package/esm2015/testing/phonefield/phone-field-fixture.js +8 -6
- package/esm2015/testing/phonefield/phone-field-testing.module.js +24 -15
- package/esm2015/testing/public-api.js +3 -0
- package/esm2015/testing/skyux-phone-field-testing.js +2 -2
- package/fesm2015/skyux-phone-field-testing.js +31 -18
- package/fesm2015/skyux-phone-field-testing.js.map +1 -1
- package/fesm2015/skyux-phone-field.js +320 -219
- package/fesm2015/skyux-phone-field.js.map +1 -1
- package/modules/phone-field/phone-field-adapter.service.d.ts +3 -0
- package/modules/phone-field/phone-field-input.directive.d.ts +3 -0
- package/modules/phone-field/phone-field.component.d.ts +3 -0
- package/modules/phone-field/phone-field.module.d.ts +13 -0
- package/modules/shared/sky-phone-field-resources.module.d.ts +14 -0
- package/package.json +13 -29
- package/public-api.d.ts +5 -0
- package/skyux-phone-field.d.ts +2 -6
- package/testing/package.json +2 -5
- package/testing/phonefield/phone-field-testing.module.d.ts +6 -0
- package/testing/{public_api.d.ts → public-api.d.ts} +0 -0
- package/testing/skyux-phone-field-testing.d.ts +2 -1
- package/CHANGELOG.md +0 -110
- package/bundles/skyux-phone-field-testing.umd.js.map +0 -1
- package/bundles/skyux-phone-field-testing.umd.min.js +0 -16
- package/bundles/skyux-phone-field-testing.umd.min.js.map +0 -1
- package/bundles/skyux-phone-field.umd.js.map +0 -1
- package/bundles/skyux-phone-field.umd.min.js +0 -16
- package/bundles/skyux-phone-field.umd.min.js.map +0 -1
- package/esm2015/modules/shared/phone-field-resources.module.js +0 -17
- package/esm2015/plugin-resources/phone-field-resources-provider.js +0 -16
- package/esm2015/public_api.js +0 -2
- package/esm2015/testing/public_api.js +0 -3
- package/esm5/modules/phone-field/phone-field-adapter.service.js +0 -65
- package/esm5/modules/phone-field/phone-field-input.directive.js +0 -284
- package/esm5/modules/phone-field/phone-field.component.js +0 -318
- package/esm5/modules/phone-field/phone-field.module.js +0 -40
- package/esm5/modules/phone-field/types/country.js +0 -1
- package/esm5/modules/phone-field/types/number-return-format.js +0 -1
- package/esm5/modules/shared/phone-field-resources.module.js +0 -20
- package/esm5/plugin-resources/phone-field-resources-provider.js +0 -17
- package/esm5/public_api.js +0 -2
- package/esm5/skyux-phone-field.js +0 -10
- package/esm5/testing/phonefield/phone-field-fixture.js +0 -280
- package/esm5/testing/phonefield/phone-field-testing.module.js +0 -21
- package/esm5/testing/public_api.js +0 -3
- package/esm5/testing/skyux-phone-field-testing.js +0 -5
- package/fesm5/skyux-phone-field-testing.js +0 -305
- package/fesm5/skyux-phone-field-testing.js.map +0 -1
- package/fesm5/skyux-phone-field.js +0 -718
- package/fesm5/skyux-phone-field.js.map +0 -1
- package/modules/shared/phone-field-resources.module.d.ts +0 -2
- package/plugin-resources/phone-field-resources-provider.d.ts +0 -5
- package/public_api.d.ts +0 -3
- package/skyux-phone-field.metadata.json +0 -1
- package/src/assets/img/guidelines/anatomy.png +0 -0
- package/src/assets/img/guidelines/phone-country-input.png +0 -0
- package/src/assets/img/guidelines/phone-country-picker.png +0 -0
- package/src/assets/img/guidelines/phone-input-base.png +0 -0
- package/src/assets/img/guidelines/phone-input-error-no-message.png +0 -0
- package/src/assets/img/guidelines/phone-input-error.png +0 -0
- package/src/assets/img/guidelines/phone-input-focused.png +0 -0
- package/src/assets/img/guidelines/phone-input-form.png +0 -0
- package/src/assets/locales/resources_en_US.json +0 -26
- package/testing/skyux-phone-field-testing.metadata.json +0 -1
|
@@ -1,523 +1,658 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/platform-browser/animations'), require('@skyux/phone-field'), require('@angular/platform-browser'), require('@skyux-sdk/testing'), require('@skyux/lookup/testing')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@skyux/phone-field/testing', ['exports', '@angular/core', '@angular/platform-browser/animations', '@skyux/phone-field', '@angular/platform-browser', '@skyux-sdk/testing', '@skyux/lookup/testing'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.skyux = global.skyux || {}, global.skyux["phone-field"] = global.skyux["phone-field"] || {}, global.skyux["phone-field"].testing = {}), global.ng.core, global.ng.platformBrowser.animations, global.skyux["phone-field"], global.ng.platformBrowser, global.testing, global.testing$1));
|
|
5
|
+
})(this, (function (exports, i0, animations, phoneField, platformBrowser, testing, testing$1) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var extendStatics = function(d, b) {
|
|
24
|
-
extendStatics = Object.setPrototypeOf ||
|
|
25
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
26
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
27
|
-
return extendStatics(d, b);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
function __extends(d, b) {
|
|
31
|
-
extendStatics(d, b);
|
|
32
|
-
function __() { this.constructor = d; }
|
|
33
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var __assign = function() {
|
|
37
|
-
__assign = Object.assign || function __assign(t) {
|
|
38
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
39
|
-
s = arguments[i];
|
|
40
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
41
|
-
}
|
|
42
|
-
return t;
|
|
43
|
-
};
|
|
44
|
-
return __assign.apply(this, arguments);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
function __rest(s, e) {
|
|
48
|
-
var t = {};
|
|
49
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
-
t[p] = s[p];
|
|
51
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
-
t[p[i]] = s[p[i]];
|
|
55
|
-
}
|
|
56
|
-
return t;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function __decorate(decorators, target, key, desc) {
|
|
60
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
61
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
62
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
63
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function __param(paramIndex, decorator) {
|
|
67
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function __metadata(metadataKey, metadataValue) {
|
|
71
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
75
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
76
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
77
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
78
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
79
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
80
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function __generator(thisArg, body) {
|
|
85
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
86
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
87
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
88
|
-
function step(op) {
|
|
89
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
90
|
-
while (_) try {
|
|
91
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
92
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
93
|
-
switch (op[0]) {
|
|
94
|
-
case 0: case 1: t = op; break;
|
|
95
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
96
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
97
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
98
|
-
default:
|
|
99
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
100
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
101
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
102
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
103
|
-
if (t[2]) _.ops.pop();
|
|
104
|
-
_.trys.pop(); continue;
|
|
105
|
-
}
|
|
106
|
-
op = body.call(thisArg, _);
|
|
107
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
108
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function __createBinding(o, m, k, k2) {
|
|
113
|
-
if (k2 === undefined) k2 = k;
|
|
114
|
-
o[k2] = m[k];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function __exportStar(m, exports) {
|
|
118
|
-
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function __values(o) {
|
|
122
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
123
|
-
if (m) return m.call(o);
|
|
124
|
-
if (o && typeof o.length === "number") return {
|
|
125
|
-
next: function () {
|
|
126
|
-
if (o && i >= o.length) o = void 0;
|
|
127
|
-
return { value: o && o[i++], done: !o };
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function __read(o, n) {
|
|
134
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
135
|
-
if (!m) return o;
|
|
136
|
-
var i = m.call(o), r, ar = [], e;
|
|
137
|
-
try {
|
|
138
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
139
|
-
}
|
|
140
|
-
catch (error) { e = { error: error }; }
|
|
141
|
-
finally {
|
|
142
|
-
try {
|
|
143
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
144
|
-
}
|
|
145
|
-
finally { if (e) throw e.error; }
|
|
146
|
-
}
|
|
147
|
-
return ar;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function __spread() {
|
|
151
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
152
|
-
ar = ar.concat(__read(arguments[i]));
|
|
153
|
-
return ar;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function __spreadArrays() {
|
|
157
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
158
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
159
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
160
|
-
r[k] = a[j];
|
|
161
|
-
return r;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
function __await(v) {
|
|
165
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
169
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
170
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
171
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
172
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
173
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
174
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
175
|
-
function fulfill(value) { resume("next", value); }
|
|
176
|
-
function reject(value) { resume("throw", value); }
|
|
177
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function __asyncDelegator(o) {
|
|
181
|
-
var i, p;
|
|
182
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
183
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function __asyncValues(o) {
|
|
187
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
188
|
-
var m = o[Symbol.asyncIterator], i;
|
|
189
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
190
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
191
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function __makeTemplateObject(cooked, raw) {
|
|
195
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
196
|
-
return cooked;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
function __importStar(mod) {
|
|
200
|
-
if (mod && mod.__esModule) return mod;
|
|
201
|
-
var result = {};
|
|
202
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
203
|
-
result.default = mod;
|
|
204
|
-
return result;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function __importDefault(mod) {
|
|
208
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function __classPrivateFieldGet(receiver, privateMap) {
|
|
212
|
-
if (!privateMap.has(receiver)) {
|
|
213
|
-
throw new TypeError("attempted to get private field on non-instance");
|
|
214
|
-
}
|
|
215
|
-
return privateMap.get(receiver);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function __classPrivateFieldSet(receiver, privateMap, value) {
|
|
219
|
-
if (!privateMap.has(receiver)) {
|
|
220
|
-
throw new TypeError("attempted to set private field on non-instance");
|
|
221
|
-
}
|
|
222
|
-
privateMap.set(receiver, value);
|
|
223
|
-
return value;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
var SkyPhoneFieldTestingModule = /** @class */ (function () {
|
|
227
|
-
function SkyPhoneFieldTestingModule() {
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
228
23
|
}
|
|
229
|
-
SkyPhoneFieldTestingModule = __decorate([
|
|
230
|
-
core.NgModule({
|
|
231
|
-
exports: [
|
|
232
|
-
phoneField.SkyPhoneFieldModule,
|
|
233
|
-
// The noop animations module needs to be loaded last to avoid
|
|
234
|
-
// subsequent modules adding animations and overriding this.
|
|
235
|
-
animations.NoopAnimationsModule
|
|
236
|
-
]
|
|
237
|
-
})
|
|
238
|
-
], SkyPhoneFieldTestingModule);
|
|
239
|
-
return SkyPhoneFieldTestingModule;
|
|
240
|
-
}());
|
|
241
24
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
25
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
+
|
|
27
|
+
var SkyPhoneFieldTestingModule = /** @class */ (function () {
|
|
28
|
+
function SkyPhoneFieldTestingModule() {
|
|
29
|
+
}
|
|
30
|
+
return SkyPhoneFieldTestingModule;
|
|
31
|
+
}());
|
|
32
|
+
SkyPhoneFieldTestingModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SkyPhoneFieldTestingModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
33
|
+
SkyPhoneFieldTestingModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SkyPhoneFieldTestingModule, exports: [phoneField.SkyPhoneFieldModule,
|
|
34
|
+
// The noop animations module needs to be loaded last to avoid
|
|
35
|
+
// subsequent modules adding animations and overriding this.
|
|
36
|
+
animations.NoopAnimationsModule] });
|
|
37
|
+
SkyPhoneFieldTestingModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SkyPhoneFieldTestingModule, imports: [phoneField.SkyPhoneFieldModule,
|
|
38
|
+
// The noop animations module needs to be loaded last to avoid
|
|
39
|
+
// subsequent modules adding animations and overriding this.
|
|
40
|
+
animations.NoopAnimationsModule] });
|
|
41
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SkyPhoneFieldTestingModule, decorators: [{
|
|
42
|
+
type: i0.NgModule,
|
|
43
|
+
args: [{
|
|
44
|
+
exports: [
|
|
45
|
+
phoneField.SkyPhoneFieldModule,
|
|
46
|
+
// The noop animations module needs to be loaded last to avoid
|
|
47
|
+
// subsequent modules adding animations and overriding this.
|
|
48
|
+
animations.NoopAnimationsModule,
|
|
49
|
+
],
|
|
50
|
+
}]
|
|
51
|
+
}] });
|
|
52
|
+
|
|
53
|
+
/*! *****************************************************************************
|
|
54
|
+
Copyright (c) Microsoft Corporation.
|
|
55
|
+
|
|
56
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
57
|
+
purpose with or without fee is hereby granted.
|
|
58
|
+
|
|
59
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
60
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
61
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
62
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
63
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
64
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
65
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
66
|
+
***************************************************************************** */
|
|
67
|
+
/* global Reflect, Promise */
|
|
68
|
+
var extendStatics = function (d, b) {
|
|
69
|
+
extendStatics = Object.setPrototypeOf ||
|
|
70
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
71
|
+
function (d, b) { for (var p in b)
|
|
72
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
73
|
+
d[p] = b[p]; };
|
|
74
|
+
return extendStatics(d, b);
|
|
75
|
+
};
|
|
76
|
+
function __extends(d, b) {
|
|
77
|
+
if (typeof b !== "function" && b !== null)
|
|
78
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
79
|
+
extendStatics(d, b);
|
|
80
|
+
function __() { this.constructor = d; }
|
|
81
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
256
82
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
83
|
+
var __assign = function () {
|
|
84
|
+
__assign = Object.assign || function __assign(t) {
|
|
85
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
86
|
+
s = arguments[i];
|
|
87
|
+
for (var p in s)
|
|
88
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
89
|
+
t[p] = s[p];
|
|
90
|
+
}
|
|
91
|
+
return t;
|
|
92
|
+
};
|
|
93
|
+
return __assign.apply(this, arguments);
|
|
94
|
+
};
|
|
95
|
+
function __rest(s, e) {
|
|
96
|
+
var t = {};
|
|
97
|
+
for (var p in s)
|
|
98
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
99
|
+
t[p] = s[p];
|
|
100
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
101
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
102
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
103
|
+
t[p[i]] = s[p[i]];
|
|
104
|
+
}
|
|
105
|
+
return t;
|
|
106
|
+
}
|
|
107
|
+
function __decorate(decorators, target, key, desc) {
|
|
108
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
109
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
110
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
111
|
+
else
|
|
112
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
113
|
+
if (d = decorators[i])
|
|
114
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
115
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
116
|
+
}
|
|
117
|
+
function __param(paramIndex, decorator) {
|
|
118
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
119
|
+
}
|
|
120
|
+
function __metadata(metadataKey, metadataValue) {
|
|
121
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
122
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
123
|
+
}
|
|
124
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
125
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
126
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
127
|
+
function fulfilled(value) { try {
|
|
128
|
+
step(generator.next(value));
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
reject(e);
|
|
132
|
+
} }
|
|
133
|
+
function rejected(value) { try {
|
|
134
|
+
step(generator["throw"](value));
|
|
135
|
+
}
|
|
136
|
+
catch (e) {
|
|
137
|
+
reject(e);
|
|
138
|
+
} }
|
|
139
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
140
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
277
141
|
});
|
|
142
|
+
}
|
|
143
|
+
function __generator(thisArg, body) {
|
|
144
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
145
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
146
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
147
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
148
|
+
function step(op) {
|
|
149
|
+
if (f)
|
|
150
|
+
throw new TypeError("Generator is already executing.");
|
|
151
|
+
while (_)
|
|
152
|
+
try {
|
|
153
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
154
|
+
return t;
|
|
155
|
+
if (y = 0, t)
|
|
156
|
+
op = [op[0] & 2, t.value];
|
|
157
|
+
switch (op[0]) {
|
|
158
|
+
case 0:
|
|
159
|
+
case 1:
|
|
160
|
+
t = op;
|
|
161
|
+
break;
|
|
162
|
+
case 4:
|
|
163
|
+
_.label++;
|
|
164
|
+
return { value: op[1], done: false };
|
|
165
|
+
case 5:
|
|
166
|
+
_.label++;
|
|
167
|
+
y = op[1];
|
|
168
|
+
op = [0];
|
|
169
|
+
continue;
|
|
170
|
+
case 7:
|
|
171
|
+
op = _.ops.pop();
|
|
172
|
+
_.trys.pop();
|
|
173
|
+
continue;
|
|
174
|
+
default:
|
|
175
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
176
|
+
_ = 0;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
180
|
+
_.label = op[1];
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
184
|
+
_.label = t[1];
|
|
185
|
+
t = op;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
if (t && _.label < t[2]) {
|
|
189
|
+
_.label = t[2];
|
|
190
|
+
_.ops.push(op);
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
if (t[2])
|
|
194
|
+
_.ops.pop();
|
|
195
|
+
_.trys.pop();
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
op = body.call(thisArg, _);
|
|
199
|
+
}
|
|
200
|
+
catch (e) {
|
|
201
|
+
op = [6, e];
|
|
202
|
+
y = 0;
|
|
203
|
+
}
|
|
204
|
+
finally {
|
|
205
|
+
f = t = 0;
|
|
206
|
+
}
|
|
207
|
+
if (op[0] & 5)
|
|
208
|
+
throw op[1];
|
|
209
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
213
|
+
if (k2 === undefined)
|
|
214
|
+
k2 = k;
|
|
215
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
216
|
+
}) : (function (o, m, k, k2) {
|
|
217
|
+
if (k2 === undefined)
|
|
218
|
+
k2 = k;
|
|
219
|
+
o[k2] = m[k];
|
|
220
|
+
});
|
|
221
|
+
function __exportStar(m, o) {
|
|
222
|
+
for (var p in m)
|
|
223
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
224
|
+
__createBinding(o, m, p);
|
|
225
|
+
}
|
|
226
|
+
function __values(o) {
|
|
227
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
228
|
+
if (m)
|
|
229
|
+
return m.call(o);
|
|
230
|
+
if (o && typeof o.length === "number")
|
|
231
|
+
return {
|
|
232
|
+
next: function () {
|
|
233
|
+
if (o && i >= o.length)
|
|
234
|
+
o = void 0;
|
|
235
|
+
return { value: o && o[i++], done: !o };
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
239
|
+
}
|
|
240
|
+
function __read(o, n) {
|
|
241
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
242
|
+
if (!m)
|
|
243
|
+
return o;
|
|
244
|
+
var i = m.call(o), r, ar = [], e;
|
|
245
|
+
try {
|
|
246
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
247
|
+
ar.push(r.value);
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
e = { error: error };
|
|
251
|
+
}
|
|
252
|
+
finally {
|
|
253
|
+
try {
|
|
254
|
+
if (r && !r.done && (m = i["return"]))
|
|
255
|
+
m.call(i);
|
|
256
|
+
}
|
|
257
|
+
finally {
|
|
258
|
+
if (e)
|
|
259
|
+
throw e.error;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return ar;
|
|
263
|
+
}
|
|
264
|
+
/** @deprecated */
|
|
265
|
+
function __spread() {
|
|
266
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
267
|
+
ar = ar.concat(__read(arguments[i]));
|
|
268
|
+
return ar;
|
|
269
|
+
}
|
|
270
|
+
/** @deprecated */
|
|
271
|
+
function __spreadArrays() {
|
|
272
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
273
|
+
s += arguments[i].length;
|
|
274
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
275
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
276
|
+
r[k] = a[j];
|
|
277
|
+
return r;
|
|
278
|
+
}
|
|
279
|
+
function __spreadArray(to, from, pack) {
|
|
280
|
+
if (pack || arguments.length === 2)
|
|
281
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
282
|
+
if (ar || !(i in from)) {
|
|
283
|
+
if (!ar)
|
|
284
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
285
|
+
ar[i] = from[i];
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
289
|
+
}
|
|
290
|
+
function __await(v) {
|
|
291
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
292
|
+
}
|
|
293
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
294
|
+
if (!Symbol.asyncIterator)
|
|
295
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
296
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
297
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
298
|
+
function verb(n) { if (g[n])
|
|
299
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
300
|
+
function resume(n, v) { try {
|
|
301
|
+
step(g[n](v));
|
|
302
|
+
}
|
|
303
|
+
catch (e) {
|
|
304
|
+
settle(q[0][3], e);
|
|
305
|
+
} }
|
|
306
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
307
|
+
function fulfill(value) { resume("next", value); }
|
|
308
|
+
function reject(value) { resume("throw", value); }
|
|
309
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
310
|
+
resume(q[0][0], q[0][1]); }
|
|
311
|
+
}
|
|
312
|
+
function __asyncDelegator(o) {
|
|
313
|
+
var i, p;
|
|
314
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
315
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
316
|
+
}
|
|
317
|
+
function __asyncValues(o) {
|
|
318
|
+
if (!Symbol.asyncIterator)
|
|
319
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
320
|
+
var m = o[Symbol.asyncIterator], i;
|
|
321
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
322
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
323
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
324
|
+
}
|
|
325
|
+
function __makeTemplateObject(cooked, raw) {
|
|
326
|
+
if (Object.defineProperty) {
|
|
327
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
cooked.raw = raw;
|
|
331
|
+
}
|
|
332
|
+
return cooked;
|
|
333
|
+
}
|
|
334
|
+
;
|
|
335
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
336
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
337
|
+
}) : function (o, v) {
|
|
338
|
+
o["default"] = v;
|
|
278
339
|
};
|
|
340
|
+
function __importStar(mod) {
|
|
341
|
+
if (mod && mod.__esModule)
|
|
342
|
+
return mod;
|
|
343
|
+
var result = {};
|
|
344
|
+
if (mod != null)
|
|
345
|
+
for (var k in mod)
|
|
346
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
347
|
+
__createBinding(result, mod, k);
|
|
348
|
+
__setModuleDefault(result, mod);
|
|
349
|
+
return result;
|
|
350
|
+
}
|
|
351
|
+
function __importDefault(mod) {
|
|
352
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
353
|
+
}
|
|
354
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
355
|
+
if (kind === "a" && !f)
|
|
356
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
357
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
358
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
359
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
360
|
+
}
|
|
361
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
362
|
+
if (kind === "m")
|
|
363
|
+
throw new TypeError("Private method is not writable");
|
|
364
|
+
if (kind === "a" && !f)
|
|
365
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
366
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
367
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
368
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
369
|
+
}
|
|
370
|
+
|
|
279
371
|
/**
|
|
280
|
-
*
|
|
372
|
+
* Provides information for and interaction with a SKY UX phone field component.
|
|
373
|
+
* By using the fixture API, a test insulates itself against updates to the internals
|
|
374
|
+
* of a component, such as changing its DOM structure.
|
|
281
375
|
*/
|
|
282
|
-
SkyPhoneFieldFixture
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
376
|
+
var SkyPhoneFieldFixture = /** @class */ (function () {
|
|
377
|
+
function SkyPhoneFieldFixture(fixture, skyTestId) {
|
|
378
|
+
this.fixture = fixture;
|
|
379
|
+
this.skyTestId = skyTestId;
|
|
380
|
+
this._debugEl = testing.SkyAppTestUtility.getDebugElementByTestId(fixture, skyTestId, 'sky-phone-field');
|
|
381
|
+
// The country selector needs extra time to initialize.
|
|
382
|
+
// Consumers shouldn't need to work around this so we do an extra detect here
|
|
383
|
+
fixture.detectChanges();
|
|
384
|
+
}
|
|
385
|
+
Object.defineProperty(SkyPhoneFieldFixture.prototype, "inputText", {
|
|
386
|
+
/**
|
|
387
|
+
* The value of the input field for the phone field.
|
|
388
|
+
*/
|
|
389
|
+
get: function () {
|
|
390
|
+
return this.phoneFieldInput.value;
|
|
391
|
+
},
|
|
392
|
+
enumerable: false,
|
|
393
|
+
configurable: true
|
|
394
|
+
});
|
|
395
|
+
/**
|
|
396
|
+
* Blurs the phone field input and returns a promise that indicates when the action is complete.
|
|
397
|
+
*/
|
|
398
|
+
SkyPhoneFieldFixture.prototype.blur = function () {
|
|
399
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
400
|
+
return __generator(this, function (_a) {
|
|
401
|
+
testing.SkyAppTestUtility.fireDomEvent(this.phoneFieldInput, 'blur');
|
|
402
|
+
this.fixture.detectChanges();
|
|
403
|
+
return [2 /*return*/, this.fixture.whenStable()];
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
/**
|
|
408
|
+
* Returns the selected country iso2 code.
|
|
409
|
+
*/
|
|
410
|
+
SkyPhoneFieldFixture.prototype.getSelectedCountryIso2 = function () {
|
|
411
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
412
|
+
return __generator(this, function (_a) {
|
|
413
|
+
switch (_a.label) {
|
|
414
|
+
case 0:
|
|
290
415
|
// Wait for the country field to initialize.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
416
|
+
return [4 /*yield*/, this.fixture.whenStable()];
|
|
417
|
+
case 1:
|
|
418
|
+
// Wait for the country field to initialize.
|
|
419
|
+
_a.sent();
|
|
420
|
+
return [2 /*return*/, this.countryFlagButtonContainer.getAttribute('data-sky-test-iso2')];
|
|
421
|
+
}
|
|
422
|
+
});
|
|
294
423
|
});
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
case 0:
|
|
305
|
-
// Wait for the country field to initialize.
|
|
306
|
-
return [4 /*yield*/, this.fixture.whenStable()];
|
|
307
|
-
case 1:
|
|
424
|
+
};
|
|
425
|
+
/**
|
|
426
|
+
* Returns the selected country name.
|
|
427
|
+
*/
|
|
428
|
+
SkyPhoneFieldFixture.prototype.getSelectedCountryName = function () {
|
|
429
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
430
|
+
return __generator(this, function (_a) {
|
|
431
|
+
switch (_a.label) {
|
|
432
|
+
case 0:
|
|
308
433
|
// Wait for the country field to initialize.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
434
|
+
return [4 /*yield*/, this.fixture.whenStable()];
|
|
435
|
+
case 1:
|
|
436
|
+
// Wait for the country field to initialize.
|
|
437
|
+
_a.sent();
|
|
438
|
+
return [2 /*return*/, this.countryFlagButtonContainer.getAttribute('data-sky-test-name')];
|
|
439
|
+
}
|
|
440
|
+
});
|
|
312
441
|
});
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
442
|
+
};
|
|
443
|
+
/**
|
|
444
|
+
* Sets the value of the input field for the phone field.
|
|
445
|
+
*/
|
|
446
|
+
SkyPhoneFieldFixture.prototype.setInputText = function (inputText) {
|
|
447
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
448
|
+
var inputEl;
|
|
449
|
+
return __generator(this, function (_a) {
|
|
450
|
+
inputEl = this.phoneFieldInput;
|
|
451
|
+
inputEl.value = inputText;
|
|
452
|
+
testing.SkyAppTestUtility.fireDomEvent(inputEl, 'input');
|
|
453
|
+
this.fixture.detectChanges();
|
|
454
|
+
testing.SkyAppTestUtility.fireDomEvent(inputEl, 'change');
|
|
455
|
+
this.fixture.detectChanges();
|
|
456
|
+
return [2 /*return*/, this.fixture.whenStable()];
|
|
457
|
+
});
|
|
329
458
|
});
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
459
|
+
};
|
|
460
|
+
/**
|
|
461
|
+
* Opens the country selector, peforms a search, but makes no selection.
|
|
462
|
+
* @param searchText The name of the country to select.
|
|
463
|
+
* @returns The list of country names matching the search text.
|
|
464
|
+
*/
|
|
465
|
+
SkyPhoneFieldFixture.prototype.searchCountry = function (searchText) {
|
|
466
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
467
|
+
var countryFixture, results;
|
|
468
|
+
return __generator(this, function (_a) {
|
|
469
|
+
switch (_a.label) {
|
|
470
|
+
case 0: return [4 /*yield*/, this.openCountrySelection()];
|
|
471
|
+
case 1:
|
|
472
|
+
_a.sent();
|
|
473
|
+
return [4 /*yield*/, this.getCountryFixture()];
|
|
474
|
+
case 2:
|
|
475
|
+
countryFixture = _a.sent();
|
|
476
|
+
return [4 /*yield*/, countryFixture.search(searchText)];
|
|
477
|
+
case 3:
|
|
478
|
+
results = _a.sent();
|
|
479
|
+
return [4 /*yield*/, this.waitForCountrySelection()];
|
|
480
|
+
case 4:
|
|
481
|
+
_a.sent();
|
|
482
|
+
return [2 /*return*/, results];
|
|
483
|
+
}
|
|
484
|
+
});
|
|
356
485
|
});
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* Opens the country selector, performs a search, and selects the first result (if any).
|
|
489
|
+
* @param searchText The name of the country to select.
|
|
490
|
+
*/
|
|
491
|
+
SkyPhoneFieldFixture.prototype.selectCountry = function (searchText) {
|
|
492
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
493
|
+
var countryFixture;
|
|
494
|
+
return __generator(this, function (_a) {
|
|
495
|
+
switch (_a.label) {
|
|
496
|
+
case 0: return [4 /*yield*/, this.openCountrySelection()];
|
|
497
|
+
case 1:
|
|
498
|
+
_a.sent();
|
|
499
|
+
return [4 /*yield*/, this.getCountryFixture()];
|
|
500
|
+
case 2:
|
|
501
|
+
countryFixture = _a.sent();
|
|
502
|
+
return [4 /*yield*/, countryFixture.searchAndSelectFirstResult(searchText)];
|
|
503
|
+
case 3:
|
|
504
|
+
_a.sent();
|
|
505
|
+
return [2 /*return*/, this.waitForCountrySelection()];
|
|
506
|
+
}
|
|
507
|
+
});
|
|
379
508
|
});
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
return [
|
|
394
|
-
|
|
395
|
-
}
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* Gets a boolean promise indicating if the phone field is disabled.
|
|
512
|
+
*/
|
|
513
|
+
SkyPhoneFieldFixture.prototype.isDisabled = function () {
|
|
514
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
515
|
+
var disabled, _a;
|
|
516
|
+
return __generator(this, function (_b) {
|
|
517
|
+
switch (_b.label) {
|
|
518
|
+
case 0:
|
|
519
|
+
disabled = this.phoneFieldInput.getAttribute('disabled');
|
|
520
|
+
_a = this.coerceBooleanProperty;
|
|
521
|
+
return [4 /*yield*/, disabled];
|
|
522
|
+
case 1: return [2 /*return*/, _a.apply(this, [_b.sent()])];
|
|
523
|
+
}
|
|
524
|
+
});
|
|
396
525
|
});
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* Gets a boolean promise indicating if the phone field is valid.
|
|
529
|
+
*/
|
|
530
|
+
SkyPhoneFieldFixture.prototype.isValid = function () {
|
|
531
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
532
|
+
return __generator(this, function (_a) {
|
|
533
|
+
switch (_a.label) {
|
|
534
|
+
case 0: return [4 /*yield*/, this.hasFormControl()];
|
|
535
|
+
case 1:
|
|
536
|
+
if (!(_a.sent())) {
|
|
537
|
+
throw new Error("Form control not found.");
|
|
538
|
+
}
|
|
539
|
+
return [2 /*return*/, this.phoneFieldInput.classList.contains('ng-valid')];
|
|
540
|
+
}
|
|
541
|
+
});
|
|
413
542
|
});
|
|
543
|
+
};
|
|
544
|
+
Object.defineProperty(SkyPhoneFieldFixture.prototype, "countryElement", {
|
|
545
|
+
get: function () {
|
|
546
|
+
return this._debugEl.query(platformBrowser.By.css('sky-country-field')).nativeElement;
|
|
547
|
+
},
|
|
548
|
+
enumerable: false,
|
|
549
|
+
configurable: true
|
|
414
550
|
});
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
});
|
|
423
|
-
Object.defineProperty(SkyPhoneFieldFixture.prototype, "countryFlagButtonContainer", {
|
|
424
|
-
get: function () {
|
|
425
|
-
return this._debugEl.query(platformBrowser.By.css('.sky-phone-field-country-btn')).nativeElement;
|
|
426
|
-
},
|
|
427
|
-
enumerable: true,
|
|
428
|
-
configurable: true
|
|
429
|
-
});
|
|
430
|
-
Object.defineProperty(SkyPhoneFieldFixture.prototype, "countryFlagButton", {
|
|
431
|
-
get: function () {
|
|
432
|
-
return this._debugEl.query(platformBrowser.By.css('.sky-phone-field-country-btn .sky-btn')).nativeElement;
|
|
433
|
-
},
|
|
434
|
-
enumerable: true,
|
|
435
|
-
configurable: true
|
|
436
|
-
});
|
|
437
|
-
Object.defineProperty(SkyPhoneFieldFixture.prototype, "phoneFieldInput", {
|
|
438
|
-
get: function () {
|
|
439
|
-
return this._debugEl.query(platformBrowser.By.css('input[skyPhoneFieldInput]')).nativeElement;
|
|
440
|
-
},
|
|
441
|
-
enumerable: true,
|
|
442
|
-
configurable: true
|
|
443
|
-
});
|
|
444
|
-
/**
|
|
445
|
-
* The country-field can take a really long time to initialize. Since we can't perform an await
|
|
446
|
-
* in our constructor, it's safest to do a lazy load of the country field to avoid any race
|
|
447
|
-
* conditions where a test tries to access the sky-country-field element too quickly.
|
|
448
|
-
*/
|
|
449
|
-
SkyPhoneFieldFixture.prototype.getCountryFixture = function () {
|
|
450
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
451
|
-
var countrySkyTestId;
|
|
452
|
-
return __generator(this, function (_a) {
|
|
453
|
-
switch (_a.label) {
|
|
454
|
-
case 0:
|
|
455
|
-
if (!(this._countryFixture === undefined)) return [3 /*break*/, 2];
|
|
456
|
-
countrySkyTestId = this.skyTestId + "-country";
|
|
457
|
-
this.setSkyTestId(this.countryElement, countrySkyTestId);
|
|
458
|
-
// initialize the country fixture
|
|
459
|
-
this._countryFixture = new testing$1.SkyCountryFieldFixture(this.fixture, countrySkyTestId);
|
|
460
|
-
this.fixture.detectChanges();
|
|
461
|
-
return [4 /*yield*/, this.fixture.whenStable()];
|
|
462
|
-
case 1:
|
|
463
|
-
_a.sent();
|
|
464
|
-
_a.label = 2;
|
|
465
|
-
case 2: return [2 /*return*/, this._countryFixture];
|
|
466
|
-
}
|
|
467
|
-
});
|
|
551
|
+
Object.defineProperty(SkyPhoneFieldFixture.prototype, "countryFlagButtonContainer", {
|
|
552
|
+
get: function () {
|
|
553
|
+
return this._debugEl.query(platformBrowser.By.css('.sky-phone-field-country-btn'))
|
|
554
|
+
.nativeElement;
|
|
555
|
+
},
|
|
556
|
+
enumerable: false,
|
|
557
|
+
configurable: true
|
|
468
558
|
});
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
559
|
+
Object.defineProperty(SkyPhoneFieldFixture.prototype, "countryFlagButton", {
|
|
560
|
+
get: function () {
|
|
561
|
+
return this._debugEl.query(platformBrowser.By.css('.sky-phone-field-country-btn .sky-btn'))
|
|
562
|
+
.nativeElement;
|
|
563
|
+
},
|
|
564
|
+
enumerable: false,
|
|
565
|
+
configurable: true
|
|
476
566
|
});
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
switch (_a.label) {
|
|
485
|
-
case 0:
|
|
486
|
-
// any country selection needs extra time to complete
|
|
487
|
-
this.fixture.detectChanges();
|
|
488
|
-
return [4 /*yield*/, this.fixture.whenStable()];
|
|
489
|
-
case 1:
|
|
490
|
-
_a.sent();
|
|
491
|
-
this.fixture.detectChanges();
|
|
492
|
-
return [2 /*return*/, this.fixture.whenStable()];
|
|
493
|
-
}
|
|
494
|
-
});
|
|
567
|
+
Object.defineProperty(SkyPhoneFieldFixture.prototype, "phoneFieldInput", {
|
|
568
|
+
get: function () {
|
|
569
|
+
return this._debugEl.query(platformBrowser.By.css('input[skyPhoneFieldInput]'))
|
|
570
|
+
.nativeElement;
|
|
571
|
+
},
|
|
572
|
+
enumerable: false,
|
|
573
|
+
configurable: true
|
|
495
574
|
});
|
|
496
|
-
|
|
575
|
+
/**
|
|
576
|
+
* The country-field can take a really long time to initialize. Since we can't perform an await
|
|
577
|
+
* in our constructor, it's safest to do a lazy load of the country field to avoid any race
|
|
578
|
+
* conditions where a test tries to access the sky-country-field element too quickly.
|
|
579
|
+
*/
|
|
580
|
+
SkyPhoneFieldFixture.prototype.getCountryFixture = function () {
|
|
581
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
582
|
+
var countrySkyTestId;
|
|
583
|
+
return __generator(this, function (_a) {
|
|
584
|
+
switch (_a.label) {
|
|
585
|
+
case 0:
|
|
586
|
+
if (!(this._countryFixture === undefined)) return [3 /*break*/, 2];
|
|
587
|
+
countrySkyTestId = this.skyTestId + "-country";
|
|
588
|
+
this.setSkyTestId(this.countryElement, countrySkyTestId);
|
|
589
|
+
// initialize the country fixture
|
|
590
|
+
this._countryFixture = new testing$1.SkyCountryFieldFixture(this.fixture, countrySkyTestId);
|
|
591
|
+
this.fixture.detectChanges();
|
|
592
|
+
return [4 /*yield*/, this.fixture.whenStable()];
|
|
593
|
+
case 1:
|
|
594
|
+
_a.sent();
|
|
595
|
+
_a.label = 2;
|
|
596
|
+
case 2: return [2 /*return*/, this._countryFixture];
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
SkyPhoneFieldFixture.prototype.openCountrySelection = function () {
|
|
602
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
603
|
+
return __generator(this, function (_a) {
|
|
604
|
+
this.countryFlagButton.click();
|
|
605
|
+
return [2 /*return*/, this.waitForCountrySelection()];
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
};
|
|
609
|
+
SkyPhoneFieldFixture.prototype.setSkyTestId = function (element, skyTestId) {
|
|
610
|
+
element.setAttribute('data-sky-id', skyTestId);
|
|
611
|
+
};
|
|
612
|
+
SkyPhoneFieldFixture.prototype.waitForCountrySelection = function () {
|
|
613
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
614
|
+
return __generator(this, function (_a) {
|
|
615
|
+
switch (_a.label) {
|
|
616
|
+
case 0:
|
|
617
|
+
// any country selection needs extra time to complete
|
|
618
|
+
this.fixture.detectChanges();
|
|
619
|
+
return [4 /*yield*/, this.fixture.whenStable()];
|
|
620
|
+
case 1:
|
|
621
|
+
_a.sent();
|
|
622
|
+
this.fixture.detectChanges();
|
|
623
|
+
return [2 /*return*/, this.fixture.whenStable()];
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
};
|
|
628
|
+
/**
|
|
629
|
+
* Checks whether the form-field control has set up a form control.
|
|
630
|
+
*/
|
|
631
|
+
SkyPhoneFieldFixture.prototype.hasFormControl = function () {
|
|
632
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
633
|
+
var isTouched, isUntouched;
|
|
634
|
+
return __generator(this, function (_a) {
|
|
635
|
+
isTouched = this.phoneFieldInput.classList.contains('ng-touched');
|
|
636
|
+
isUntouched = this.phoneFieldInput.classList.contains('ng-untouched');
|
|
637
|
+
return [2 /*return*/, isTouched || isUntouched];
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
};
|
|
641
|
+
SkyPhoneFieldFixture.prototype.coerceBooleanProperty = function (value) {
|
|
642
|
+
// tslint:disable-next-line: no-null-keyword
|
|
643
|
+
return value != null && "" + value !== 'false';
|
|
644
|
+
};
|
|
645
|
+
return SkyPhoneFieldFixture;
|
|
646
|
+
}());
|
|
647
|
+
|
|
497
648
|
/**
|
|
498
|
-
*
|
|
649
|
+
* Generated bundle index. Do not edit.
|
|
499
650
|
*/
|
|
500
|
-
SkyPhoneFieldFixture.prototype.hasFormControl = function () {
|
|
501
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
502
|
-
var isTouched, isUntouched;
|
|
503
|
-
return __generator(this, function (_a) {
|
|
504
|
-
isTouched = this.phoneFieldInput.classList.contains('ng-touched');
|
|
505
|
-
isUntouched = this.phoneFieldInput.classList.contains('ng-untouched');
|
|
506
|
-
return [2 /*return*/, isTouched || isUntouched];
|
|
507
|
-
});
|
|
508
|
-
});
|
|
509
|
-
};
|
|
510
|
-
SkyPhoneFieldFixture.prototype.coerceBooleanProperty = function (value) {
|
|
511
|
-
// tslint:disable-next-line: no-null-keyword
|
|
512
|
-
return value != null && "" + value !== 'false';
|
|
513
|
-
};
|
|
514
|
-
return SkyPhoneFieldFixture;
|
|
515
|
-
}());
|
|
516
651
|
|
|
517
|
-
|
|
518
|
-
|
|
652
|
+
exports.SkyPhoneFieldFixture = SkyPhoneFieldFixture;
|
|
653
|
+
exports.SkyPhoneFieldTestingModule = SkyPhoneFieldTestingModule;
|
|
519
654
|
|
|
520
|
-
|
|
655
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
521
656
|
|
|
522
|
-
}))
|
|
657
|
+
}));
|
|
523
658
|
//# sourceMappingURL=skyux-phone-field-testing.umd.js.map
|