@skyux/phone-field 5.7.2 → 6.0.0-beta.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.
Files changed (53) hide show
  1. package/esm2020/index.mjs +8 -0
  2. package/esm2020/lib/modules/phone-field/phone-field-adapter.service.mjs +64 -0
  3. package/esm2020/lib/modules/phone-field/phone-field-input.directive.mjs +280 -0
  4. package/esm2020/lib/modules/phone-field/phone-field.component.mjs +332 -0
  5. package/esm2020/lib/modules/phone-field/phone-field.module.mjs +50 -0
  6. package/esm2020/lib/modules/phone-field/types/country.mjs +2 -0
  7. package/esm2020/lib/modules/phone-field/types/number-return-format.mjs +2 -0
  8. package/esm2020/lib/modules/shared/sky-phone-field-resources.module.mjs +60 -0
  9. package/esm2020/skyux-phone-field.mjs +5 -0
  10. package/esm2020/testing/phonefield/phone-field-fixture.mjs +160 -0
  11. package/esm2020/testing/phonefield/phone-field-testing.module.mjs +27 -0
  12. package/esm2020/testing/public-api.mjs +3 -0
  13. package/esm2020/testing/skyux-phone-field-testing.mjs +5 -0
  14. package/fesm2015/{skyux-phone-field-testing.js → skyux-phone-field-testing.mjs} +5 -5
  15. package/fesm2015/skyux-phone-field-testing.mjs.map +1 -0
  16. package/fesm2015/skyux-phone-field.mjs +771 -0
  17. package/fesm2015/skyux-phone-field.mjs.map +1 -0
  18. package/fesm2020/skyux-phone-field-testing.mjs +194 -0
  19. package/fesm2020/skyux-phone-field-testing.mjs.map +1 -0
  20. package/{fesm2015/skyux-phone-field.js → fesm2020/skyux-phone-field.mjs} +22 -30
  21. package/fesm2020/skyux-phone-field.mjs.map +1 -0
  22. package/package.json +42 -18
  23. package/testing/package.json +5 -5
  24. package/bundles/skyux-phone-field-testing.umd.js +0 -658
  25. package/bundles/skyux-phone-field.umd.js +0 -1162
  26. package/esm2015/index.js +0 -8
  27. package/esm2015/index.js.map +0 -1
  28. package/esm2015/lib/modules/phone-field/phone-field-adapter.service.js +0 -64
  29. package/esm2015/lib/modules/phone-field/phone-field-adapter.service.js.map +0 -1
  30. package/esm2015/lib/modules/phone-field/phone-field-input.directive.js +0 -280
  31. package/esm2015/lib/modules/phone-field/phone-field-input.directive.js.map +0 -1
  32. package/esm2015/lib/modules/phone-field/phone-field.component.js +0 -340
  33. package/esm2015/lib/modules/phone-field/phone-field.component.js.map +0 -1
  34. package/esm2015/lib/modules/phone-field/phone-field.module.js +0 -50
  35. package/esm2015/lib/modules/phone-field/phone-field.module.js.map +0 -1
  36. package/esm2015/lib/modules/phone-field/types/country.js +0 -2
  37. package/esm2015/lib/modules/phone-field/types/country.js.map +0 -1
  38. package/esm2015/lib/modules/phone-field/types/number-return-format.js +0 -2
  39. package/esm2015/lib/modules/phone-field/types/number-return-format.js.map +0 -1
  40. package/esm2015/lib/modules/shared/sky-phone-field-resources.module.js +0 -60
  41. package/esm2015/lib/modules/shared/sky-phone-field-resources.module.js.map +0 -1
  42. package/esm2015/skyux-phone-field.js +0 -5
  43. package/esm2015/skyux-phone-field.js.map +0 -1
  44. package/esm2015/testing/phonefield/phone-field-fixture.js +0 -185
  45. package/esm2015/testing/phonefield/phone-field-fixture.js.map +0 -1
  46. package/esm2015/testing/phonefield/phone-field-testing.module.js +0 -27
  47. package/esm2015/testing/phonefield/phone-field-testing.module.js.map +0 -1
  48. package/esm2015/testing/public-api.js +0 -3
  49. package/esm2015/testing/public-api.js.map +0 -1
  50. package/esm2015/testing/skyux-phone-field-testing.js +0 -5
  51. package/esm2015/testing/skyux-phone-field-testing.js.map +0 -1
  52. package/fesm2015/skyux-phone-field-testing.js.map +0 -1
  53. package/fesm2015/skyux-phone-field.js.map +0 -1
@@ -1,658 +0,0 @@
1
- (function (global, factory) {
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
-
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);
23
- }
24
-
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.16", ngImport: i0__namespace, type: SkyPhoneFieldTestingModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
33
- SkyPhoneFieldTestingModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", 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.16", 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.16", 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 __());
82
- }
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());
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;
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
-
371
- /**
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.
375
- */
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:
415
- // Wait for the country field to initialize.
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
- });
423
- });
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:
433
- // Wait for the country field to initialize.
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
- });
441
- });
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
- });
458
- });
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
- });
485
- });
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
- });
508
- });
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
- });
525
- });
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
- });
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
550
- });
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
558
- });
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
566
- });
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
574
- });
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
-
648
- /**
649
- * Generated bundle index. Do not edit.
650
- */
651
-
652
- exports.SkyPhoneFieldFixture = SkyPhoneFieldFixture;
653
- exports.SkyPhoneFieldTestingModule = SkyPhoneFieldTestingModule;
654
-
655
- Object.defineProperty(exports, '__esModule', { value: true });
656
-
657
- }));
658
- //# sourceMappingURL=skyux-phone-field-testing.umd.js.map