playwright-ui5 1.2.0 → 1.3.0
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/README.md +2 -1
- package/dist/browser/main.js +5 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,4 +35,5 @@ this selector engine uses css selector-like syntax. the main difference is that
|
|
|
35
35
|
| attribute selectors | `[text]`, `[text='foo']`,`[text*='foo']` | ✔ | some equality mods are useless for ui5 (eg. `\|=`) but are supported for the sake of completeness |
|
|
36
36
|
| id selectors | `sap.m.Button#foo` | ✔ | you should not use id selectors if the id is generated (eg. `__button1`) as they can change often |
|
|
37
37
|
| nesting | `sap.m.Table sap.m.Button`,`sap.m.Table > sap.m.Button` | ❌ | use playwright selector nesting instead (`ui5=sap.m.Table >> ui5=sap.m.Button`) |
|
|
38
|
-
| pseudo-classes | `sap.m.Table:has(sap.m.Button)` | ✔ | `:has` is supported
|
|
38
|
+
| pseudo-classes | `sap.m.Table:has(sap.m.Button)` | ✔ | only `:has` is supported for now |
|
|
39
|
+
| selector lists | `sap.m.Button,sap.m.Table` | ✔ |
|
package/dist/browser/main.js
CHANGED
|
@@ -1372,9 +1372,8 @@ var parse = (0, import_css_selector_parser.createParser)({
|
|
|
1372
1372
|
classNames: true
|
|
1373
1373
|
}
|
|
1374
1374
|
});
|
|
1375
|
-
var
|
|
1375
|
+
var querySelector = (root, selector) => selector.rules.flatMap((rule) => {
|
|
1376
1376
|
var _a;
|
|
1377
|
-
const rule = (0, import_throw_expression.throwIfUndefined)(selector.rules[0], "rules array was empty");
|
|
1378
1377
|
if (((_a = rule.tag) == null ? void 0 : _a.type) === "TagName" && rule.classNames) {
|
|
1379
1378
|
const sapNamespace = "sap";
|
|
1380
1379
|
if (rule.tag.name !== sapNamespace) {
|
|
@@ -1416,10 +1415,10 @@ var queryRule = (root, selector) => {
|
|
|
1416
1415
|
});
|
|
1417
1416
|
});
|
|
1418
1417
|
return controls.map((control) => control.getDomRef()).filter((element) => {
|
|
1419
|
-
if (element === null || root.querySelector(
|
|
1418
|
+
if (element === null || root.querySelector(`[id='${element.id}']`) === null) {
|
|
1420
1419
|
return false;
|
|
1421
1420
|
}
|
|
1422
|
-
if (rule.pseudoClasses &&
|
|
1421
|
+
if (rule.pseudoClasses && querySelector(
|
|
1423
1422
|
element,
|
|
1424
1423
|
(0, import_throw_expression.throwIfUndefined)(
|
|
1425
1424
|
rule.pseudoClasses[0],
|
|
@@ -1430,19 +1429,16 @@ var queryRule = (root, selector) => {
|
|
|
1430
1429
|
}
|
|
1431
1430
|
return true;
|
|
1432
1431
|
});
|
|
1433
|
-
};
|
|
1432
|
+
});
|
|
1434
1433
|
var queryAll = (root, selector) => {
|
|
1435
1434
|
const parsedSelector = parse(selector);
|
|
1436
1435
|
if (selector === "") {
|
|
1437
1436
|
throw new Error("ui5 selector is empty");
|
|
1438
1437
|
}
|
|
1439
|
-
if (parsedSelector.rules.length > 1) {
|
|
1440
|
-
throw new Error("comma-separated selectors not supported");
|
|
1441
|
-
}
|
|
1442
1438
|
if (typeof sap === "undefined") {
|
|
1443
1439
|
return [];
|
|
1444
1440
|
}
|
|
1445
|
-
return
|
|
1441
|
+
return querySelector(root, parsedSelector);
|
|
1446
1442
|
};
|
|
1447
1443
|
var main_default = {
|
|
1448
1444
|
queryAll,
|