@o3r/testing 13.0.0-next.26 → 13.0.0-next.28
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/core/angular/angular-materials/autocomplete-material.js +9 -20
- package/core/angular/angular-materials/autocomplete-material.js.map +1 -1
- package/core/angular/angular-materials/index.js +1 -1
- package/core/angular/angular-materials/select-material.js +42 -91
- package/core/angular/angular-materials/select-material.js.map +1 -1
- package/core/angular/angular-materials/slider-material.js +8 -11
- package/core/angular/angular-materials/slider-material.js.map +1 -1
- package/core/angular/component-fixture.js +68 -148
- package/core/angular/component-fixture.js.map +1 -1
- package/core/angular/element.js +44 -50
- package/core/angular/element.js.map +1 -1
- package/core/angular/elements/checkbox-element.js +12 -16
- package/core/angular/elements/checkbox-element.js.map +1 -1
- package/core/angular/elements/index.js +1 -1
- package/core/angular/elements/radio-element.js +12 -16
- package/core/angular/elements/radio-element.js.map +1 -1
- package/core/angular/elements/select-element.js +28 -49
- package/core/angular/elements/select-element.js.map +1 -1
- package/core/angular/elements/slider-element.js +38 -42
- package/core/angular/elements/slider-element.js.map +1 -1
- package/core/angular/group.js +9 -14
- package/core/angular/group.js.map +1 -1
- package/core/angular/groups/index.js +1 -1
- package/core/angular/groups/radio-group.js +25 -62
- package/core/angular/groups/radio-group.js.map +1 -1
- package/core/angular/index.js +1 -1
- package/core/angular/page-fixture.js +8 -11
- package/core/angular/page-fixture.js.map +1 -1
- package/core/angular-materials/autocomplete-material.js +8 -11
- package/core/angular-materials/autocomplete-material.js.map +1 -1
- package/core/angular-materials/index.js +1 -1
- package/core/angular-materials/select-material.js +12 -15
- package/core/angular-materials/select-material.js.map +1 -1
- package/core/angular-materials/slider-material.js +5 -8
- package/core/angular-materials/slider-material.js.map +1 -1
- package/core/component-fixture.js +28 -33
- package/core/component-fixture.js.map +1 -1
- package/core/element.js +24 -26
- package/core/element.js.map +1 -1
- package/core/elements/checkbox-element.js +12 -16
- package/core/elements/checkbox-element.js.map +1 -1
- package/core/elements/index.js +1 -1
- package/core/elements/radio-element.js +12 -16
- package/core/elements/radio-element.js.map +1 -1
- package/core/elements/select-element.js +10 -13
- package/core/elements/select-element.js.map +1 -1
- package/core/elements/slider-element.js +5 -8
- package/core/elements/slider-element.js.map +1 -1
- package/core/group.js +9 -15
- package/core/group.js.map +1 -1
- package/core/groups/index.js +1 -1
- package/core/groups/radio-group.js +8 -11
- package/core/groups/radio-group.js.map +1 -1
- package/core/helpers.js +11 -16
- package/core/helpers.js.map +1 -1
- package/core/index.js +1 -1
- package/core/page-fixture.js +8 -11
- package/core/page-fixture.js.map +1 -1
- package/core/playwright/angular-materials/autocomplete-material.js +26 -56
- package/core/playwright/angular-materials/autocomplete-material.js.map +1 -1
- package/core/playwright/angular-materials/index.js +1 -1
- package/core/playwright/angular-materials/select-material.js +48 -110
- package/core/playwright/angular-materials/select-material.js.map +1 -1
- package/core/playwright/angular-materials/slider-material.js +7 -10
- package/core/playwright/angular-materials/slider-material.js.map +1 -1
- package/core/playwright/component-fixture.js +88 -173
- package/core/playwright/component-fixture.js.map +1 -1
- package/core/playwright/element.js +38 -90
- package/core/playwright/element.js.map +1 -1
- package/core/playwright/elements/checkbox-element.js +49 -94
- package/core/playwright/elements/checkbox-element.js.map +1 -1
- package/core/playwright/elements/index.js +1 -1
- package/core/playwright/elements/radio-element.js +18 -34
- package/core/playwright/elements/radio-element.js.map +1 -1
- package/core/playwright/elements/select-element.js +14 -21
- package/core/playwright/elements/select-element.js.map +1 -1
- package/core/playwright/elements/slider-element.js +78 -157
- package/core/playwright/elements/slider-element.js.map +1 -1
- package/core/playwright/group.js +9 -14
- package/core/playwright/group.js.map +1 -1
- package/core/playwright/groups/index.js +1 -1
- package/core/playwright/groups/radio-group.js +27 -64
- package/core/playwright/groups/radio-group.js.map +1 -1
- package/core/playwright/index.js +1 -1
- package/core/playwright/page-fixture.js +8 -18
- package/core/playwright/page-fixture.js.map +1 -1
- package/errors/fixture-usage-error.js +5 -10
- package/errors/fixture-usage-error.js.map +1 -1
- package/errors/index.js +1 -1
- package/errors/transpilation-purpose-only.js +5 -10
- package/errors/transpilation-purpose-only.js.map +1 -1
- package/kassette/index.js +1 -1
- package/kassette/update-dates-in-mocks.js +66 -85
- package/kassette/update-dates-in-mocks.js.map +1 -1
- package/localization/index.js +1 -1
- package/localization/localization-mock.js +38 -60
- package/localization/localization-mock.js.map +1 -1
- package/mocks/index.js +1 -1
- package/mocks/mock-component-generator.js +54 -53
- package/mocks/mock-component-generator.js.map +1 -1
- package/package.json +16 -15
- package/public_api.js +1 -1
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +4 -6
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/playwright/index.d.ts.map +1 -1
- package/schematics/ng-add/playwright/index.js +3 -4
- package/schematics/ng-add/playwright/index.js.map +1 -1
- package/store/index.js +1 -1
- package/store/testable-select.js +13 -13
- package/store/testable-select.js.map +1 -1
- package/tools/index.js +1 -1
- package/tools/path-replacement/index.js +1 -1
- package/tools/path-replacement/path-replacement.js +24 -20
- package/tools/path-replacement/path-replacement.js.map +1 -1
- package/visual-test/index.js +1 -1
- package/visual-test/utils.js +18 -7
- package/visual-test/utils.js.map +1 -1
- package/visual-test/visual-test.js +29 -34
- package/visual-test/visual-test.js.map +1 -1
- package/visual-testing-reporter/index.d.ts.map +1 -1
- package/visual-testing-reporter/index.js +37 -40
- 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
|
-
|
5
|
-
var element_1 = require("../element");
|
4
|
+
const element_1 = require("../element");
|
6
5
|
/**
|
7
6
|
* Implementation dedicated to angular / TestBed.
|
8
7
|
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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":"
|
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
|
-
|
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
|
-
|
5
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
-
|
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
|
102
|
-
}
|
103
|
-
|
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":"
|
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,KAAK,CAAC,aAAa,CAAC,KAAa,EAAE,QAAiB;QACzD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,qBAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;QAClE,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACnB,MAAM,MAAM,GAAG,IAAI,oBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9C,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,qBAAqB,KAAK,+BAA+B,CAAC,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,aAAa,CAAC,KAAa,EAAE,QAAiB;QACzD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,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,YAAY,CAAC,kBAAkB,CAAC,KAAK,KAAK,EAAE,CAAC;gBAC5D,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,KAAK,CAAC,aAAa,CAAC,KAAa,EAAE,QAAiB;QACzD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
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":"
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
39
|
-
return
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
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
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
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
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
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
|
-
|
174
|
-
|
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
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
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
|
-
|
121
|
+
getElement() {
|
201
122
|
return this.element;
|
202
|
-
}
|
123
|
+
}
|
203
124
|
/** @inheritdoc */
|
204
|
-
|
125
|
+
getSubComponents() {
|
205
126
|
return Promise.resolve({ block: [this] });
|
206
|
-
}
|
127
|
+
}
|
207
128
|
/** @inheritDoc */
|
208
|
-
|
129
|
+
queryNotPresent(selector, _timeout) {
|
209
130
|
return Promise.resolve(!this.element.sourceElement.query(platform_browser_1.By.css(selector)));
|
210
|
-
}
|
211
|
-
|
212
|
-
}());
|
131
|
+
}
|
132
|
+
}
|
213
133
|
exports.O3rComponentFixture = O3rComponentFixture;
|
214
134
|
//# sourceMappingURL=component-fixture.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":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E,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,UAAC,EAAE,IAAK,OAAA,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,oBAAU,CAAC,EAAE,CAAC,CAAC,EAAtD,CAAsD,CAAC,CAAC;6BAChG,SAAS,EAAT,wBAAS;wBACL,KAAK,GAAG,IAAI,SAAS,CAAC,QAAe,CAAC,CAAC;wBAC7B,qBAAM,KAAK,CAAC,YAAY,EAAE,EAAA;;wBAApC,OAAO,GAAG,SAA0B;wBAE1C,IAAI,CAAC,OAAO,EAAE,CAAC;4BACb,MAAM,IAAI,yBAAiB,CAAC,wBAAwB,CAAC,CAAC;wBACxD,CAAC;wBACD,sBAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC;4BAGhC,sBAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAC;;;;KAClC;IAED,kBAAkB;IACX,wCAAU,GAAjB;QACE,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,kBAAkB;IACX,8CAAgB,GAAvB;QACE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,kBAAkB;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;;;;;OAKG;IACO,uBAAuB,CAAuB,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;IACO,KAAK,CAAC,gBAAgB,CAAuB,OAA+B,EAAE,OAAgB;QACtG,OAAO,IAAA,qBAAW,EAAC,OAAO,EAAE,OAAO,CAAC;aACjC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE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'@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"]}
|