@o3r/testing 12.5.0-prerelease.6 → 12.5.0-prerelease.61

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 (164) hide show
  1. package/core/angular/angular-materials/autocomplete-material.js +9 -20
  2. package/core/angular/angular-materials/autocomplete-material.js.map +1 -1
  3. package/core/angular/angular-materials/index.js +1 -1
  4. package/core/angular/angular-materials/select-material.js +42 -91
  5. package/core/angular/angular-materials/select-material.js.map +1 -1
  6. package/core/angular/angular-materials/slider-material.js +8 -11
  7. package/core/angular/angular-materials/slider-material.js.map +1 -1
  8. package/core/angular/component-fixture.js +68 -148
  9. package/core/angular/component-fixture.js.map +1 -1
  10. package/core/angular/element.js +44 -50
  11. package/core/angular/element.js.map +1 -1
  12. package/core/angular/elements/checkbox-element.js +12 -16
  13. package/core/angular/elements/checkbox-element.js.map +1 -1
  14. package/core/angular/elements/index.js +1 -1
  15. package/core/angular/elements/radio-element.js +12 -16
  16. package/core/angular/elements/radio-element.js.map +1 -1
  17. package/core/angular/elements/select-element.js +28 -49
  18. package/core/angular/elements/select-element.js.map +1 -1
  19. package/core/angular/elements/slider-element.js +38 -42
  20. package/core/angular/elements/slider-element.js.map +1 -1
  21. package/core/angular/group.js +9 -14
  22. package/core/angular/group.js.map +1 -1
  23. package/core/angular/groups/index.js +1 -1
  24. package/core/angular/groups/radio-group.js +25 -62
  25. package/core/angular/groups/radio-group.js.map +1 -1
  26. package/core/angular/index.js +1 -1
  27. package/core/angular/page-fixture.js +8 -11
  28. package/core/angular/page-fixture.js.map +1 -1
  29. package/core/angular-materials/autocomplete-material.js +8 -11
  30. package/core/angular-materials/autocomplete-material.js.map +1 -1
  31. package/core/angular-materials/index.js +1 -1
  32. package/core/angular-materials/select-material.js +12 -15
  33. package/core/angular-materials/select-material.js.map +1 -1
  34. package/core/angular-materials/slider-material.js +5 -8
  35. package/core/angular-materials/slider-material.js.map +1 -1
  36. package/core/component-fixture.js +28 -33
  37. package/core/component-fixture.js.map +1 -1
  38. package/core/element.js +24 -26
  39. package/core/element.js.map +1 -1
  40. package/core/elements/checkbox-element.js +12 -16
  41. package/core/elements/checkbox-element.js.map +1 -1
  42. package/core/elements/index.js +1 -1
  43. package/core/elements/radio-element.js +12 -16
  44. package/core/elements/radio-element.js.map +1 -1
  45. package/core/elements/select-element.js +10 -13
  46. package/core/elements/select-element.js.map +1 -1
  47. package/core/elements/slider-element.js +5 -8
  48. package/core/elements/slider-element.js.map +1 -1
  49. package/core/group.js +9 -15
  50. package/core/group.js.map +1 -1
  51. package/core/groups/index.js +1 -1
  52. package/core/groups/radio-group.js +8 -11
  53. package/core/groups/radio-group.js.map +1 -1
  54. package/core/helpers.js +11 -16
  55. package/core/helpers.js.map +1 -1
  56. package/core/index.js +1 -1
  57. package/core/page-fixture.js +8 -11
  58. package/core/page-fixture.js.map +1 -1
  59. package/core/playwright/angular-materials/autocomplete-material.js +26 -56
  60. package/core/playwright/angular-materials/autocomplete-material.js.map +1 -1
  61. package/core/playwright/angular-materials/index.js +1 -1
  62. package/core/playwright/angular-materials/select-material.js +48 -110
  63. package/core/playwright/angular-materials/select-material.js.map +1 -1
  64. package/core/playwright/angular-materials/slider-material.js +7 -10
  65. package/core/playwright/angular-materials/slider-material.js.map +1 -1
  66. package/core/playwright/component-fixture.js +88 -173
  67. package/core/playwright/component-fixture.js.map +1 -1
  68. package/core/playwright/element.js +38 -90
  69. package/core/playwright/element.js.map +1 -1
  70. package/core/playwright/elements/checkbox-element.js +49 -94
  71. package/core/playwright/elements/checkbox-element.js.map +1 -1
  72. package/core/playwright/elements/index.js +1 -1
  73. package/core/playwright/elements/radio-element.js +18 -34
  74. package/core/playwright/elements/radio-element.js.map +1 -1
  75. package/core/playwright/elements/select-element.js +14 -21
  76. package/core/playwright/elements/select-element.js.map +1 -1
  77. package/core/playwright/elements/slider-element.js +78 -157
  78. package/core/playwright/elements/slider-element.js.map +1 -1
  79. package/core/playwright/group.js +9 -14
  80. package/core/playwright/group.js.map +1 -1
  81. package/core/playwright/groups/index.js +1 -1
  82. package/core/playwright/groups/radio-group.js +27 -64
  83. package/core/playwright/groups/radio-group.js.map +1 -1
  84. package/core/playwright/index.js +1 -1
  85. package/core/playwright/page-fixture.js +8 -18
  86. package/core/playwright/page-fixture.js.map +1 -1
  87. package/core/protractor/angular-materials/autocomplete-material.js +12 -26
  88. package/core/protractor/angular-materials/autocomplete-material.js.map +1 -1
  89. package/core/protractor/angular-materials/index.js +1 -1
  90. package/core/protractor/angular-materials/select-material.js +45 -97
  91. package/core/protractor/angular-materials/select-material.js.map +1 -1
  92. package/core/protractor/component-fixture.js +89 -200
  93. package/core/protractor/component-fixture.js.map +1 -1
  94. package/core/protractor/element.js +46 -118
  95. package/core/protractor/element.js.map +1 -1
  96. package/core/protractor/elements/checkbox-element.js +18 -40
  97. package/core/protractor/elements/checkbox-element.js.map +1 -1
  98. package/core/protractor/elements/index.js +1 -1
  99. package/core/protractor/elements/radio-element.js +20 -42
  100. package/core/protractor/elements/radio-element.js.map +1 -1
  101. package/core/protractor/elements/select-element.js +16 -37
  102. package/core/protractor/elements/select-element.js.map +1 -1
  103. package/core/protractor/group.js +9 -14
  104. package/core/protractor/group.js.map +1 -1
  105. package/core/protractor/groups/index.js +1 -1
  106. package/core/protractor/groups/radio-group.js +29 -66
  107. package/core/protractor/groups/radio-group.js.map +1 -1
  108. package/core/protractor/index.js +1 -1
  109. package/core/protractor/page-fixture.js +9 -12
  110. package/core/protractor/page-fixture.js.map +1 -1
  111. package/core/protractor/utils.js +1 -1
  112. package/core/protractor/utils.js.map +1 -1
  113. package/errors/fixture-usage-error.js +5 -10
  114. package/errors/fixture-usage-error.js.map +1 -1
  115. package/errors/index.js +1 -1
  116. package/errors/transpilation-purpose-only.js +5 -10
  117. package/errors/transpilation-purpose-only.js.map +1 -1
  118. package/kassette/index.js +1 -1
  119. package/kassette/update-dates-in-mocks.js +66 -85
  120. package/kassette/update-dates-in-mocks.js.map +1 -1
  121. package/localization/index.js +1 -1
  122. package/localization/localization-mock.js +38 -60
  123. package/localization/localization-mock.js.map +1 -1
  124. package/mocks/index.js +1 -1
  125. package/mocks/mock-component-generator.js +54 -53
  126. package/mocks/mock-component-generator.js.map +1 -1
  127. package/package.json +27 -20
  128. package/public_api.js +1 -1
  129. package/schematics/ng-add/index.d.ts.map +1 -1
  130. package/schematics/ng-add/index.js +31 -26
  131. package/schematics/ng-add/index.js.map +1 -1
  132. package/schematics/ng-add/playwright/index.d.ts.map +1 -1
  133. package/schematics/ng-add/playwright/index.js +17 -15
  134. package/schematics/ng-add/playwright/index.js.map +1 -1
  135. package/store/index.js +1 -1
  136. package/store/testable-select.js +13 -13
  137. package/store/testable-select.js.map +1 -1
  138. package/tools/index.js +1 -1
  139. package/tools/path-replacement/index.js +1 -1
  140. package/tools/path-replacement/path-replacement.js +24 -19
  141. package/tools/path-replacement/path-replacement.js.map +1 -1
  142. package/tools/protractor/fetch-manager/_fetch-manager.d.ts +1 -0
  143. package/tools/protractor/fetch-manager/_fetch-manager.d.ts.map +1 -0
  144. package/tools/protractor/fetch-manager/_fetch-manager.js +127 -0
  145. package/tools/protractor/fetch-manager/_fetch-manager.js.map +1 -0
  146. package/tools/protractor/fetch-manager/index.js +1 -1
  147. package/tools/protractor/fetch-manager/utils.js +15 -51
  148. package/tools/protractor/fetch-manager/utils.js.map +1 -1
  149. package/tools/protractor/index.js +1 -1
  150. package/tools/protractor/post-message-interceptor/_post-message-interceptor.d.ts +5 -0
  151. package/tools/protractor/post-message-interceptor/_post-message-interceptor.d.ts.map +1 -0
  152. package/tools/protractor/post-message-interceptor/_post-message-interceptor.js +157 -0
  153. package/tools/protractor/post-message-interceptor/_post-message-interceptor.js.map +1 -0
  154. package/tools/protractor/post-message-interceptor/index.js +1 -1
  155. package/tools/protractor/post-message-interceptor/post-message-interceptor.js +30 -103
  156. package/tools/protractor/post-message-interceptor/post-message-interceptor.js.map +1 -1
  157. package/visual-test/index.js +1 -1
  158. package/visual-test/utils.js +18 -7
  159. package/visual-test/utils.js.map +1 -1
  160. package/visual-test/visual-test.js +29 -34
  161. package/visual-test/visual-test.js.map +1 -1
  162. package/visual-testing-reporter/index.d.ts.map +1 -1
  163. package/visual-testing-reporter/index.js +37 -40
  164. package/visual-testing-reporter/index.js.map +1 -1
@@ -1,30 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MatAutocomplete = void 0;
4
- var tslib_1 = require("tslib");
5
- var element_1 = require("../element");
4
+ const element_1 = require("../element");
6
5
  /**
7
6
  * Implementation dedicated to angular / TestBed.
8
7
  */
9
- var MatAutocomplete = /** @class */ (function (_super) {
10
- tslib_1.__extends(MatAutocomplete, _super);
11
- function MatAutocomplete(sourceElement) {
12
- return _super.call(this, sourceElement) || this;
8
+ class MatAutocomplete extends element_1.O3rElement {
9
+ constructor(sourceElement) {
10
+ super(sourceElement);
13
11
  }
14
12
  /** @inheritdoc */
15
- MatAutocomplete.prototype.selectByValue = function (value, _timeout) {
16
- return tslib_1.__awaiter(this, void 0, void 0, function () {
17
- return tslib_1.__generator(this, function (_a) {
18
- switch (_a.label) {
19
- case 0: return [4 /*yield*/, this.setValue(value)];
20
- case 1:
21
- _a.sent();
22
- return [2 /*return*/, this.sourceElement.triggerEventHandler('change', { target: this.sourceElement.nativeElement, preventDefault: function () { }, stopPropagation: function () { } })];
23
- }
24
- });
25
- });
26
- };
27
- return MatAutocomplete;
28
- }(element_1.O3rElement));
13
+ async selectByValue(value, _timeout) {
14
+ await this.setValue(value);
15
+ return this.sourceElement.triggerEventHandler('change', { target: this.sourceElement.nativeElement, preventDefault: () => { }, stopPropagation: () => { } });
16
+ }
17
+ }
29
18
  exports.MatAutocomplete = MatAutocomplete;
30
19
  //# sourceMappingURL=autocomplete-material.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete-material.js","sourceRoot":"","sources":["../../../../src/core/angular/angular-materials/autocomplete-material.ts"],"names":[],"mappings":";;;;AAMA,sCAEoB;AAEpB;;GAEG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,aAAwC;QAClD,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,uCAAa,GAA1B,UAA2B,KAAa,EAAE,QAAiB;;;;4BACzD,qBAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAA;;wBAA1B,SAA0B,CAAC;wBAC3B,sBAAO,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,cAAc,EAAE,cAAO,CAAC,EAAE,eAAe,EAAE,cAAO,CAAC,EAAE,CAAC,EAAC;;;;KAC5J;IACH,sBAAC;AAAD,CAAC,AAVD,CAAqC,oBAAU,GAU9C;AAVY,0CAAe","sourcesContent":["import {\n DebugElement,\n} from '@angular/core';\nimport {\n MatAutocompleteProfile,\n} from '../../angular-materials';\nimport {\n O3rElement,\n} from '../element';\n\n/**\n * Implementation dedicated to angular / TestBed.\n */\nexport class MatAutocomplete extends O3rElement implements MatAutocompleteProfile {\n constructor(sourceElement: DebugElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, _timeout?: number) {\n await this.setValue(value);\n return this.sourceElement.triggerEventHandler('change', { target: this.sourceElement.nativeElement, preventDefault: () => {}, stopPropagation: () => {} });\n }\n}\n"]}
1
+ {"version":3,"file":"autocomplete-material.js","sourceRoot":"","sources":["../../../../src/core/angular/angular-materials/autocomplete-material.ts"],"names":[],"mappings":";;;AAMA,wCAEoB;AAEpB;;GAEG;AACH,MAAa,eAAgB,SAAQ,oBAAU;IAC7C,YAAY,aAAwC;QAClD,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,aAAa,CAAC,KAAa,EAAE,QAAiB;QACzD,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAC;IAC7J,CAAC;CACF;AAVD,0CAUC","sourcesContent":["import {\n DebugElement,\n} from '@angular/core';\nimport {\n MatAutocompleteProfile,\n} from '../../angular-materials';\nimport {\n O3rElement,\n} from '../element';\n\n/**\n * Implementation dedicated to angular / TestBed.\n */\nexport class MatAutocomplete extends O3rElement implements MatAutocompleteProfile {\n constructor(sourceElement: DebugElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, _timeout?: number) {\n await this.setValue(value);\n return this.sourceElement.triggerEventHandler('change', { target: this.sourceElement.nativeElement, preventDefault: () => {}, stopPropagation: () => {} });\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
3
+ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./autocomplete-material"), exports);
5
5
  tslib_1.__exportStar(require("./select-material"), exports);
6
6
  tslib_1.__exportStar(require("./slider-material"), exports);
@@ -1,106 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MatSelect = void 0;
4
- var tslib_1 = require("tslib");
5
- var platform_browser_1 = require("@angular/platform-browser");
6
- var element_1 = require("../element");
4
+ const platform_browser_1 = require("@angular/platform-browser");
5
+ const element_1 = require("../element");
7
6
  /**
8
7
  * Implementation dedicated to angular / TestBed.
9
8
  */
10
- var MatSelect = /** @class */ (function (_super) {
11
- tslib_1.__extends(MatSelect, _super);
12
- function MatSelect(sourceElement) {
13
- return _super.call(this, sourceElement) || this;
9
+ class MatSelect extends element_1.O3rElement {
10
+ constructor(sourceElement) {
11
+ super(sourceElement);
14
12
  }
15
13
  /** @inheritdoc */
16
- MatSelect.prototype.selectByIndex = function (index, _timeout) {
17
- return tslib_1.__awaiter(this, void 0, void 0, function () {
18
- var options, option;
19
- return tslib_1.__generator(this, function (_a) {
20
- switch (_a.label) {
21
- case 0: return [4 /*yield*/, this.click()];
22
- case 1:
23
- _a.sent();
24
- options = this.sourceElement.queryAll(platform_browser_1.By.css('mat-option'));
25
- if (options[index]) {
26
- option = new element_1.O3rElement(options[index]);
27
- return [2 /*return*/, option.click()];
28
- }
29
- else {
30
- return [2 /*return*/, Promise.reject(new Error("Option with index ".concat(index, " not found in select element.")))];
31
- }
32
- return [2 /*return*/];
33
- }
34
- });
35
- });
36
- };
14
+ async selectByIndex(index, _timeout) {
15
+ await this.click();
16
+ const options = this.sourceElement.queryAll(platform_browser_1.By.css('mat-option'));
17
+ if (options[index]) {
18
+ const option = new element_1.O3rElement(options[index]);
19
+ return option.click();
20
+ }
21
+ else {
22
+ return Promise.reject(new Error(`Option with index ${index} not found in select element.`));
23
+ }
24
+ }
37
25
  /** @inheritdoc */
38
- MatSelect.prototype.selectByValue = function (value, _timeout) {
39
- return tslib_1.__awaiter(this, void 0, void 0, function () {
40
- var options, _i, options_1, opt, option;
41
- return tslib_1.__generator(this, function (_a) {
42
- switch (_a.label) {
43
- case 0: return [4 /*yield*/, this.click()];
44
- case 1:
45
- _a.sent();
46
- options = this.sourceElement.queryAll(platform_browser_1.By.css('mat-option'));
47
- _i = 0, options_1 = options;
48
- _a.label = 2;
49
- case 2:
50
- if (!(_i < options_1.length)) return [3 /*break*/, 5];
51
- opt = options_1[_i];
52
- option = new element_1.O3rElement(opt);
53
- return [4 /*yield*/, option.getAttribute('ng-reflect-value')];
54
- case 3:
55
- if ((_a.sent()) === value) {
56
- return [2 /*return*/, option.click()];
57
- }
58
- _a.label = 4;
59
- case 4:
60
- _i++;
61
- return [3 /*break*/, 2];
62
- case 5: return [2 /*return*/, Promise.reject(new Error("Option with value ".concat(value, " not found in select element.")))];
63
- }
64
- });
65
- });
66
- };
26
+ async selectByValue(value, _timeout) {
27
+ await this.click();
28
+ const options = this.sourceElement.queryAll(platform_browser_1.By.css('mat-option'));
29
+ for (const opt of options) {
30
+ const option = new element_1.O3rElement(opt);
31
+ if (await option.getAttribute('ng-reflect-value') === value) {
32
+ return option.click();
33
+ }
34
+ }
35
+ return Promise.reject(new Error(`Option with value ${value} not found in select element.`));
36
+ }
67
37
  /** @inheritdoc */
68
- MatSelect.prototype.selectByLabel = function (label, _timeout) {
69
- return tslib_1.__awaiter(this, void 0, void 0, function () {
70
- var options, _i, options_2, opt, option;
71
- return tslib_1.__generator(this, function (_a) {
72
- switch (_a.label) {
73
- case 0: return [4 /*yield*/, this.click()];
74
- case 1:
75
- _a.sent();
76
- options = this.sourceElement.queryAll(platform_browser_1.By.css('mat-option'));
77
- _i = 0, options_2 = options;
78
- _a.label = 2;
79
- case 2:
80
- if (!(_i < options_2.length)) return [3 /*break*/, 5];
81
- opt = options_2[_i];
82
- option = new element_1.O3rElement(opt);
83
- return [4 /*yield*/, option.getText()];
84
- case 3:
85
- if ((_a.sent()) === label) {
86
- return [2 /*return*/, option.click()];
87
- }
88
- _a.label = 4;
89
- case 4:
90
- _i++;
91
- return [3 /*break*/, 2];
92
- case 5: return [2 /*return*/, Promise.reject(new Error("Option with label ".concat(label, " not found in select element.")))];
93
- }
94
- });
95
- });
96
- };
38
+ async selectByLabel(label, _timeout) {
39
+ await this.click();
40
+ const options = this.sourceElement.queryAll(platform_browser_1.By.css('mat-option'));
41
+ for (const opt of options) {
42
+ const option = new element_1.O3rElement(opt);
43
+ if (await option.getText() === label) {
44
+ return option.click();
45
+ }
46
+ }
47
+ return Promise.reject(new Error(`Option with label ${label} not found in select element.`));
48
+ }
97
49
  /** @inheritDoc */
98
- MatSelect.prototype.getValue = function () {
50
+ getValue() {
99
51
  // eslint-disable-next-line no-console -- no other logger available
100
52
  console.warn('Usage of "getValue" is not recommended on Material Select elements. Use "getPlainText()" instead.');
101
- return _super.prototype.getValue.call(this);
102
- };
103
- return MatSelect;
104
- }(element_1.O3rElement));
53
+ return super.getValue();
54
+ }
55
+ }
105
56
  exports.MatSelect = MatSelect;
106
57
  //# sourceMappingURL=select-material.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-material.js","sourceRoot":"","sources":["../../../../src/core/angular/angular-materials/select-material.ts"],"names":[],"mappings":";;;;AAGA,8DAEmC;AAInC,sCAEoB;AAEpB;;GAEG;AACH;IAA+B,qCAAU;IACvC,mBAAY,aAAwC;QAClD,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,iCAAa,GAA1B,UAA2B,KAAa,EAAE,QAAiB;;;;;4BACzD,qBAAM,IAAI,CAAC,KAAK,EAAE,EAAA;;wBAAlB,SAAkB,CAAC;wBACb,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,qBAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;wBAClE,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;4BACb,MAAM,GAAG,IAAI,oBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;4BAC9C,sBAAO,MAAM,CAAC,KAAK,EAAE,EAAC;wBACxB,CAAC;6BAAM,CAAC;4BACN,sBAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,4BAAqB,KAAK,kCAA+B,CAAC,CAAC,EAAC;wBAC9F,CAAC;;;;;KACF;IAED,kBAAkB;IACL,iCAAa,GAA1B,UAA2B,KAAa,EAAE,QAAiB;;;;;4BACzD,qBAAM,IAAI,CAAC,KAAK,EAAE,EAAA;;wBAAlB,SAAkB,CAAC;wBACb,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,qBAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;8BAEzC,EAAP,mBAAO;;;6BAA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AAU,GAqDxC;AArDY,8BAAS","sourcesContent":["import {\n DebugElement,\n} from '@angular/core';\nimport {\n By,\n} from '@angular/platform-browser';\nimport {\n MatSelectProfile,\n} from '../../angular-materials';\nimport {\n O3rElement,\n} from '../element';\n\n/**\n * Implementation dedicated to angular / TestBed.\n */\nexport class MatSelect extends O3rElement implements MatSelectProfile {\n constructor(sourceElement: DebugElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByIndex(index: number, _timeout?: number) {\n await this.click();\n const options = this.sourceElement.queryAll(By.css('mat-option'));\n if (options[index]) {\n const option = new O3rElement(options[index]);\n return option.click();\n } else {\n return Promise.reject(new Error(`Option with index ${index} not found in select element.`));\n }\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, _timeout?: number) {\n await this.click();\n const options = this.sourceElement.queryAll(By.css('mat-option'));\n\n for (const opt of options) {\n const option = new O3rElement(opt);\n if (await option.getAttribute('ng-reflect-value') === value) {\n return option.click();\n }\n }\n\n return Promise.reject(new Error(`Option with value ${value} not found in select element.`));\n }\n\n /** @inheritdoc */\n public async selectByLabel(label: string, _timeout?: number) {\n await this.click();\n const options = this.sourceElement.queryAll(By.css('mat-option'));\n\n for (const opt of options) {\n const option = new O3rElement(opt);\n if (await option.getText() === label) {\n return option.click();\n }\n }\n\n return Promise.reject(new Error(`Option with label ${label} not found in select element.`));\n }\n\n /** @inheritDoc */\n public getValue() {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn('Usage of \"getValue\" is not recommended on Material Select elements. Use \"getPlainText()\" instead.');\n return super.getValue();\n }\n}\n"]}
1
+ {"version":3,"file":"select-material.js","sourceRoot":"","sources":["../../../../src/core/angular/angular-materials/select-material.ts"],"names":[],"mappings":";;;AAGA,gEAEmC;AAInC,wCAEoB;AAEpB;;GAEG;AACH,MAAa,SAAU,SAAQ,oBAAU;IACvC,YAAY,aAAwC;QAClD,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED,kBAAkB;IACX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Aa,CAAC,QAAQ,CAAC,qBAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;QAElE,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAG,IAAI,oBAAU,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE,KAAK,KAAK,EAAE,CAAC;gBACrC,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;YACxB,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,qBAAqB,KAAK,+BAA+B,CAAC,CAAC,CAAC;IAC9F,CAAC;IAED,kBAAkB;IACX,QAAQ;QACb,mEAAmE;QACnE,OAAO,CAAC,IAAI,CAAC,mGAAmG,CAAC,CAAC;QAClH,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CACF;AArDD,8BAqDC","sourcesContent":["import {\n DebugElement,\n} from '@angular/core';\nimport {\n By,\n} from '@angular/platform-browser';\nimport {\n MatSelectProfile,\n} from '../../angular-materials';\nimport {\n O3rElement,\n} from '../element';\n\n/**\n * Implementation dedicated to angular / TestBed.\n */\nexport class MatSelect extends O3rElement implements MatSelectProfile {\n constructor(sourceElement: DebugElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByIndex(index: number, _timeout?: number) {\n await this.click();\n const options = this.sourceElement.queryAll(By.css('mat-option'));\n if (options[index]) {\n const option = new O3rElement(options[index]);\n return option.click();\n } else {\n return Promise.reject(new Error(`Option with index ${index} not found in select element.`));\n }\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, _timeout?: number) {\n await this.click();\n const options = this.sourceElement.queryAll(By.css('mat-option'));\n\n for (const opt of options) {\n const option = new O3rElement(opt);\n if (await option.getAttribute('ng-reflect-value') === value) {\n return option.click();\n }\n }\n\n return Promise.reject(new Error(`Option with value ${value} not found in select element.`));\n }\n\n /** @inheritdoc */\n public async selectByLabel(label: string, _timeout?: number) {\n await this.click();\n const options = this.sourceElement.queryAll(By.css('mat-option'));\n\n for (const opt of options) {\n const option = new O3rElement(opt);\n if (await option.getText() === label) {\n return option.click();\n }\n }\n\n return Promise.reject(new Error(`Option with label ${label} not found in select element.`));\n }\n\n /** @inheritDoc */\n public getValue() {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn('Usage of \"getValue\" is not recommended on Material Select elements. Use \"getPlainText()\" instead.');\n return super.getValue();\n }\n}\n"]}
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MatSlider = void 0;
4
- var tslib_1 = require("tslib");
5
- var element_1 = require("../element");
6
- var elements_1 = require("../elements");
7
- var TRACK_CLASS = 'mdc-slider__track';
8
- var THUMB_CLASS = 'mdc-slider__thumb';
4
+ const element_1 = require("../element");
5
+ const elements_1 = require("../elements");
6
+ const TRACK_CLASS = 'mdc-slider__track';
7
+ const THUMB_CLASS = 'mdc-slider__thumb';
9
8
  /**
10
9
  * Implementation dedicated to angular / TestBed.
11
10
  */
12
- var MatSlider = /** @class */ (function (_super) {
13
- tslib_1.__extends(MatSlider, _super);
14
- function MatSlider(sourceElement) {
15
- return _super.call(this, sourceElement instanceof element_1.O3rElement ? sourceElement.sourceElement : sourceElement, ".".concat(TRACK_CLASS), ".".concat(THUMB_CLASS)) || this;
11
+ class MatSlider extends elements_1.O3rSliderElement {
12
+ constructor(sourceElement) {
13
+ super(sourceElement instanceof element_1.O3rElement ? sourceElement.sourceElement : sourceElement, `.${TRACK_CLASS}`, `.${THUMB_CLASS}`);
16
14
  }
17
- return MatSlider;
18
- }(elements_1.O3rSliderElement));
15
+ }
19
16
  exports.MatSlider = MatSlider;
20
17
  //# sourceMappingURL=slider-material.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slider-material.js","sourceRoot":"","sources":["../../../../src/core/angular/angular-materials/slider-material.ts"],"names":[],"mappings":";;;;AASA,sCAEoB;AACpB,wCAEqB;AAErB,IAAM,WAAW,GAA4B,mBAAmB,CAAC;AACjE,IAAM,WAAW,GAA4B,mBAAmB,CAAC;AAEjE;;GAEG;AACH;IAA+B,qCAAgB;IAC7C,mBAAY,aAAwC;QAClD,OAAA,MAAK,YACH,aAAa,YAAY,oBAAU,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,EACjF,WAAI,WAAW,CAAE,EACjB,WAAI,WAAW,CAAE,CAClB,SAAC;IACJ,CAAC;IACH,gBAAC;AAAD,CAAC,AARD,CAA+B,2BAAgB,GAQ9C;AARY,8BAAS","sourcesContent":["import {\n DebugElement,\n} from '@angular/core';\nimport type {\n cssClasses,\n} from '@material/slider';\nimport type {\n MatSliderProfile,\n} from '../../angular-materials';\nimport {\n O3rElement,\n} from '../element';\nimport {\n O3rSliderElement,\n} from '../elements';\n\nconst TRACK_CLASS: typeof cssClasses.TRACK = 'mdc-slider__track';\nconst THUMB_CLASS: typeof cssClasses.THUMB = 'mdc-slider__thumb';\n\n/**\n * Implementation dedicated to angular / TestBed.\n */\nexport class MatSlider extends O3rSliderElement implements MatSliderProfile {\n constructor(sourceElement: DebugElement | O3rElement) {\n super(\n sourceElement instanceof O3rElement ? sourceElement.sourceElement : sourceElement,\n `.${TRACK_CLASS}`,\n `.${THUMB_CLASS}`\n );\n }\n}\n"]}
1
+ {"version":3,"file":"slider-material.js","sourceRoot":"","sources":["../../../../src/core/angular/angular-materials/slider-material.ts"],"names":[],"mappings":";;;AASA,wCAEoB;AACpB,0CAEqB;AAErB,MAAM,WAAW,GAA4B,mBAAmB,CAAC;AACjE,MAAM,WAAW,GAA4B,mBAAmB,CAAC;AAEjE;;GAEG;AACH,MAAa,SAAU,SAAQ,2BAAgB;IAC7C,YAAY,aAAwC;QAClD,KAAK,CACH,aAAa,YAAY,oBAAU,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,EACjF,IAAI,WAAW,EAAE,EACjB,IAAI,WAAW,EAAE,CAClB,CAAC;IACJ,CAAC;CACF;AARD,8BAQC","sourcesContent":["import {\n DebugElement,\n} from '@angular/core';\nimport type {\n cssClasses,\n} from '@material/slider';\nimport type {\n MatSliderProfile,\n} from '../../angular-materials';\nimport {\n O3rElement,\n} from '../element';\nimport {\n O3rSliderElement,\n} from '../elements';\n\nconst TRACK_CLASS: typeof cssClasses.TRACK = 'mdc-slider__track';\nconst THUMB_CLASS: typeof cssClasses.THUMB = 'mdc-slider__thumb';\n\n/**\n * Implementation dedicated to angular / TestBed.\n */\nexport class MatSlider extends O3rSliderElement implements MatSliderProfile {\n constructor(sourceElement: DebugElement | O3rElement) {\n super(\n sourceElement instanceof O3rElement ? sourceElement.sourceElement : sourceElement,\n `.${TRACK_CLASS}`,\n `.${THUMB_CLASS}`\n );\n }\n}\n"]}
@@ -1,20 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.O3rComponentFixture = void 0;
4
- var tslib_1 = require("tslib");
5
- var platform_browser_1 = require("@angular/platform-browser");
6
- var index_1 = require("../../errors/index");
7
- var helpers_1 = require("../helpers");
8
- var element_1 = require("./element");
4
+ const platform_browser_1 = require("@angular/platform-browser");
5
+ const index_1 = require("../../errors/index");
6
+ const helpers_1 = require("../helpers");
7
+ const element_1 = require("./element");
9
8
  /**
10
9
  * Implementation of the fixture dedicated to angular, hence using angular testing framework.
11
10
  */
12
- var O3rComponentFixture = /** @class */ (function () {
11
+ class O3rComponentFixture {
13
12
  /**
14
13
  * Root element of this fixture. It will be used as the context for further queries.
15
14
  * @param element
16
15
  */
17
- function O3rComponentFixture(element) {
16
+ constructor(element) {
18
17
  this.element = element;
19
18
  }
20
19
  /**
@@ -23,51 +22,36 @@ var O3rComponentFixture = /** @class */ (function () {
23
22
  * @param element ElementProfile to test
24
23
  * @param _timeout specific timeout that will throw when reach
25
24
  */
26
- O3rComponentFixture.prototype.throwOnUndefinedElement = function (element, _timeout) {
25
+ throwOnUndefinedElement(element, _timeout) {
27
26
  if (!element) {
28
27
  throw new Error('Element not found in ' + this.constructor.name);
29
28
  }
30
29
  return Promise.resolve(element);
31
- };
30
+ }
32
31
  /**
33
32
  * Throws an exception if the element is undefined.
34
33
  * Otherwise returns the element.
35
34
  * @param element ElementProfile to test
36
35
  * @param timeout specific timeout that will throw when reach
37
36
  */
38
- O3rComponentFixture.prototype.throwOnUndefined = function (element, timeout) {
39
- return tslib_1.__awaiter(this, void 0, void 0, function () {
40
- var _this = this;
41
- return tslib_1.__generator(this, function (_a) {
42
- return [2 /*return*/, (0, helpers_1.withTimeout)(element, timeout)
43
- .then(function (el) {
44
- if (!el) {
45
- throw new Error('Element not found in ' + _this.constructor.name);
46
- }
47
- return el;
48
- })];
49
- });
50
- });
51
- };
52
- O3rComponentFixture.prototype.queryWithOptions = function (selector_1, elementConstructor_1) {
53
- return tslib_1.__awaiter(this, arguments, void 0, function (selector, elementConstructor, options) {
54
- var element;
55
- if (options === void 0) { options = {}; }
56
- return tslib_1.__generator(this, function (_a) {
57
- switch (_a.label) {
58
- case 0: return [4 /*yield*/, (options.index === undefined
59
- ? this.query(selector, elementConstructor)
60
- : this.queryNth(selector, options.index, elementConstructor))];
61
- case 1:
62
- element = _a.sent();
63
- if (options.shouldThrowIfNotPresent) {
64
- return [2 /*return*/, this.throwOnUndefinedElement(element, options.timeout)];
65
- }
66
- return [2 /*return*/, element];
67
- }
68
- });
37
+ async throwOnUndefined(element, timeout) {
38
+ return (0, helpers_1.withTimeout)(element, timeout)
39
+ .then((el) => {
40
+ if (!el) {
41
+ throw new Error('Element not found in ' + this.constructor.name);
42
+ }
43
+ return el;
69
44
  });
70
- };
45
+ }
46
+ async queryWithOptions(selector, elementConstructor, options = {}) {
47
+ const element = await (options.index === undefined
48
+ ? this.query(selector, elementConstructor)
49
+ : this.queryNth(selector, options.index, elementConstructor));
50
+ if (options.shouldThrowIfNotPresent) {
51
+ return this.throwOnUndefinedElement(element, options.timeout);
52
+ }
53
+ return element;
54
+ }
71
55
  /**
72
56
  * Get text from the element associated to the given selector, or undefined if the element is not found or not visible
73
57
  * @param selector Selector to access the element
@@ -77,31 +61,13 @@ var O3rComponentFixture = /** @class */ (function () {
77
61
  * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
78
62
  * @param options.timeout Duration to wait for the element to be present before it throws
79
63
  */
80
- O3rComponentFixture.prototype.getText = function (selector_1) {
81
- return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
82
- var element, _a;
83
- if (options === void 0) { options = {}; }
84
- return tslib_1.__generator(this, function (_b) {
85
- switch (_b.label) {
86
- case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
87
- case 1:
88
- element = _b.sent();
89
- _a = !element;
90
- if (_a) return [3 /*break*/, 3];
91
- return [4 /*yield*/, element.isVisible()];
92
- case 2:
93
- _a = !(_b.sent());
94
- _b.label = 3;
95
- case 3:
96
- if (_a) {
97
- return [2 /*return*/];
98
- }
99
- return [4 /*yield*/, element.getText()];
100
- case 4: return [2 /*return*/, _b.sent()];
101
- }
102
- });
103
- });
104
- };
64
+ async getText(selector, options = {}) {
65
+ const element = await this.queryWithOptions(selector, options.elementConstructor, options);
66
+ if (!element || !await element.isVisible()) {
67
+ return;
68
+ }
69
+ return await element.getText();
70
+ }
105
71
  /**
106
72
  * Check if the element associated to the given selector is visible
107
73
  * @param selector Selector to access the element
@@ -111,26 +77,10 @@ var O3rComponentFixture = /** @class */ (function () {
111
77
  * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
112
78
  * @param options.timeout Duration to wait for the element to be present before it throws
113
79
  */
114
- O3rComponentFixture.prototype.isVisible = function (selector_1) {
115
- return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
116
- var element, _a;
117
- if (options === void 0) { options = {}; }
118
- return tslib_1.__generator(this, function (_b) {
119
- switch (_b.label) {
120
- case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
121
- case 1:
122
- element = _b.sent();
123
- _a = !!element;
124
- if (!_a) return [3 /*break*/, 3];
125
- return [4 /*yield*/, element.isVisible()];
126
- case 2:
127
- _a = (_b.sent());
128
- _b.label = 3;
129
- case 3: return [2 /*return*/, _a];
130
- }
131
- });
132
- });
133
- };
80
+ async isVisible(selector, options = {}) {
81
+ const element = await this.queryWithOptions(selector, options.elementConstructor, options);
82
+ return !!element && await element.isVisible();
83
+ }
134
84
  /**
135
85
  * Click on the element associated to the given selector if it exists and is visible
136
86
  * @param selector Selector to access the element
@@ -140,75 +90,45 @@ var O3rComponentFixture = /** @class */ (function () {
140
90
  * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
141
91
  * @param options.timeout Duration to wait for the element to be present before it throws
142
92
  */
143
- O3rComponentFixture.prototype.click = function (selector_1) {
144
- return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
145
- var element, _a;
146
- if (options === void 0) { options = {}; }
147
- return tslib_1.__generator(this, function (_b) {
148
- switch (_b.label) {
149
- case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
150
- case 1:
151
- element = _b.sent();
152
- _a = !!element;
153
- if (!_a) return [3 /*break*/, 3];
154
- return [4 /*yield*/, element.isVisible()];
155
- case 2:
156
- _a = (_b.sent());
157
- _b.label = 3;
158
- case 3:
159
- if (!_a) return [3 /*break*/, 5];
160
- return [4 /*yield*/, element.click()];
161
- case 4:
162
- _b.sent();
163
- _b.label = 5;
164
- case 5: return [2 /*return*/];
165
- }
166
- });
167
- });
168
- };
169
- O3rComponentFixture.prototype.query = function (selector, returnType) {
170
- var queriedElement = this.element.sourceElement.query(platform_browser_1.By.css(selector));
93
+ async click(selector, options = {}) {
94
+ const element = await this.queryWithOptions(selector, options.elementConstructor, options);
95
+ if (!!element && await element.isVisible()) {
96
+ await element.click();
97
+ }
98
+ }
99
+ query(selector, returnType) {
100
+ const queriedElement = this.element.sourceElement.query(platform_browser_1.By.css(selector));
171
101
  return Promise.resolve(queriedElement ? (returnType ? new returnType(queriedElement) : new element_1.O3rElement(queriedElement)) : undefined);
172
- };
173
- O3rComponentFixture.prototype.queryNth = function (selector, index, returnType) {
174
- var queriedElement = this.element.sourceElement.queryAll(platform_browser_1.By.css(selector))[index];
102
+ }
103
+ queryNth(selector, index, returnType) {
104
+ const queriedElement = this.element.sourceElement.queryAll(platform_browser_1.By.css(selector))[index];
175
105
  return Promise.resolve(queriedElement ? (returnType ? new returnType(queriedElement) : new element_1.O3rElement(queriedElement)) : undefined);
176
- };
177
- O3rComponentFixture.prototype.queryAll = function (selector, returnType, groupType, _timeout) {
178
- return tslib_1.__awaiter(this, void 0, void 0, function () {
179
- var queriedElement, elements, group, isValid;
180
- return tslib_1.__generator(this, function (_a) {
181
- switch (_a.label) {
182
- case 0:
183
- queriedElement = this.element.sourceElement.queryAll(platform_browser_1.By.css(selector));
184
- elements = queriedElement.map(function (el) { return (returnType ? new returnType(el) : new element_1.O3rElement(el)); });
185
- if (!groupType) return [3 /*break*/, 2];
186
- group = new groupType(elements);
187
- return [4 /*yield*/, group.isValidGroup()];
188
- case 1:
189
- isValid = _a.sent();
190
- if (!isValid) {
191
- throw new index_1.FixtureUsageError('invalid group of items');
192
- }
193
- return [2 /*return*/, Promise.resolve(group)];
194
- case 2: return [2 /*return*/, Promise.resolve(elements)];
195
- }
196
- });
197
- });
198
- };
106
+ }
107
+ async queryAll(selector, returnType, groupType, _timeout) {
108
+ const queriedElement = this.element.sourceElement.queryAll(platform_browser_1.By.css(selector));
109
+ const elements = queriedElement.map((el) => (returnType ? new returnType(el) : new element_1.O3rElement(el)));
110
+ if (groupType) {
111
+ const group = new groupType(elements);
112
+ const isValid = await group.isValidGroup();
113
+ if (!isValid) {
114
+ throw new index_1.FixtureUsageError('invalid group of items');
115
+ }
116
+ return Promise.resolve(group);
117
+ }
118
+ return Promise.resolve(elements);
119
+ }
199
120
  /** @inheritdoc */
200
- O3rComponentFixture.prototype.getElement = function () {
121
+ getElement() {
201
122
  return this.element;
202
- };
123
+ }
203
124
  /** @inheritdoc */
204
- O3rComponentFixture.prototype.getSubComponents = function () {
125
+ getSubComponents() {
205
126
  return Promise.resolve({ block: [this] });
206
- };
127
+ }
207
128
  /** @inheritDoc */
208
- O3rComponentFixture.prototype.queryNotPresent = function (selector, _timeout) {
129
+ queryNotPresent(selector, _timeout) {
209
130
  return Promise.resolve(!this.element.sourceElement.query(platform_browser_1.By.css(selector)));
210
- };
211
- return O3rComponentFixture;
212
- }());
131
+ }
132
+ }
213
133
  exports.O3rComponentFixture = O3rComponentFixture;
214
134
  //# sourceMappingURL=component-fixture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/angular/component-fixture.ts"],"names":[],"mappings":";;;;AAAA,8DAEmC;AACnC,4CAE4B;AAI5B,sCAEoB;AACpB,qCAGmB;AAQnB;;GAEG;AACH;IAME;;;OAGG;IACH,6BAAY,OAAU;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACO,qDAAuB,GAAjC,UAAwD,OAAW,EAAE,QAAiB;QACpF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED;;;;;OAKG;IACa,8CAAgB,GAAhC,UAAuD,OAA+B,EAAE,OAAgB;;;;gBACtG,sBAAO,IAAA,qBAAW,EAAC,OAAO,EAAE,OAAO,CAAC;yBACjC,IAAI,CAAC,UAAC,EAAE;wBACP,IAAI,CAAC,EAAE,EAAE,CAAC;4BACR,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,KAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;wBACnE,CAAC;wBACD,OAAO,EAAE,CAAC;oBACZ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B;IACX,6CAAe,GAAtB,UAAuB,QAAgB,EAAE,QAAiB;QACxD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,qBAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9E,CAAC;IACH,0BAAC;AAAD,CAAC,AAhND,IAgNC;AAhNY,kDAAmB","sourcesContent":["import {\n By,\n} from '@angular/platform-browser';\nimport {\n FixtureUsageError,\n} from '../../errors/index';\nimport type {\n ComponentFixtureProfile,\n} from '../component-fixture';\nimport {\n withTimeout,\n} from '../helpers';\nimport {\n O3rElement,\n O3rElementConstructor,\n} from './element';\nimport {\n O3rGroup,\n O3rGroupConstructor,\n} from './group';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to angular, hence using angular testing framework.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n /**\n * DOM element linked to the fixture.\n */\n protected element: V;\n\n /**\n * Root element of this fixture. It will be used as the context for further queries.\n * @param element\n */\n constructor(element: V) {\n this.element = element;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param _timeout specific timeout that will throw when reach\n */\n protected throwOnUndefinedElement<T extends O3rElement>(element?: T, _timeout?: number): Promise<T> {\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return Promise.resolve(element);\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefined<T extends O3rElement>(element: Promise<T | undefined>, timeout?: number): Promise<T> {\n return withTimeout(element, timeout)\n .then((el) => {\n if (!el) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return el;\n });\n }\n\n /**\n * Get the element associated to the selector if present\n * @param selector Selector to access the element\n * @param elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options Options supported\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async queryWithOptions(\n selector: string,\n elementConstructor: undefined,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n }\n ): Promise<O3rElement | undefined>;\n protected async queryWithOptions<T extends O3rElement>(\n selector: string,\n elementConstructor: O3rElementConstructor<T>,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n }\n ): Promise<T | undefined>;\n protected async queryWithOptions<T extends O3rElement>(\n selector: string,\n elementConstructor: O3rElementConstructor<T> | undefined,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}\n ): Promise<T | O3rElement | undefined> {\n const element: T | O3rElement | undefined = await (\n options.index === undefined\n ? this.query(selector, elementConstructor as any)\n : this.queryNth(selector, options.index, elementConstructor as any)\n );\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(element, options.timeout);\n }\n return element;\n }\n\n /**\n * Get text from the element associated to the given selector, or undefined if the element is not found or not visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async getText<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const element = await this.queryWithOptions(selector, options.elementConstructor as any, options);\n if (!element || !await element.isVisible()) {\n return;\n }\n return await element.getText();\n }\n\n /**\n * Check if the element associated to the given selector is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async isVisible<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<boolean> {\n const element = await this.queryWithOptions(selector, options.elementConstructor as any, options);\n return !!element && await element.isVisible();\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async click<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<void> {\n const element = await this.queryWithOptions(selector, options.elementConstructor as any, options);\n if (!!element && await element.isVisible()) {\n await element.click();\n }\n }\n\n /** @inheritdoc */\n public query(selector: string, returnType?: undefined): Promise<O3rElement | undefined>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n const queriedElement = this.element.sourceElement.query(By.css(selector));\n return Promise.resolve(queriedElement ? (returnType ? new returnType(queriedElement) : new O3rElement(queriedElement)) : undefined);\n }\n\n /** @inheritdoc */\n public queryNth(selector: string, index: number, returnType?: undefined): Promise<O3rElement | undefined>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n const queriedElement = this.element.sourceElement.queryAll(By.css(selector))[index];\n return Promise.resolve(queriedElement ? (returnType ? new returnType(queriedElement) : new O3rElement(queriedElement)) : undefined);\n }\n\n /** @inheritdoc */\n public async queryAll(_selector: string, _returnType?: undefined, groupType?: undefined, _timeout?: number): Promise<O3rElement[]>;\n public async queryAll<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, _timeout?: number): Promise<T[]>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, _timeout?: number): Promise<K>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n _timeout?: number\n ): Promise<(T | O3rElement)[] | K> {\n const queriedElement = this.element.sourceElement.queryAll(By.css(selector));\n\n const elements = queriedElement.map((el) => (returnType ? new returnType(el) : new O3rElement(el)));\n if (groupType) {\n const group = new groupType(elements as T[]);\n const isValid = await group.isValidGroup();\n\n if (!isValid) {\n throw new FixtureUsageError('invalid group of items');\n }\n return Promise.resolve(group);\n }\n\n return Promise.resolve(elements);\n }\n\n /** @inheritdoc */\n public getElement() {\n return this.element;\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{ [componentName: string]: ComponentFixtureProfile[] }> {\n return Promise.resolve({ block: [this] });\n }\n\n /** @inheritDoc */\n public queryNotPresent(selector: string, _timeout?: number): Promise<boolean> {\n return Promise.resolve(!this.element.sourceElement.query(By.css(selector)));\n }\n}\n"]}
1
+ {"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/angular/component-fixture.ts"],"names":[],"mappings":";;;AAAA,gEAEmC;AACnC,8CAE4B;AAI5B,wCAEoB;AACpB,uCAGmB;AAQnB;;GAEG;AACH,MAAa,mBAAmB;IAM9B;;;OAGG;IACH,YAAY,OAAU;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;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,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,kBAAkB;IACX,gBAAgB;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,kBAAkB;IACX,eAAe,CAAC,QAAgB,EAAE,QAAiB;QACxD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,qBAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9E,CAAC;CACF;AAhND,kDAgNC","sourcesContent":["import {\n By,\n} from '@angular/platform-browser';\nimport {\n FixtureUsageError,\n} from '../../errors/index';\nimport type {\n ComponentFixtureProfile,\n} from '../component-fixture';\nimport {\n withTimeout,\n} from '../helpers';\nimport {\n O3rElement,\n O3rElementConstructor,\n} from './element';\nimport {\n O3rGroup,\n O3rGroupConstructor,\n} from './group';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to angular, hence using angular testing framework.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n /**\n * DOM element linked to the fixture.\n */\n protected element: V;\n\n /**\n * Root element of this fixture. It will be used as the context for further queries.\n * @param element\n */\n constructor(element: V) {\n this.element = element;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param _timeout specific timeout that will throw when reach\n */\n protected throwOnUndefinedElement<T extends O3rElement>(element?: T, _timeout?: number): Promise<T> {\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return Promise.resolve(element);\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefined<T extends O3rElement>(element: Promise<T | undefined>, timeout?: number): Promise<T> {\n return withTimeout(element, timeout)\n .then((el) => {\n if (!el) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return el;\n });\n }\n\n /**\n * Get the element associated to the selector if present\n * @param selector Selector to access the element\n * @param elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options Options supported\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async queryWithOptions(\n selector: string,\n elementConstructor: undefined,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n }\n ): Promise<O3rElement | undefined>;\n protected async queryWithOptions<T extends O3rElement>(\n selector: string,\n elementConstructor: O3rElementConstructor<T>,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n }\n ): Promise<T | undefined>;\n protected async queryWithOptions<T extends O3rElement>(\n selector: string,\n elementConstructor: O3rElementConstructor<T> | undefined,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}\n ): Promise<T | O3rElement | undefined> {\n const element: T | O3rElement | undefined = await (\n options.index === undefined\n ? this.query(selector, elementConstructor as any)\n : this.queryNth(selector, options.index, elementConstructor as any)\n );\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(element, options.timeout);\n }\n return element;\n }\n\n /**\n * Get text from the element associated to the given selector, or undefined if the element is not found or not visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async getText<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const element = await this.queryWithOptions(selector, options.elementConstructor as any, options);\n if (!element || !await element.isVisible()) {\n return;\n }\n return await element.getText();\n }\n\n /**\n * Check if the element associated to the given selector is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async isVisible<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<boolean> {\n const element = await this.queryWithOptions(selector, options.elementConstructor as any, options);\n return !!element && await element.isVisible();\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async click<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<void> {\n const element = await this.queryWithOptions(selector, options.elementConstructor as any, options);\n if (!!element && await element.isVisible()) {\n await element.click();\n }\n }\n\n /** @inheritdoc */\n public query(selector: string, returnType?: undefined): Promise<O3rElement | undefined>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n const queriedElement = this.element.sourceElement.query(By.css(selector));\n return Promise.resolve(queriedElement ? (returnType ? new returnType(queriedElement) : new O3rElement(queriedElement)) : undefined);\n }\n\n /** @inheritdoc */\n public queryNth(selector: string, index: number, returnType?: undefined): Promise<O3rElement | undefined>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n const queriedElement = this.element.sourceElement.queryAll(By.css(selector))[index];\n return Promise.resolve(queriedElement ? (returnType ? new returnType(queriedElement) : new O3rElement(queriedElement)) : undefined);\n }\n\n /** @inheritdoc */\n public async queryAll(_selector: string, _returnType?: undefined, groupType?: undefined, _timeout?: number): Promise<O3rElement[]>;\n public async queryAll<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, _timeout?: number): Promise<T[]>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, _timeout?: number): Promise<K>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n _timeout?: number\n ): Promise<(T | O3rElement)[] | K> {\n const queriedElement = this.element.sourceElement.queryAll(By.css(selector));\n\n const elements = queriedElement.map((el) => (returnType ? new returnType(el) : new O3rElement(el)));\n if (groupType) {\n const group = new groupType(elements as T[]);\n const isValid = await group.isValidGroup();\n\n if (!isValid) {\n throw new FixtureUsageError('invalid group of items');\n }\n return Promise.resolve(group);\n }\n\n return Promise.resolve(elements);\n }\n\n /** @inheritdoc */\n public getElement() {\n return this.element;\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{ [componentName: string]: ComponentFixtureProfile[] }> {\n return Promise.resolve({ block: [this] });\n }\n\n /** @inheritDoc */\n public queryNotPresent(selector: string, _timeout?: number): Promise<boolean> {\n return Promise.resolve(!this.element.sourceElement.query(By.css(selector)));\n }\n}\n"]}