@taiga-ui/testing 3.60.0 → 3.61.0-canary.2abddb0
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/bundles/taiga-ui-testing-core.umd.js +1373 -1519
- package/bundles/taiga-ui-testing-core.umd.js.map +1 -1
- package/bundles/taiga-ui-testing-cypress.umd.js +25 -171
- package/bundles/taiga-ui-testing-cypress.umd.js.map +1 -1
- package/bundles/taiga-ui-testing-exceptions.umd.js +338 -484
- package/bundles/taiga-ui-testing-exceptions.umd.js.map +1 -1
- package/bundles/taiga-ui-testing-mocks.umd.js +357 -503
- package/bundles/taiga-ui-testing-mocks.umd.js.map +1 -1
- package/bundles/taiga-ui-testing-setup-jest.umd.js +19 -19
- package/bundles/taiga-ui-testing-setup-jest.umd.js.map +1 -1
- package/bundles/taiga-ui-testing-utils.umd.js +73 -219
- package/bundles/taiga-ui-testing-utils.umd.js.map +1 -1
- package/esm2015/core/accordion-item.harness.js +8 -8
- package/esm2015/core/accordion.harness.js +3 -3
- package/esm2015/core/action.harness.js +2 -2
- package/esm2015/core/avatar.harness.js +2 -2
- package/esm2015/core/badge.harness.js +3 -3
- package/esm2015/core/button.harness.js +2 -2
- package/esm2015/core/calendar.harness.js +3 -3
- package/esm2015/core/card.harness.js +5 -5
- package/esm2015/core/dialog.harness.js +3 -3
- package/esm2015/core/hosted-dropdown.harness.js +3 -3
- package/esm2015/core/island.harness.js +13 -13
- package/esm2015/core/loader.harness.js +4 -4
- package/esm2015/core/marker-icon.harness.js +2 -2
- package/esm2015/core/primitive-calender.harness.js +7 -7
- package/esm2015/core/primitive-spin-button.harness.js +4 -4
- package/esm2015/core/primitive-textfield.harness.js +4 -4
- package/esm2015/core/primitive-year-month-pagination.harness.js +7 -7
- package/esm2015/core/primitive-year-picker.harness.js +5 -5
- package/esm2015/core/select.harness.js +2 -2
- package/esm2015/core/svg.harness.js +4 -4
- package/esm2015/core/tag.harness.js +6 -6
- package/esm2015/core/textfield.harness.js +3 -3
- package/esm2015/core/toggle.harness.js +3 -3
- package/esm2015/cypress/assertions/be-in-viewport.js +4 -4
- package/esm2015/cypress/commands/wait-all-img-inside.command.js +9 -9
- package/esm2015/cypress/snapshot/command.js +5 -5
- package/esm2015/cypress/snapshot/plugin.js +6 -6
- package/esm2015/setup-jest/index.js +20 -20
- package/esm2015/utils/active-element.js +3 -3
- package/esm2015/utils/helpers.js +2 -2
- package/esm2015/utils/input/cleaner.unit-common.js +12 -12
- package/esm2015/utils/input/filler.unit-common.js +9 -9
- package/esm2015/utils/input/form-control-state.unit-common.js +9 -9
- package/esm2015/utils/input/placeholder.unit-common.js +17 -17
- package/esm2015/utils/input/tooltip.unit-common.js +8 -8
- package/esm2015/utils/keyboard-event.js +4 -4
- package/esm2015/utils/native-input.page-object.js +4 -4
- package/esm2015/utils/page-object.js +3 -3
- package/esm2015/utils/replace-nbsp.js +2 -2
- package/esm2015/utils/viewport.js +5 -5
- package/fesm2015/taiga-ui-testing-core.js +75 -75
- package/fesm2015/taiga-ui-testing-core.js.map +1 -1
- package/fesm2015/taiga-ui-testing-cypress.js +19 -19
- package/fesm2015/taiga-ui-testing-cypress.js.map +1 -1
- package/fesm2015/taiga-ui-testing-setup-jest.js +19 -19
- package/fesm2015/taiga-ui-testing-setup-jest.js.map +1 -1
- package/fesm2015/taiga-ui-testing-utils.js +66 -66
- package/fesm2015/taiga-ui-testing-utils.js.map +1 -1
- package/package.json +17 -17
@@ -5,29 +5,29 @@
|
|
5
5
|
})(this, (function (exports, testing, cdk, testing$1) { 'use strict';
|
6
6
|
|
7
7
|
function tuiCreateKeyboardEvent(key, eventType) {
|
8
|
-
if (eventType === void 0) { eventType =
|
8
|
+
if (eventType === void 0) { eventType = 'keydown'; }
|
9
9
|
var event = new KeyboardEvent(eventType, { bubbles: true });
|
10
10
|
delete event.target;
|
11
|
-
Object.defineProperty(event,
|
11
|
+
Object.defineProperty(event, 'type', { value: eventType });
|
12
12
|
delete event.key;
|
13
|
-
Object.defineProperty(event,
|
13
|
+
Object.defineProperty(event, 'key', { value: key });
|
14
14
|
return event;
|
15
15
|
}
|
16
16
|
|
17
17
|
function tuiDispatchOnActive(key, fixture) {
|
18
18
|
var _a;
|
19
|
-
(_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.dispatchEvent(tuiCreateKeyboardEvent(key,
|
19
|
+
(_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.dispatchEvent(tuiCreateKeyboardEvent(key, 'keydown'));
|
20
20
|
fixture === null || fixture === void 0 ? void 0 : fixture.detectChanges();
|
21
21
|
}
|
22
22
|
function tuiActiveText() {
|
23
23
|
var _a, _b, _c;
|
24
|
-
return (_c = (_b = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c :
|
24
|
+
return (_c = (_b = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
|
25
25
|
}
|
26
26
|
function tuiIsActive(element) {
|
27
27
|
return document.activeElement === element;
|
28
28
|
}
|
29
29
|
|
30
|
-
|
30
|
+
/*! *****************************************************************************
|
31
31
|
Copyright (c) Microsoft Corporation.
|
32
32
|
|
33
33
|
Permission to use, copy, modify, and/or distribute this software for any
|
@@ -41,7 +41,7 @@
|
|
41
41
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
42
42
|
PERFORMANCE OF THIS SOFTWARE.
|
43
43
|
***************************************************************************** */
|
44
|
-
/* global Reflect, Promise
|
44
|
+
/* global Reflect, Promise */
|
45
45
|
var extendStatics = function (d, b) {
|
46
46
|
extendStatics = Object.setPrototypeOf ||
|
47
47
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
@@ -94,64 +94,6 @@
|
|
94
94
|
function __param(paramIndex, decorator) {
|
95
95
|
return function (target, key) { decorator(target, key, paramIndex); };
|
96
96
|
}
|
97
|
-
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
98
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function")
|
99
|
-
throw new TypeError("Function expected"); return f; }
|
100
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
101
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
102
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
103
|
-
var _, done = false;
|
104
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
105
|
-
var context = {};
|
106
|
-
for (var p in contextIn)
|
107
|
-
context[p] = p === "access" ? {} : contextIn[p];
|
108
|
-
for (var p in contextIn.access)
|
109
|
-
context.access[p] = contextIn.access[p];
|
110
|
-
context.addInitializer = function (f) { if (done)
|
111
|
-
throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
112
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
113
|
-
if (kind === "accessor") {
|
114
|
-
if (result === void 0)
|
115
|
-
continue;
|
116
|
-
if (result === null || typeof result !== "object")
|
117
|
-
throw new TypeError("Object expected");
|
118
|
-
if (_ = accept(result.get))
|
119
|
-
descriptor.get = _;
|
120
|
-
if (_ = accept(result.set))
|
121
|
-
descriptor.set = _;
|
122
|
-
if (_ = accept(result.init))
|
123
|
-
initializers.unshift(_);
|
124
|
-
}
|
125
|
-
else if (_ = accept(result)) {
|
126
|
-
if (kind === "field")
|
127
|
-
initializers.unshift(_);
|
128
|
-
else
|
129
|
-
descriptor[key] = _;
|
130
|
-
}
|
131
|
-
}
|
132
|
-
if (target)
|
133
|
-
Object.defineProperty(target, contextIn.name, descriptor);
|
134
|
-
done = true;
|
135
|
-
}
|
136
|
-
;
|
137
|
-
function __runInitializers(thisArg, initializers, value) {
|
138
|
-
var useValue = arguments.length > 2;
|
139
|
-
for (var i = 0; i < initializers.length; i++) {
|
140
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
141
|
-
}
|
142
|
-
return useValue ? value : void 0;
|
143
|
-
}
|
144
|
-
;
|
145
|
-
function __propKey(x) {
|
146
|
-
return typeof x === "symbol" ? x : "".concat(x);
|
147
|
-
}
|
148
|
-
;
|
149
|
-
function __setFunctionName(f, name, prefix) {
|
150
|
-
if (typeof name === "symbol")
|
151
|
-
name = name.description ? "[".concat(name.description, "]") : "";
|
152
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
153
|
-
}
|
154
|
-
;
|
155
97
|
function __metadata(metadataKey, metadataValue) {
|
156
98
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
157
99
|
return Reflect.metadata(metadataKey, metadataValue);
|
@@ -183,7 +125,7 @@
|
|
183
125
|
function step(op) {
|
184
126
|
if (f)
|
185
127
|
throw new TypeError("Generator is already executing.");
|
186
|
-
while (
|
128
|
+
while (_)
|
187
129
|
try {
|
188
130
|
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)
|
189
131
|
return t;
|
@@ -247,11 +189,7 @@
|
|
247
189
|
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
248
190
|
if (k2 === undefined)
|
249
191
|
k2 = k;
|
250
|
-
|
251
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
252
|
-
desc = { enumerable: true, get: function () { return m[k]; } };
|
253
|
-
}
|
254
|
-
Object.defineProperty(o, k2, desc);
|
192
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
255
193
|
}) : (function (o, m, k, k2) {
|
256
194
|
if (k2 === undefined)
|
257
195
|
k2 = k;
|
@@ -324,7 +262,7 @@
|
|
324
262
|
ar[i] = from[i];
|
325
263
|
}
|
326
264
|
}
|
327
|
-
return to.concat(ar ||
|
265
|
+
return to.concat(ar || from);
|
328
266
|
}
|
329
267
|
function __await(v) {
|
330
268
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
@@ -351,7 +289,7 @@
|
|
351
289
|
function __asyncDelegator(o) {
|
352
290
|
var i, p;
|
353
291
|
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
354
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done:
|
292
|
+
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; }
|
355
293
|
}
|
356
294
|
function __asyncValues(o) {
|
357
295
|
if (!Symbol.asyncIterator)
|
@@ -406,90 +344,6 @@
|
|
406
344
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
407
345
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
408
346
|
}
|
409
|
-
function __classPrivateFieldIn(state, receiver) {
|
410
|
-
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
|
411
|
-
throw new TypeError("Cannot use 'in' operator on non-object");
|
412
|
-
return typeof state === "function" ? receiver === state : state.has(receiver);
|
413
|
-
}
|
414
|
-
function __addDisposableResource(env, value, async) {
|
415
|
-
if (value !== null && value !== void 0) {
|
416
|
-
if (typeof value !== "object" && typeof value !== "function")
|
417
|
-
throw new TypeError("Object expected.");
|
418
|
-
var dispose;
|
419
|
-
if (async) {
|
420
|
-
if (!Symbol.asyncDispose)
|
421
|
-
throw new TypeError("Symbol.asyncDispose is not defined.");
|
422
|
-
dispose = value[Symbol.asyncDispose];
|
423
|
-
}
|
424
|
-
if (dispose === void 0) {
|
425
|
-
if (!Symbol.dispose)
|
426
|
-
throw new TypeError("Symbol.dispose is not defined.");
|
427
|
-
dispose = value[Symbol.dispose];
|
428
|
-
}
|
429
|
-
if (typeof dispose !== "function")
|
430
|
-
throw new TypeError("Object not disposable.");
|
431
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
432
|
-
}
|
433
|
-
else if (async) {
|
434
|
-
env.stack.push({ async: true });
|
435
|
-
}
|
436
|
-
return value;
|
437
|
-
}
|
438
|
-
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
439
|
-
var e = new Error(message);
|
440
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
441
|
-
};
|
442
|
-
function __disposeResources(env) {
|
443
|
-
function fail(e) {
|
444
|
-
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
445
|
-
env.hasError = true;
|
446
|
-
}
|
447
|
-
function next() {
|
448
|
-
while (env.stack.length) {
|
449
|
-
var rec = env.stack.pop();
|
450
|
-
try {
|
451
|
-
var result = rec.dispose && rec.dispose.call(rec.value);
|
452
|
-
if (rec.async)
|
453
|
-
return Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
|
454
|
-
}
|
455
|
-
catch (e) {
|
456
|
-
fail(e);
|
457
|
-
}
|
458
|
-
}
|
459
|
-
if (env.hasError)
|
460
|
-
throw env.error;
|
461
|
-
}
|
462
|
-
return next();
|
463
|
-
}
|
464
|
-
var tslib_es6 = {
|
465
|
-
__extends: __extends,
|
466
|
-
__assign: __assign,
|
467
|
-
__rest: __rest,
|
468
|
-
__decorate: __decorate,
|
469
|
-
__param: __param,
|
470
|
-
__metadata: __metadata,
|
471
|
-
__awaiter: __awaiter,
|
472
|
-
__generator: __generator,
|
473
|
-
__createBinding: __createBinding,
|
474
|
-
__exportStar: __exportStar,
|
475
|
-
__values: __values,
|
476
|
-
__read: __read,
|
477
|
-
__spread: __spread,
|
478
|
-
__spreadArrays: __spreadArrays,
|
479
|
-
__spreadArray: __spreadArray,
|
480
|
-
__await: __await,
|
481
|
-
__asyncGenerator: __asyncGenerator,
|
482
|
-
__asyncDelegator: __asyncDelegator,
|
483
|
-
__asyncValues: __asyncValues,
|
484
|
-
__makeTemplateObject: __makeTemplateObject,
|
485
|
-
__importStar: __importStar,
|
486
|
-
__importDefault: __importDefault,
|
487
|
-
__classPrivateFieldGet: __classPrivateFieldGet,
|
488
|
-
__classPrivateFieldSet: __classPrivateFieldSet,
|
489
|
-
__classPrivateFieldIn: __classPrivateFieldIn,
|
490
|
-
__addDisposableResource: __addDisposableResource,
|
491
|
-
__disposeResources: __disposeResources,
|
492
|
-
};
|
493
347
|
|
494
348
|
/** deprecated, will be removed in 4.0 */
|
495
349
|
var configureTestSuite = function (configureModule) {
|
@@ -575,7 +429,7 @@
|
|
575
429
|
// @ts-ignore
|
576
430
|
_a.with = function (_options) {
|
577
431
|
if (_options === void 0) { _options = {}; }
|
578
|
-
throw new Error(
|
432
|
+
throw new Error('Hummus');
|
579
433
|
};
|
580
434
|
return _a;
|
581
435
|
}(testing$1.ComponentHarness)),
|
@@ -605,13 +459,13 @@
|
|
605
459
|
|
606
460
|
/// <reference types="jest" />
|
607
461
|
function tuiTestCleaner(context, setValue, clearValue) {
|
608
|
-
if (setValue === void 0) { setValue =
|
462
|
+
if (setValue === void 0) { setValue = 'value'; }
|
609
463
|
if (clearValue === void 0) { clearValue = null; }
|
610
464
|
var pageObject;
|
611
465
|
var fixture;
|
612
466
|
var testComponent;
|
613
467
|
var inputPO;
|
614
|
-
describe(
|
468
|
+
describe('Cross for field cleaning', function () {
|
615
469
|
beforeEach(function () {
|
616
470
|
pageObject = context.pageObject;
|
617
471
|
fixture = context.fixture;
|
@@ -619,22 +473,22 @@
|
|
619
473
|
inputPO = context.inputPO;
|
620
474
|
fixture.autoDetectChanges();
|
621
475
|
});
|
622
|
-
describe(
|
476
|
+
describe('Cross included', function () {
|
623
477
|
beforeEach(function () {
|
624
478
|
testComponent.cleaner = true;
|
625
479
|
});
|
626
|
-
it(
|
480
|
+
it('If no value is specified, the cross is not shown', function () {
|
627
481
|
updateValue(clearValue);
|
628
482
|
fixture.detectChanges();
|
629
483
|
expect(getCleaner()).toBeNull();
|
630
484
|
});
|
631
|
-
it(
|
485
|
+
it('If the field is readonly, the cross is not shown', function () {
|
632
486
|
updateValue(setValue);
|
633
487
|
testComponent.readOnly = true;
|
634
488
|
fixture.detectChanges();
|
635
489
|
expect(getCleaner()).toBeNull();
|
636
490
|
});
|
637
|
-
it(
|
491
|
+
it('If the field is disabled, the cross is not shown', function () {
|
638
492
|
updateValue(setValue);
|
639
493
|
if (testComponent.control) {
|
640
494
|
testComponent.control.disable();
|
@@ -643,17 +497,17 @@
|
|
643
497
|
fixture.detectChanges();
|
644
498
|
expect(getCleaner()).toBeNull();
|
645
499
|
});
|
646
|
-
it(
|
500
|
+
it('If a value is specified, a cross is shown', function () {
|
647
501
|
updateValue(setValue);
|
648
502
|
fixture.detectChanges();
|
649
503
|
expect(getCleaner()).not.toBeNull();
|
650
504
|
});
|
651
|
-
it(
|
505
|
+
it('When you click on the cross, the field value is cleared', function () {
|
652
506
|
updateValue(setValue);
|
653
507
|
fixture.detectChanges();
|
654
508
|
getCleaner().nativeElement.click();
|
655
509
|
fixture.detectChanges();
|
656
|
-
expect(inputPO.value).toBe(
|
510
|
+
expect(inputPO.value).toBe('');
|
657
511
|
if (testComponent.control !== undefined) {
|
658
512
|
expect(testComponent.control.value).toEqual(clearValue);
|
659
513
|
}
|
@@ -662,8 +516,8 @@
|
|
662
516
|
}
|
663
517
|
});
|
664
518
|
});
|
665
|
-
describe(
|
666
|
-
it(
|
519
|
+
describe('Cross disabled', function () {
|
520
|
+
it('The value is set, the cross is not shown', function () {
|
667
521
|
updateValue(setValue);
|
668
522
|
testComponent.cleaner = false;
|
669
523
|
fixture.detectChanges();
|
@@ -686,13 +540,13 @@
|
|
686
540
|
|
687
541
|
function tuiTestFiller(context, setValue, clearValue) {
|
688
542
|
var _this = this;
|
689
|
-
if (setValue === void 0) { setValue =
|
543
|
+
if (setValue === void 0) { setValue = 'value'; }
|
690
544
|
if (clearValue === void 0) { clearValue = null; }
|
691
545
|
var pageObject;
|
692
546
|
var fixture;
|
693
547
|
var testComponent;
|
694
548
|
var inputPO;
|
695
|
-
describe(
|
549
|
+
describe('Filler (mask)', function () {
|
696
550
|
beforeEach(function () {
|
697
551
|
pageObject = context.pageObject;
|
698
552
|
fixture = context.fixture;
|
@@ -700,15 +554,15 @@
|
|
700
554
|
inputPO = context.inputPO;
|
701
555
|
fixture.detectChanges();
|
702
556
|
});
|
703
|
-
describe(
|
557
|
+
describe('if there is no value in the field', function () {
|
704
558
|
beforeEach(function () {
|
705
559
|
testComponent.control.setValue(clearValue);
|
706
560
|
fixture.detectChanges();
|
707
561
|
});
|
708
|
-
it(
|
562
|
+
it('not visible', function () {
|
709
563
|
expect(getFiller()).toBeNull();
|
710
564
|
});
|
711
|
-
it(
|
565
|
+
it('when focusing appears', function () { return __awaiter(_this, void 0, void 0, function () {
|
712
566
|
return __generator(this, function (_b) {
|
713
567
|
switch (_b.label) {
|
714
568
|
case 0:
|
@@ -723,15 +577,15 @@
|
|
723
577
|
});
|
724
578
|
}); });
|
725
579
|
});
|
726
|
-
describe(
|
580
|
+
describe('if the field has a value', function () {
|
727
581
|
beforeEach(function () {
|
728
582
|
testComponent.control.setValue(setValue);
|
729
583
|
fixture.detectChanges();
|
730
584
|
});
|
731
|
-
it(
|
585
|
+
it('not visible', function () {
|
732
586
|
expect(getFiller()).toBeNull();
|
733
587
|
});
|
734
|
-
it(
|
588
|
+
it('also not visible when focusing', function () {
|
735
589
|
var _a;
|
736
590
|
(_a = inputPO.nativeElement) === null || _a === void 0 ? void 0 : _a.focus();
|
737
591
|
fixture.detectChanges();
|
@@ -749,29 +603,29 @@
|
|
749
603
|
var fixture;
|
750
604
|
var testComponent;
|
751
605
|
var inputPO;
|
752
|
-
describe(
|
606
|
+
describe('FormControl state', function () {
|
753
607
|
beforeEach(function () {
|
754
608
|
fixture = context.fixture;
|
755
609
|
testComponent = context.testComponent;
|
756
610
|
inputPO = context.inputPO;
|
757
611
|
fixture.detectChanges();
|
758
612
|
});
|
759
|
-
it(
|
613
|
+
it('After initializing control dirty === false', function () {
|
760
614
|
expect(testComponent.control.dirty).toBe(false);
|
761
615
|
});
|
762
|
-
it(
|
616
|
+
it('After control initialization touched === false', function () {
|
763
617
|
expect(testComponent.control.touched).toBe(false);
|
764
618
|
});
|
765
|
-
it(
|
766
|
-
testComponent.control.setValue(
|
619
|
+
it('After setting value from outside dirty === false', function () {
|
620
|
+
testComponent.control.setValue('123');
|
767
621
|
fixture.detectChanges();
|
768
622
|
expect(testComponent.control.dirty).toBe(false);
|
769
623
|
});
|
770
|
-
it(
|
771
|
-
inputPO.sendText(
|
624
|
+
it('After entering the value dirty === true', function () {
|
625
|
+
inputPO.sendText('123');
|
772
626
|
expect(testComponent.control.dirty).toBe(true);
|
773
627
|
});
|
774
|
-
it(
|
628
|
+
it('After setting and de-focusing touched === true', function () { return __awaiter(_this, void 0, void 0, function () {
|
775
629
|
return __generator(this, function (_a) {
|
776
630
|
switch (_a.label) {
|
777
631
|
case 0:
|
@@ -790,74 +644,74 @@
|
|
790
644
|
}
|
791
645
|
|
792
646
|
function tuiTestPlaceholder(context, setValue, clearValue) {
|
793
|
-
if (setValue === void 0) { setValue =
|
794
|
-
if (clearValue === void 0) { clearValue =
|
647
|
+
if (setValue === void 0) { setValue = 'value'; }
|
648
|
+
if (clearValue === void 0) { clearValue = ''; }
|
795
649
|
var pageObject;
|
796
650
|
var fixture;
|
797
651
|
var testComponent;
|
798
|
-
describe(
|
652
|
+
describe('Placeholder', function () {
|
799
653
|
beforeEach(function () {
|
800
654
|
pageObject = context.pageObject;
|
801
655
|
fixture = context.fixture;
|
802
656
|
testComponent = context.testComponent;
|
803
657
|
fixture.autoDetectChanges();
|
804
658
|
});
|
805
|
-
describe(
|
659
|
+
describe('in size S', function () {
|
806
660
|
beforeEach(function () {
|
807
|
-
testComponent.size =
|
661
|
+
testComponent.size = 's';
|
808
662
|
fixture.detectChanges();
|
809
663
|
});
|
810
|
-
it(
|
664
|
+
it('if no value, then shown', function () {
|
811
665
|
updateValue(clearValue);
|
812
666
|
fixture.detectChanges();
|
813
667
|
expect(getPlaceholder()).not.toBeNull();
|
814
668
|
});
|
815
|
-
it(
|
669
|
+
it('if specified, not shown', function () {
|
816
670
|
updateValue(setValue);
|
817
671
|
fixture.detectChanges();
|
818
672
|
expect(getPlaceholder()).toBeNull();
|
819
673
|
});
|
820
674
|
});
|
821
|
-
describe(
|
675
|
+
describe('in size M', function () {
|
822
676
|
beforeEach(function () {
|
823
|
-
testComponent.size =
|
677
|
+
testComponent.size = 'm';
|
824
678
|
fixture.detectChanges();
|
825
679
|
});
|
826
|
-
it(
|
680
|
+
it('if no value, then shown', function () {
|
827
681
|
updateValue(clearValue);
|
828
682
|
fixture.detectChanges();
|
829
683
|
expect(getPlaceholder()).not.toBeNull();
|
830
684
|
});
|
831
|
-
it(
|
685
|
+
it('if a value is given, then', function () {
|
832
686
|
updateValue(setValue);
|
833
687
|
testComponent.labelOutside = false;
|
834
688
|
fixture.detectChanges();
|
835
689
|
expect(getPlaceholder()).not.toBeNull();
|
836
690
|
});
|
837
|
-
it(
|
691
|
+
it('if value is given but label is outside, then not shown', function () {
|
838
692
|
updateValue(setValue);
|
839
693
|
testComponent.labelOutside = true;
|
840
694
|
fixture.detectChanges();
|
841
695
|
expect(getPlaceholder()).toBeNull();
|
842
696
|
});
|
843
697
|
});
|
844
|
-
describe(
|
698
|
+
describe('in size L', function () {
|
845
699
|
beforeEach(function () {
|
846
|
-
testComponent.size =
|
700
|
+
testComponent.size = 'l';
|
847
701
|
fixture.detectChanges();
|
848
702
|
});
|
849
|
-
it(
|
703
|
+
it('if no value, then shown', function () {
|
850
704
|
updateValue(clearValue);
|
851
705
|
fixture.detectChanges();
|
852
706
|
expect(getPlaceholder()).not.toBeNull();
|
853
707
|
});
|
854
|
-
it(
|
708
|
+
it('if a value is given, then', function () {
|
855
709
|
updateValue(setValue);
|
856
710
|
testComponent.labelOutside = false;
|
857
711
|
fixture.detectChanges();
|
858
712
|
expect(getPlaceholder()).not.toBeNull();
|
859
713
|
});
|
860
|
-
it(
|
714
|
+
it('if value is given but label is outside, then not shown', function () {
|
861
715
|
updateValue(setValue);
|
862
716
|
testComponent.labelOutside = true;
|
863
717
|
fixture.detectChanges();
|
@@ -882,15 +736,15 @@
|
|
882
736
|
var pageObject;
|
883
737
|
var fixture;
|
884
738
|
var testComponent;
|
885
|
-
describe(
|
739
|
+
describe('Tooltip in a field', function () {
|
886
740
|
beforeEach(function () {
|
887
741
|
pageObject = context.pageObject;
|
888
742
|
fixture = context.fixture;
|
889
743
|
testComponent = context.testComponent;
|
890
744
|
fixture.autoDetectChanges();
|
891
745
|
});
|
892
|
-
describe(
|
893
|
-
it(
|
746
|
+
describe('There is tooltip content', function () {
|
747
|
+
it('if field is disabled, there is no tooltip', function () {
|
894
748
|
testComponent.disabled = true;
|
895
749
|
if (testComponent.control) {
|
896
750
|
testComponent.control.disable();
|
@@ -898,22 +752,22 @@
|
|
898
752
|
fixture.detectChanges();
|
899
753
|
expect(getTooltip()).toBeNull();
|
900
754
|
});
|
901
|
-
it(
|
755
|
+
it('if field is not disabled, there is tooltip', function () {
|
902
756
|
fixture.detectChanges();
|
903
757
|
expect(getTooltip()).not.toBeNull();
|
904
758
|
});
|
905
|
-
it(
|
759
|
+
it('if field is readonly, there is tooltip', function () {
|
906
760
|
testComponent.readOnly = true;
|
907
761
|
fixture.detectChanges();
|
908
762
|
expect(getTooltip()).not.toBeNull();
|
909
763
|
});
|
910
764
|
});
|
911
|
-
describe(
|
765
|
+
describe('There is no tooltip content', function () {
|
912
766
|
beforeEach(function () {
|
913
767
|
testComponent.hintContent = null;
|
914
768
|
fixture.detectChanges();
|
915
769
|
});
|
916
|
-
it(
|
770
|
+
it('tooltip without content is hidden', function () {
|
917
771
|
fixture.detectChanges();
|
918
772
|
expect(getTooltip()).toBeNull();
|
919
773
|
});
|
@@ -930,8 +784,8 @@
|
|
930
784
|
}
|
931
785
|
TuiPageObject.getIds = function (_a) {
|
932
786
|
var nativeElement = _a.nativeElement;
|
933
|
-
var attributeValue = nativeElement.getAttribute(
|
934
|
-
return attributeValue === null ? [] : attributeValue.split(
|
787
|
+
var attributeValue = nativeElement.getAttribute('automation-id');
|
788
|
+
return attributeValue === null ? [] : attributeValue.split(' ');
|
935
789
|
};
|
936
790
|
TuiPageObject.containsId = function (debugElement, automationId) {
|
937
791
|
return TuiPageObject.getIds(debugElement).includes(automationId);
|
@@ -955,7 +809,7 @@
|
|
955
809
|
|
956
810
|
function tuiReplaceNbsp(content) {
|
957
811
|
var _a;
|
958
|
-
return (_a = content === null || content === void 0 ? void 0 : content.replace(new RegExp(cdk.CHAR_NO_BREAK_SPACE,
|
812
|
+
return (_a = content === null || content === void 0 ? void 0 : content.replace(new RegExp(cdk.CHAR_NO_BREAK_SPACE, 'g'), ' ')) !== null && _a !== void 0 ? _a : '';
|
959
813
|
}
|
960
814
|
|
961
815
|
var TuiNativeInputPO = /** @class */ (function () {
|
@@ -976,7 +830,7 @@
|
|
976
830
|
Object.defineProperty(TuiNativeInputPO.prototype, "value", {
|
977
831
|
get: function () {
|
978
832
|
var _a, _b;
|
979
|
-
return tuiReplaceNbsp((_b = (_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b :
|
833
|
+
return tuiReplaceNbsp((_b = (_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '');
|
980
834
|
},
|
981
835
|
enumerable: false,
|
982
836
|
configurable: true
|
@@ -993,7 +847,7 @@
|
|
993
847
|
var nativeElement = this.nativeElement;
|
994
848
|
if (nativeElement) {
|
995
849
|
nativeElement.value = value;
|
996
|
-
nativeElement.dispatchEvent(new Event(
|
850
|
+
nativeElement.dispatchEvent(new Event('input', { bubbles: true }));
|
997
851
|
}
|
998
852
|
this.fixture.detectChanges();
|
999
853
|
};
|
@@ -1005,7 +859,7 @@
|
|
1005
859
|
};
|
1006
860
|
TuiNativeInputPO.prototype.sendKeydown = function (key) {
|
1007
861
|
var _a;
|
1008
|
-
(_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.dispatchEvent(tuiCreateKeyboardEvent(key,
|
862
|
+
(_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.dispatchEvent(tuiCreateKeyboardEvent(key, 'keydown'));
|
1009
863
|
this.fixture.detectChanges();
|
1010
864
|
};
|
1011
865
|
TuiNativeInputPO.prototype.focus = function () {
|
@@ -1027,22 +881,22 @@
|
|
1027
881
|
}());
|
1028
882
|
|
1029
883
|
function tuiTestingViewport(width, height) {
|
1030
|
-
Object.defineProperty(global,
|
884
|
+
Object.defineProperty(global, 'innerWidth', {
|
1031
885
|
writable: true,
|
1032
886
|
configurable: true,
|
1033
887
|
value: width,
|
1034
888
|
});
|
1035
|
-
Object.defineProperty(global.document.documentElement,
|
889
|
+
Object.defineProperty(global.document.documentElement, 'clientWidth', {
|
1036
890
|
writable: true,
|
1037
891
|
configurable: true,
|
1038
892
|
value: width - 15,
|
1039
893
|
});
|
1040
|
-
Object.defineProperty(global,
|
894
|
+
Object.defineProperty(global, 'innerHeight', {
|
1041
895
|
writable: true,
|
1042
896
|
configurable: true,
|
1043
897
|
value: height,
|
1044
898
|
});
|
1045
|
-
Object.defineProperty(global.document.documentElement,
|
899
|
+
Object.defineProperty(global.document.documentElement, 'clientHeight', {
|
1046
900
|
writable: true,
|
1047
901
|
configurable: true,
|
1048
902
|
value: height,
|