@taiga-ui/testing 3.59.0 → 3.60.0-canary.799e7d6
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 +78 -78
- package/bundles/taiga-ui-testing-core.umd.js.map +1 -1
- package/bundles/taiga-ui-testing-cypress.umd.js +19 -19
- package/bundles/taiga-ui-testing-cypress.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 +67 -67
- 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,23 +5,23 @@
|
|
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;
|
@@ -429,7 +429,7 @@
|
|
429
429
|
// @ts-ignore
|
430
430
|
_a.with = function (_options) {
|
431
431
|
if (_options === void 0) { _options = {}; }
|
432
|
-
throw new Error(
|
432
|
+
throw new Error('Hummus');
|
433
433
|
};
|
434
434
|
return _a;
|
435
435
|
}(testing$1.ComponentHarness)),
|
@@ -459,13 +459,13 @@
|
|
459
459
|
|
460
460
|
/// <reference types="jest" />
|
461
461
|
function tuiTestCleaner(context, setValue, clearValue) {
|
462
|
-
if (setValue === void 0) { setValue =
|
462
|
+
if (setValue === void 0) { setValue = 'value'; }
|
463
463
|
if (clearValue === void 0) { clearValue = null; }
|
464
464
|
var pageObject;
|
465
465
|
var fixture;
|
466
466
|
var testComponent;
|
467
467
|
var inputPO;
|
468
|
-
describe(
|
468
|
+
describe('Cross for field cleaning', function () {
|
469
469
|
beforeEach(function () {
|
470
470
|
pageObject = context.pageObject;
|
471
471
|
fixture = context.fixture;
|
@@ -473,22 +473,22 @@
|
|
473
473
|
inputPO = context.inputPO;
|
474
474
|
fixture.autoDetectChanges();
|
475
475
|
});
|
476
|
-
describe(
|
476
|
+
describe('Cross included', function () {
|
477
477
|
beforeEach(function () {
|
478
478
|
testComponent.cleaner = true;
|
479
479
|
});
|
480
|
-
it(
|
480
|
+
it('If no value is specified, the cross is not shown', function () {
|
481
481
|
updateValue(clearValue);
|
482
482
|
fixture.detectChanges();
|
483
483
|
expect(getCleaner()).toBeNull();
|
484
484
|
});
|
485
|
-
it(
|
485
|
+
it('If the field is readonly, the cross is not shown', function () {
|
486
486
|
updateValue(setValue);
|
487
487
|
testComponent.readOnly = true;
|
488
488
|
fixture.detectChanges();
|
489
489
|
expect(getCleaner()).toBeNull();
|
490
490
|
});
|
491
|
-
it(
|
491
|
+
it('If the field is disabled, the cross is not shown', function () {
|
492
492
|
updateValue(setValue);
|
493
493
|
if (testComponent.control) {
|
494
494
|
testComponent.control.disable();
|
@@ -497,17 +497,17 @@
|
|
497
497
|
fixture.detectChanges();
|
498
498
|
expect(getCleaner()).toBeNull();
|
499
499
|
});
|
500
|
-
it(
|
500
|
+
it('If a value is specified, a cross is shown', function () {
|
501
501
|
updateValue(setValue);
|
502
502
|
fixture.detectChanges();
|
503
503
|
expect(getCleaner()).not.toBeNull();
|
504
504
|
});
|
505
|
-
it(
|
505
|
+
it('When you click on the cross, the field value is cleared', function () {
|
506
506
|
updateValue(setValue);
|
507
507
|
fixture.detectChanges();
|
508
508
|
getCleaner().nativeElement.click();
|
509
509
|
fixture.detectChanges();
|
510
|
-
expect(inputPO.value).toBe(
|
510
|
+
expect(inputPO.value).toBe('');
|
511
511
|
if (testComponent.control !== undefined) {
|
512
512
|
expect(testComponent.control.value).toEqual(clearValue);
|
513
513
|
}
|
@@ -516,8 +516,8 @@
|
|
516
516
|
}
|
517
517
|
});
|
518
518
|
});
|
519
|
-
describe(
|
520
|
-
it(
|
519
|
+
describe('Cross disabled', function () {
|
520
|
+
it('The value is set, the cross is not shown', function () {
|
521
521
|
updateValue(setValue);
|
522
522
|
testComponent.cleaner = false;
|
523
523
|
fixture.detectChanges();
|
@@ -540,13 +540,13 @@
|
|
540
540
|
|
541
541
|
function tuiTestFiller(context, setValue, clearValue) {
|
542
542
|
var _this = this;
|
543
|
-
if (setValue === void 0) { setValue =
|
543
|
+
if (setValue === void 0) { setValue = 'value'; }
|
544
544
|
if (clearValue === void 0) { clearValue = null; }
|
545
545
|
var pageObject;
|
546
546
|
var fixture;
|
547
547
|
var testComponent;
|
548
548
|
var inputPO;
|
549
|
-
describe(
|
549
|
+
describe('Filler (mask)', function () {
|
550
550
|
beforeEach(function () {
|
551
551
|
pageObject = context.pageObject;
|
552
552
|
fixture = context.fixture;
|
@@ -554,15 +554,15 @@
|
|
554
554
|
inputPO = context.inputPO;
|
555
555
|
fixture.detectChanges();
|
556
556
|
});
|
557
|
-
describe(
|
557
|
+
describe('if there is no value in the field', function () {
|
558
558
|
beforeEach(function () {
|
559
559
|
testComponent.control.setValue(clearValue);
|
560
560
|
fixture.detectChanges();
|
561
561
|
});
|
562
|
-
it(
|
562
|
+
it('not visible', function () {
|
563
563
|
expect(getFiller()).toBeNull();
|
564
564
|
});
|
565
|
-
it(
|
565
|
+
it('when focusing appears', function () { return __awaiter(_this, void 0, void 0, function () {
|
566
566
|
return __generator(this, function (_b) {
|
567
567
|
switch (_b.label) {
|
568
568
|
case 0:
|
@@ -577,15 +577,15 @@
|
|
577
577
|
});
|
578
578
|
}); });
|
579
579
|
});
|
580
|
-
describe(
|
580
|
+
describe('if the field has a value', function () {
|
581
581
|
beforeEach(function () {
|
582
582
|
testComponent.control.setValue(setValue);
|
583
583
|
fixture.detectChanges();
|
584
584
|
});
|
585
|
-
it(
|
585
|
+
it('not visible', function () {
|
586
586
|
expect(getFiller()).toBeNull();
|
587
587
|
});
|
588
|
-
it(
|
588
|
+
it('also not visible when focusing', function () {
|
589
589
|
var _a;
|
590
590
|
(_a = inputPO.nativeElement) === null || _a === void 0 ? void 0 : _a.focus();
|
591
591
|
fixture.detectChanges();
|
@@ -603,29 +603,29 @@
|
|
603
603
|
var fixture;
|
604
604
|
var testComponent;
|
605
605
|
var inputPO;
|
606
|
-
describe(
|
606
|
+
describe('FormControl state', function () {
|
607
607
|
beforeEach(function () {
|
608
608
|
fixture = context.fixture;
|
609
609
|
testComponent = context.testComponent;
|
610
610
|
inputPO = context.inputPO;
|
611
611
|
fixture.detectChanges();
|
612
612
|
});
|
613
|
-
it(
|
613
|
+
it('After initializing control dirty === false', function () {
|
614
614
|
expect(testComponent.control.dirty).toBe(false);
|
615
615
|
});
|
616
|
-
it(
|
616
|
+
it('After control initialization touched === false', function () {
|
617
617
|
expect(testComponent.control.touched).toBe(false);
|
618
618
|
});
|
619
|
-
it(
|
620
|
-
testComponent.control.setValue(
|
619
|
+
it('After setting value from outside dirty === false', function () {
|
620
|
+
testComponent.control.setValue('123');
|
621
621
|
fixture.detectChanges();
|
622
622
|
expect(testComponent.control.dirty).toBe(false);
|
623
623
|
});
|
624
|
-
it(
|
625
|
-
inputPO.sendText(
|
624
|
+
it('After entering the value dirty === true', function () {
|
625
|
+
inputPO.sendText('123');
|
626
626
|
expect(testComponent.control.dirty).toBe(true);
|
627
627
|
});
|
628
|
-
it(
|
628
|
+
it('After setting and de-focusing touched === true', function () { return __awaiter(_this, void 0, void 0, function () {
|
629
629
|
return __generator(this, function (_a) {
|
630
630
|
switch (_a.label) {
|
631
631
|
case 0:
|
@@ -644,74 +644,74 @@
|
|
644
644
|
}
|
645
645
|
|
646
646
|
function tuiTestPlaceholder(context, setValue, clearValue) {
|
647
|
-
if (setValue === void 0) { setValue =
|
648
|
-
if (clearValue === void 0) { clearValue =
|
647
|
+
if (setValue === void 0) { setValue = 'value'; }
|
648
|
+
if (clearValue === void 0) { clearValue = ''; }
|
649
649
|
var pageObject;
|
650
650
|
var fixture;
|
651
651
|
var testComponent;
|
652
|
-
describe(
|
652
|
+
describe('Placeholder', function () {
|
653
653
|
beforeEach(function () {
|
654
654
|
pageObject = context.pageObject;
|
655
655
|
fixture = context.fixture;
|
656
656
|
testComponent = context.testComponent;
|
657
657
|
fixture.autoDetectChanges();
|
658
658
|
});
|
659
|
-
describe(
|
659
|
+
describe('in size S', function () {
|
660
660
|
beforeEach(function () {
|
661
|
-
testComponent.size =
|
661
|
+
testComponent.size = 's';
|
662
662
|
fixture.detectChanges();
|
663
663
|
});
|
664
|
-
it(
|
664
|
+
it('if no value, then shown', function () {
|
665
665
|
updateValue(clearValue);
|
666
666
|
fixture.detectChanges();
|
667
667
|
expect(getPlaceholder()).not.toBeNull();
|
668
668
|
});
|
669
|
-
it(
|
669
|
+
it('if specified, not shown', function () {
|
670
670
|
updateValue(setValue);
|
671
671
|
fixture.detectChanges();
|
672
672
|
expect(getPlaceholder()).toBeNull();
|
673
673
|
});
|
674
674
|
});
|
675
|
-
describe(
|
675
|
+
describe('in size M', function () {
|
676
676
|
beforeEach(function () {
|
677
|
-
testComponent.size =
|
677
|
+
testComponent.size = 'm';
|
678
678
|
fixture.detectChanges();
|
679
679
|
});
|
680
|
-
it(
|
680
|
+
it('if no value, then shown', function () {
|
681
681
|
updateValue(clearValue);
|
682
682
|
fixture.detectChanges();
|
683
683
|
expect(getPlaceholder()).not.toBeNull();
|
684
684
|
});
|
685
|
-
it(
|
685
|
+
it('if a value is given, then', function () {
|
686
686
|
updateValue(setValue);
|
687
687
|
testComponent.labelOutside = false;
|
688
688
|
fixture.detectChanges();
|
689
689
|
expect(getPlaceholder()).not.toBeNull();
|
690
690
|
});
|
691
|
-
it(
|
691
|
+
it('if value is given but label is outside, then not shown', function () {
|
692
692
|
updateValue(setValue);
|
693
693
|
testComponent.labelOutside = true;
|
694
694
|
fixture.detectChanges();
|
695
695
|
expect(getPlaceholder()).toBeNull();
|
696
696
|
});
|
697
697
|
});
|
698
|
-
describe(
|
698
|
+
describe('in size L', function () {
|
699
699
|
beforeEach(function () {
|
700
|
-
testComponent.size =
|
700
|
+
testComponent.size = 'l';
|
701
701
|
fixture.detectChanges();
|
702
702
|
});
|
703
|
-
it(
|
703
|
+
it('if no value, then shown', function () {
|
704
704
|
updateValue(clearValue);
|
705
705
|
fixture.detectChanges();
|
706
706
|
expect(getPlaceholder()).not.toBeNull();
|
707
707
|
});
|
708
|
-
it(
|
708
|
+
it('if a value is given, then', function () {
|
709
709
|
updateValue(setValue);
|
710
710
|
testComponent.labelOutside = false;
|
711
711
|
fixture.detectChanges();
|
712
712
|
expect(getPlaceholder()).not.toBeNull();
|
713
713
|
});
|
714
|
-
it(
|
714
|
+
it('if value is given but label is outside, then not shown', function () {
|
715
715
|
updateValue(setValue);
|
716
716
|
testComponent.labelOutside = true;
|
717
717
|
fixture.detectChanges();
|
@@ -736,15 +736,15 @@
|
|
736
736
|
var pageObject;
|
737
737
|
var fixture;
|
738
738
|
var testComponent;
|
739
|
-
describe(
|
739
|
+
describe('Tooltip in a field', function () {
|
740
740
|
beforeEach(function () {
|
741
741
|
pageObject = context.pageObject;
|
742
742
|
fixture = context.fixture;
|
743
743
|
testComponent = context.testComponent;
|
744
744
|
fixture.autoDetectChanges();
|
745
745
|
});
|
746
|
-
describe(
|
747
|
-
it(
|
746
|
+
describe('There is tooltip content', function () {
|
747
|
+
it('if field is disabled, there is no tooltip', function () {
|
748
748
|
testComponent.disabled = true;
|
749
749
|
if (testComponent.control) {
|
750
750
|
testComponent.control.disable();
|
@@ -752,22 +752,22 @@
|
|
752
752
|
fixture.detectChanges();
|
753
753
|
expect(getTooltip()).toBeNull();
|
754
754
|
});
|
755
|
-
it(
|
755
|
+
it('if field is not disabled, there is tooltip', function () {
|
756
756
|
fixture.detectChanges();
|
757
757
|
expect(getTooltip()).not.toBeNull();
|
758
758
|
});
|
759
|
-
it(
|
759
|
+
it('if field is readonly, there is tooltip', function () {
|
760
760
|
testComponent.readOnly = true;
|
761
761
|
fixture.detectChanges();
|
762
762
|
expect(getTooltip()).not.toBeNull();
|
763
763
|
});
|
764
764
|
});
|
765
|
-
describe(
|
765
|
+
describe('There is no tooltip content', function () {
|
766
766
|
beforeEach(function () {
|
767
767
|
testComponent.hintContent = null;
|
768
768
|
fixture.detectChanges();
|
769
769
|
});
|
770
|
-
it(
|
770
|
+
it('tooltip without content is hidden', function () {
|
771
771
|
fixture.detectChanges();
|
772
772
|
expect(getTooltip()).toBeNull();
|
773
773
|
});
|
@@ -784,8 +784,8 @@
|
|
784
784
|
}
|
785
785
|
TuiPageObject.getIds = function (_a) {
|
786
786
|
var nativeElement = _a.nativeElement;
|
787
|
-
var attributeValue = nativeElement.getAttribute(
|
788
|
-
return attributeValue === null ? [] : attributeValue.split(
|
787
|
+
var attributeValue = nativeElement.getAttribute('automation-id');
|
788
|
+
return attributeValue === null ? [] : attributeValue.split(' ');
|
789
789
|
};
|
790
790
|
TuiPageObject.containsId = function (debugElement, automationId) {
|
791
791
|
return TuiPageObject.getIds(debugElement).includes(automationId);
|
@@ -809,7 +809,7 @@
|
|
809
809
|
|
810
810
|
function tuiReplaceNbsp(content) {
|
811
811
|
var _a;
|
812
|
-
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 : '';
|
813
813
|
}
|
814
814
|
|
815
815
|
var TuiNativeInputPO = /** @class */ (function () {
|
@@ -830,7 +830,7 @@
|
|
830
830
|
Object.defineProperty(TuiNativeInputPO.prototype, "value", {
|
831
831
|
get: function () {
|
832
832
|
var _a, _b;
|
833
|
-
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 : '');
|
834
834
|
},
|
835
835
|
enumerable: false,
|
836
836
|
configurable: true
|
@@ -847,7 +847,7 @@
|
|
847
847
|
var nativeElement = this.nativeElement;
|
848
848
|
if (nativeElement) {
|
849
849
|
nativeElement.value = value;
|
850
|
-
nativeElement.dispatchEvent(new Event(
|
850
|
+
nativeElement.dispatchEvent(new Event('input', { bubbles: true }));
|
851
851
|
}
|
852
852
|
this.fixture.detectChanges();
|
853
853
|
};
|
@@ -859,7 +859,7 @@
|
|
859
859
|
};
|
860
860
|
TuiNativeInputPO.prototype.sendKeydown = function (key) {
|
861
861
|
var _a;
|
862
|
-
(_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'));
|
863
863
|
this.fixture.detectChanges();
|
864
864
|
};
|
865
865
|
TuiNativeInputPO.prototype.focus = function () {
|
@@ -881,22 +881,22 @@
|
|
881
881
|
}());
|
882
882
|
|
883
883
|
function tuiTestingViewport(width, height) {
|
884
|
-
Object.defineProperty(global,
|
884
|
+
Object.defineProperty(global, 'innerWidth', {
|
885
885
|
writable: true,
|
886
886
|
configurable: true,
|
887
887
|
value: width,
|
888
888
|
});
|
889
|
-
Object.defineProperty(global.document.documentElement,
|
889
|
+
Object.defineProperty(global.document.documentElement, 'clientWidth', {
|
890
890
|
writable: true,
|
891
891
|
configurable: true,
|
892
892
|
value: width - 15,
|
893
893
|
});
|
894
|
-
Object.defineProperty(global,
|
894
|
+
Object.defineProperty(global, 'innerHeight', {
|
895
895
|
writable: true,
|
896
896
|
configurable: true,
|
897
897
|
value: height,
|
898
898
|
});
|
899
|
-
Object.defineProperty(global.document.documentElement,
|
899
|
+
Object.defineProperty(global.document.documentElement, 'clientHeight', {
|
900
900
|
writable: true,
|
901
901
|
configurable: true,
|
902
902
|
value: height,
|